From af64af23976de4d371fffe721a2841d7b4372947 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 29 May 2024 19:48:27 +0200 Subject: [PATCH] explain integer math sin/cos routines better --- compiler/test/arithmetic/aggregates.asm | 6776 ---- compiler/test/arithmetic/bitshift.asm | 8201 ----- compiler/test/arithmetic/bitshift2.asm | 8278 ----- compiler/test/arithmetic/builtins.asm | 7753 ----- compiler/test/arithmetic/div.asm | 6527 ---- compiler/test/arithmetic/minus.asm | 6644 ---- compiler/test/arithmetic/mult.asm | 6541 ---- compiler/test/arithmetic/plus.asm | 6593 ---- compiler/test/arithmetic/postincrdecr.asm | 6591 ---- compiler/test/arithmetic/remainder.asm | 5344 --- compiler/test/arithmetic/sgn.asm | 6600 ---- compiler/test/arithmetic/testforloops.asm | 10713 ------ compiler/test/arithmetic/testrepeat.asm | 5299 --- compiler/test/arithmetic/wordbyte.asm | 6308 ---- compiler/test/comparisons/more_compares.asm | 12686 ------- .../test/comparisons/optimized_compares.asm | 7101 ---- .../test/comparisons/test_byte_equalities.asm | 11535 ------- .../test/comparisons/test_byte_equalities.p8 | 1691 - compiler/test/comparisons/test_byte_gt.asm | 9320 ------ compiler/test/comparisons/test_byte_gt.p8 | 956 - compiler/test/comparisons/test_byte_gte.asm | 9304 ------ compiler/test/comparisons/test_byte_gte.p8 | 956 - compiler/test/comparisons/test_byte_lt.asm | 9403 ------ compiler/test/comparisons/test_byte_lt.p8 | 956 - compiler/test/comparisons/test_byte_lte.asm | 9119 ----- compiler/test/comparisons/test_byte_lte.p8 | 956 - .../comparisons/test_float_equalities.asm | 9992 ------ .../test/comparisons/test_float_equalities.p8 | 745 - compiler/test/comparisons/test_float_gt.asm | 8831 ----- compiler/test/comparisons/test_float_gt.p8 | 482 - compiler/test/comparisons/test_float_gte.asm | 8767 ----- compiler/test/comparisons/test_float_gte.p8 | 482 - compiler/test/comparisons/test_float_lt.asm | 8831 ----- compiler/test/comparisons/test_float_lt.p8 | 482 - compiler/test/comparisons/test_float_lte.asm | 8767 ----- compiler/test/comparisons/test_float_lte.p8 | 482 - .../comparisons/test_ubyte_equalities.asm | 11535 ------- .../test/comparisons/test_ubyte_equalities.p8 | 1691 - compiler/test/comparisons/test_ubyte_gt.asm | 9511 ------ compiler/test/comparisons/test_ubyte_gt.p8 | 956 - compiler/test/comparisons/test_ubyte_gte.asm | 9243 ------ compiler/test/comparisons/test_ubyte_gte.p8 | 956 - compiler/test/comparisons/test_ubyte_lt.asm | 9309 ------ compiler/test/comparisons/test_ubyte_lt.p8 | 956 - compiler/test/comparisons/test_ubyte_lte.asm | 9115 ----- compiler/test/comparisons/test_ubyte_lte.p8 | 956 - .../comparisons/test_uword_equalities.asm | 18832 ----------- .../test/comparisons/test_uword_equalities.p8 | 3105 -- compiler/test/comparisons/test_uword_gt.asm | 12403 ------- compiler/test/comparisons/test_uword_gt.p8 | 1618 - compiler/test/comparisons/test_uword_gte.asm | 12498 ------- compiler/test/comparisons/test_uword_gte.p8 | 1618 - compiler/test/comparisons/test_uword_lt.asm | 12754 ------- compiler/test/comparisons/test_uword_lt.p8 | 1618 - compiler/test/comparisons/test_uword_lte.asm | 12095 ------- compiler/test/comparisons/test_uword_lte.p8 | 1618 - .../test_uword_splitw_equalities.asm | 19583 ----------- .../test_uword_splitw_equalities.p8 | 3079 -- .../test/comparisons/test_uword_splitw_gt.asm | 9786 ------ .../test/comparisons/test_uword_splitw_gt.p8 | 816 - .../comparisons/test_uword_splitw_gte.asm | 9954 ------ .../test/comparisons/test_uword_splitw_gte.p8 | 816 - .../test/comparisons/test_uword_splitw_lt.asm | 10042 ------ .../test/comparisons/test_uword_splitw_lt.p8 | 816 - .../comparisons/test_uword_splitw_lte.asm | 9698 ------ .../test/comparisons/test_uword_splitw_lte.p8 | 816 - .../test/comparisons/test_word_equalities.asm | 26435 --------------- .../test/comparisons/test_word_equalities.p8 | 4987 --- compiler/test/comparisons/test_word_gt.asm | 24133 -------------- compiler/test/comparisons/test_word_gt.p8 | 4732 --- compiler/test/comparisons/test_word_gte.asm | 25549 -------------- compiler/test/comparisons/test_word_gte.p8 | 4732 --- compiler/test/comparisons/test_word_lt.asm | 25773 -------------- compiler/test/comparisons/test_word_lt.p8 | 4732 --- compiler/test/comparisons/test_word_lte.asm | 23909 ------------- compiler/test/comparisons/test_word_lte.p8 | 4732 --- .../test_word_splitw_equalities.asm | 27682 ---------------- .../test_word_splitw_equalities.p8 | 4961 --- .../test/comparisons/test_word_splitw_gt.asm | 15884 --------- .../test/comparisons/test_word_splitw_gt.p8 | 2373 -- .../test/comparisons/test_word_splitw_gte.asm | 16682 ---------- .../test/comparisons/test_word_splitw_gte.p8 | 2373 -- .../test/comparisons/test_word_splitw_lt.asm | 16668 ---------- .../test/comparisons/test_word_splitw_lt.p8 | 2373 -- .../test/comparisons/test_word_splitw_lte.asm | 15898 --------- .../test/comparisons/test_word_splitw_lte.p8 | 2373 -- docs/source/libraries.rst | 32 +- 87 files changed, 20 insertions(+), 674798 deletions(-) delete mode 100644 compiler/test/arithmetic/aggregates.asm delete mode 100644 compiler/test/arithmetic/bitshift.asm delete mode 100644 compiler/test/arithmetic/bitshift2.asm delete mode 100644 compiler/test/arithmetic/builtins.asm delete mode 100644 compiler/test/arithmetic/div.asm delete mode 100644 compiler/test/arithmetic/minus.asm delete mode 100644 compiler/test/arithmetic/mult.asm delete mode 100644 compiler/test/arithmetic/plus.asm delete mode 100644 compiler/test/arithmetic/postincrdecr.asm delete mode 100644 compiler/test/arithmetic/remainder.asm delete mode 100644 compiler/test/arithmetic/sgn.asm delete mode 100644 compiler/test/arithmetic/testforloops.asm delete mode 100644 compiler/test/arithmetic/testrepeat.asm delete mode 100644 compiler/test/arithmetic/wordbyte.asm delete mode 100644 compiler/test/comparisons/more_compares.asm delete mode 100644 compiler/test/comparisons/optimized_compares.asm delete mode 100644 compiler/test/comparisons/test_byte_equalities.asm delete mode 100644 compiler/test/comparisons/test_byte_equalities.p8 delete mode 100644 compiler/test/comparisons/test_byte_gt.asm delete mode 100644 compiler/test/comparisons/test_byte_gt.p8 delete mode 100644 compiler/test/comparisons/test_byte_gte.asm delete mode 100644 compiler/test/comparisons/test_byte_gte.p8 delete mode 100644 compiler/test/comparisons/test_byte_lt.asm delete mode 100644 compiler/test/comparisons/test_byte_lt.p8 delete mode 100644 compiler/test/comparisons/test_byte_lte.asm delete mode 100644 compiler/test/comparisons/test_byte_lte.p8 delete mode 100644 compiler/test/comparisons/test_float_equalities.asm delete mode 100644 compiler/test/comparisons/test_float_equalities.p8 delete mode 100644 compiler/test/comparisons/test_float_gt.asm delete mode 100644 compiler/test/comparisons/test_float_gt.p8 delete mode 100644 compiler/test/comparisons/test_float_gte.asm delete mode 100644 compiler/test/comparisons/test_float_gte.p8 delete mode 100644 compiler/test/comparisons/test_float_lt.asm delete mode 100644 compiler/test/comparisons/test_float_lt.p8 delete mode 100644 compiler/test/comparisons/test_float_lte.asm delete mode 100644 compiler/test/comparisons/test_float_lte.p8 delete mode 100644 compiler/test/comparisons/test_ubyte_equalities.asm delete mode 100644 compiler/test/comparisons/test_ubyte_equalities.p8 delete mode 100644 compiler/test/comparisons/test_ubyte_gt.asm delete mode 100644 compiler/test/comparisons/test_ubyte_gt.p8 delete mode 100644 compiler/test/comparisons/test_ubyte_gte.asm delete mode 100644 compiler/test/comparisons/test_ubyte_gte.p8 delete mode 100644 compiler/test/comparisons/test_ubyte_lt.asm delete mode 100644 compiler/test/comparisons/test_ubyte_lt.p8 delete mode 100644 compiler/test/comparisons/test_ubyte_lte.asm delete mode 100644 compiler/test/comparisons/test_ubyte_lte.p8 delete mode 100644 compiler/test/comparisons/test_uword_equalities.asm delete mode 100644 compiler/test/comparisons/test_uword_equalities.p8 delete mode 100644 compiler/test/comparisons/test_uword_gt.asm delete mode 100644 compiler/test/comparisons/test_uword_gt.p8 delete mode 100644 compiler/test/comparisons/test_uword_gte.asm delete mode 100644 compiler/test/comparisons/test_uword_gte.p8 delete mode 100644 compiler/test/comparisons/test_uword_lt.asm delete mode 100644 compiler/test/comparisons/test_uword_lt.p8 delete mode 100644 compiler/test/comparisons/test_uword_lte.asm delete mode 100644 compiler/test/comparisons/test_uword_lte.p8 delete mode 100644 compiler/test/comparisons/test_uword_splitw_equalities.asm delete mode 100644 compiler/test/comparisons/test_uword_splitw_equalities.p8 delete mode 100644 compiler/test/comparisons/test_uword_splitw_gt.asm delete mode 100644 compiler/test/comparisons/test_uword_splitw_gt.p8 delete mode 100644 compiler/test/comparisons/test_uword_splitw_gte.asm delete mode 100644 compiler/test/comparisons/test_uword_splitw_gte.p8 delete mode 100644 compiler/test/comparisons/test_uword_splitw_lt.asm delete mode 100644 compiler/test/comparisons/test_uword_splitw_lt.p8 delete mode 100644 compiler/test/comparisons/test_uword_splitw_lte.asm delete mode 100644 compiler/test/comparisons/test_uword_splitw_lte.p8 delete mode 100644 compiler/test/comparisons/test_word_equalities.asm delete mode 100644 compiler/test/comparisons/test_word_equalities.p8 delete mode 100644 compiler/test/comparisons/test_word_gt.asm delete mode 100644 compiler/test/comparisons/test_word_gt.p8 delete mode 100644 compiler/test/comparisons/test_word_gte.asm delete mode 100644 compiler/test/comparisons/test_word_gte.p8 delete mode 100644 compiler/test/comparisons/test_word_lt.asm delete mode 100644 compiler/test/comparisons/test_word_lt.p8 delete mode 100644 compiler/test/comparisons/test_word_lte.asm delete mode 100644 compiler/test/comparisons/test_word_lte.p8 delete mode 100644 compiler/test/comparisons/test_word_splitw_equalities.asm delete mode 100644 compiler/test/comparisons/test_word_splitw_equalities.p8 delete mode 100644 compiler/test/comparisons/test_word_splitw_gt.asm delete mode 100644 compiler/test/comparisons/test_word_splitw_gt.p8 delete mode 100644 compiler/test/comparisons/test_word_splitw_gte.asm delete mode 100644 compiler/test/comparisons/test_word_splitw_gte.p8 delete mode 100644 compiler/test/comparisons/test_word_splitw_lt.asm delete mode 100644 compiler/test/comparisons/test_word_splitw_lt.p8 delete mode 100644 compiler/test/comparisons/test_word_splitw_lte.asm delete mode 100644 compiler/test/comparisons/test_word_splitw_lte.p8 diff --git a/compiler/test/arithmetic/aggregates.asm b/compiler/test/arithmetic/aggregates.asm deleted file mode 100644 index ff7cb7a22..000000000 --- a/compiler/test/arithmetic/aggregates.asm +++ /dev/null @@ -1,6776 +0,0 @@ -; w65c02 assembly code for 'aggregates' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:56 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -p8v_ub = 34 ; zp UBYTE -p8v_length = 35 ; zp UBYTE -p8v_bb = 36 ; zp BYTE -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8v_ub - stz p8v_bb - stz p8v_ff - stz p8v_ff+1 - stz p8v_ff+2 - stz p8v_ff+3 - stz p8v_ff+4 - - lda #5 - sta p8v_length - cmp #5 - beq label_asm_1_afterif - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8s_start.p8v_name - lda #prog8_interned_strings.string_3 - lda #p8b_main.p8s_start.p8v_name - lda #prog8_interned_strings.string_4 - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_any_b_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_5_afterif - ldy #>prog8_interned_strings.string_5 - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_any_b_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_6_afterif - ldy #>prog8_interned_strings.string_6 - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_any_w_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_7_afterif - ldy #>prog8_interned_strings.string_7 - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_any_w_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_8_afterif - ldy #>prog8_interned_strings.string_8 - lda #p8v_farr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr floats.func_any_f_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_9_afterif - ldy #>prog8_interned_strings.string_9 - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_b_into_A - sta p8v_ub - cmp #1 - bne label_asm_10_afterif - ldy #>prog8_interned_strings.string_10 - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_b_into_A - sta p8v_ub - cmp #1 - bne label_asm_11_afterif - ldy #>prog8_interned_strings.string_11 - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_w_into_A - sta p8v_ub - cmp #1 - bne label_asm_12_afterif - ldy #>prog8_interned_strings.string_12 - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_w_into_A - sta p8v_ub - cmp #1 - bne label_asm_13_afterif - ldy #>prog8_interned_strings.string_13 - lda #p8v_farr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr floats.func_all_f_into_A - sta p8v_ub - cmp #1 - bne label_asm_14_afterif - ldy #>prog8_interned_strings.string_14 - lda #$4000 - sta p8v_uwarr+1,y - ldy #2 - lda #<$4000 - sta p8v_warr,y - lda #>$4000 - sta p8v_warr+1,y - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_farr - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_b_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_15_afterif - ldy #>prog8_interned_strings.string_15 - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_b_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_16_afterif - ldy #>prog8_interned_strings.string_16 - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_w_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_17_afterif - ldy #>prog8_interned_strings.string_17 - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr prog8_lib.func_all_w_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_18_afterif - ldy #>prog8_interned_strings.string_18 - lda #p8v_farr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #5 - jsr floats.func_all_f_into_A - sta p8v_ub - lda p8v_ub - bne label_asm_19_afterif - ldy #>prog8_interned_strings.string_19 - lda #prog8_interned_strings.string_20 - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'string' ---- -string .proc - - - -length .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - -left .proc - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - sta P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_W1+1 - lda cx16.r1 - sta P8ZP_SCRATCH_W2 - lda cx16.r1+1 - sta P8ZP_SCRATCH_W2+1 - lda #0 - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop - rts -_loop dey - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop -+ rts - .pend - -right .proc - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - stx P8ZP_SCRATCH_B1 - sta cx16.r0 - sty cx16.r0+1 - jsr string.length - tya - sec - sbc P8ZP_SCRATCH_B1 - clc - adc cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - adc #0 - sta P8ZP_SCRATCH_W1+1 - ldy cx16.r1 - sty P8ZP_SCRATCH_W2 - ldy cx16.r1+1 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop - rts -_loop dey - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop -+ rts - .pend - -slice .proc - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - ; substr(source, target, start, length) - sta P8ZP_SCRATCH_B1 - lda cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - sta P8ZP_SCRATCH_W1+1 - lda cx16.r1 - sta P8ZP_SCRATCH_W2 - lda cx16.r1+1 - sta P8ZP_SCRATCH_W2+1 - - ; adjust src location - clc - lda P8ZP_SCRATCH_W1 - adc P8ZP_SCRATCH_B1 - sta P8ZP_SCRATCH_W1 - bcc + - inc P8ZP_SCRATCH_W1+1 -+ lda #0 - sta (P8ZP_SCRATCH_W2),y - beq _startloop -- lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y -_startloop dey - cpy #$ff - bne - - rts - .pend - -find .proc - ; need to copy the the cx16 virtual registers to zeropage to make this run on C64... - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - stx P8ZP_SCRATCH_B1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _notfound - cmp P8ZP_SCRATCH_B1 - beq _found - iny - bne - -_notfound lda #0 - clc - rts -_found tya - sec - rts - .pend - -contains .proc - jmp find - .pend - -copy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -append .proc - lda cx16.r0 - ldy cx16.r0+1 - jsr length - sty P8ZP_SCRATCH_B1 - tya - clc - adc cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - adc #0 - sta P8ZP_SCRATCH_W1+1 - lda cx16.r1 - ldy cx16.r1+1 - jsr prog8_lib.strcpy - tya - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -compare .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcmp_mem - .pend - -lower .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _done - and #$7f - cmp #97 - bcc + - cmp #123 - bcs + - and #%11011111 -+ sta (P8ZP_SCRATCH_W1),y - iny - bne - -_done rts - .pend - -upper .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _done - cmp #65 - bcc + - cmp #91 - bcs + - ora #%00100000 -+ sta (P8ZP_SCRATCH_W1),y - iny - bne - -_done rts - .pend - -lowerchar .proc - and #$7f - cmp #97 - bcc + - cmp #123 - bcs + - and #%11011111 -+ rts - .pend - -upperchar .proc - cmp #65 - bcc + - cmp #91 - bcs + - ora #%00100000 -+ rts - .pend - -pattern_match .proc -; pattern matching of a string. -; Input: cx16.r0: A NUL-terminated, <255-length pattern -; AY: A NUL-terminated, <255-length string -; -; Output: A = 1 if the string matches the pattern, A = 0 if not. -; -; Notes: Clobbers A, X, Y. Each * in the pattern uses 4 bytes of stack. -; -; see http://6502.org/source/strings/patmatch.htm - -strptr = P8ZP_SCRATCH_W1 - - sta strptr - sty strptr+1 - lda cx16.r0 - sta modify_pattern1+1 - sta modify_pattern2+1 - lda cx16.r0+1 - sta modify_pattern1+2 - sta modify_pattern2+2 - jsr _match - lda #0 - rol a - rts - - -_match - ldx #$00 ; x is an index in the pattern - ldy #$ff ; y is an index in the string -modify_pattern1 -next lda $ffff,x ; look at next pattern character MODIFIED - cmp #'*' ; is it a star? - beq star ; yes, do the complicated stuff - iny ; no, let's look at the string - cmp #'?' ; is the pattern caracter a ques? - bne reg ; no, it's a regular character - lda (strptr),y ; yes, so it will match anything - beq fail ; except the end of string -reg cmp (strptr),y ; are both characters the same? - bne fail ; no, so no match - inx ; yes, keep checking - cmp #0 ; are we at end of string? - bne next ; not yet, loop -found rts ; success, return with c=1 - -star inx ; skip star in pattern -modify_pattern2 - cmp $ffff,x ; string of stars equals one star MODIFIED - beq star ; so skip them also -stloop txa ; we first try to match with * = "" - pha ; and grow it by 1 character every - tya ; time we loop - pha ; save x and y on stack - jsr next ; recursive call - pla ; restore x and y - tay - pla - tax - bcs found ; we found a match, return with c=1 - iny ; no match yet, try to grow * string - lda (strptr),y ; are we at the end of string? - bne stloop ; not yet, add a character -fail clc ; yes, no match found, return with c=0 - rts - .pend - -hash .proc - lda #179 - sta P8ZP_SCRATCH_REG - ldy #0 - clc -- lda (cx16.r0),y - beq + - rol P8ZP_SCRATCH_REG - eor P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_REG - iny - bne - -+ lda P8ZP_SCRATCH_REG - rts - .pend - -isdigit .proc - cmp #'0' - bcs + - rts -+ cmp #'9'+1 - bcc + - clc - rts -+ sec - rts - .pend - -isupper .proc - cmp #97 - bcs + - rts -+ cmp #122+1 - bcc _yes - cmp #193 - bcs + - rts -+ cmp #218+1 - bcc _yes - clc - rts -_yes sec - rts - .pend - -islower .proc - cmp #'a' - bcs + - rts -+ cmp #'z'+1 - bcc + - clc - rts -+ sec - rts - .pend - -isletter .proc - jsr islower - bcs + - jmp isupper -+ rts - .pend - -isspace .proc - cmp #32 - beq + - cmp #13 - beq + - cmp #9 - beq + - cmp #10 - beq + - cmp #141 - beq + - cmp #160 - beq + - clc - rts -+ sec - rts - .pend - -isprint .proc - cmp #160 - bcc + - rts -+ cmp #32 - bcs + - rts -+ cmp #128 - bcc + - clc - rts -+ sec - rts - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $0c, $cc, $cc, $cc ; float 1.1 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/bitshift.asm b/compiler/test/arithmetic/bitshift.asm deleted file mode 100644 index 5d28a45b5..000000000 --- a/compiler/test/arithmetic/bitshift.asm +++ /dev/null @@ -1,8201 +0,0 @@ -; w65c02 assembly code for 'bitshift' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - -; non-zeropage variables -p8v_inputbuffer ; PETSCII:"????????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $3f, $3f, $3f, $3f, $00 - - -p8s_start .proc -p8v_uw = 34 ; zp UWORD -p8v_sw = 36 ; zp WORD -p8v_signedb = 38 ; zp BYTE -p8v_a = 39 ; zp UBYTE -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8v_a - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_2 - lda #p8b_main.p8v_inputbuffer - lda #prog8_interned_strings.string_9 - lda #$a49f - sta p8v_q - sty p8v_q+1 - - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw1 .proc -p8v_q = 68 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw2 .proc -p8v_q = 54 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw3 .proc -p8v_q = 52 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw4 .proc -p8v_q = 50 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw5 .proc -p8v_q = 48 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw6 .proc -p8v_q = 46 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw7 .proc -p8v_q = 44 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - lsr P8ZP_SCRATCH_B1 - ror a - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw8 .proc -p8v_q = 42 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw9 .proc -p8v_q = 40 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw10 .proc -p8v_q = 66 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw11 .proc -p8v_q = 64 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - lsr a - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw12 .proc -p8v_q = 62 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - lsr a - lsr a - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw13 .proc -p8v_q = 60 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - lsr a - lsr a - lsr a - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw14 .proc -p8v_q = 58 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - lsr a - lsr a - lsr a - lsr a - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftruw15 .proc -p8v_q = 56 ; zp UWORD -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - lsr a - lsr a - lsr a - lsr a - lsr a - lsr a - lsr a - ldy #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw0 .proc -p8v_q = 102 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw1 .proc -p8v_q = 100 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #1 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw2 .proc -p8v_q = 86 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #2 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw3 .proc -p8v_q = 84 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #3 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw4 .proc -p8v_q = 82 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #4 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw5 .proc -p8v_q = 80 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #5 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw6 .proc -p8v_q = 78 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #6 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw7 .proc -p8v_q = 76 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - ldx #7 - jmp math.lsr_word_AY -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw8 .proc -p8v_q = 74 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw9 .proc -p8v_q = 72 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #1 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw10 .proc -p8v_q = 98 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #2 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw11 .proc -p8v_q = 96 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #3 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw12 .proc -p8v_q = 94 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #4 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw13 .proc -p8v_q = 92 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #5 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw14 .proc -p8v_q = 90 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #6 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsw15 .proc -p8v_q = 88 ; zp WORD -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda p8v_q+1 - ldy #7 - jsr math.lsr_byte_A - ldy #0 - cmp #$80 - bcc + - dey -+ - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftluw0 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw1 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw2 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw3 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw4 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw5 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw6 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw7 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw8 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - ldy p8v_q - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw9 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw10 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw11 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw12 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw13 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw14 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw15 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw16 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - tay - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftluw17 .proc -; statements - lda #<$a49f - ldy #>$a49f - sta p8v_q - sty p8v_q+1 - - lda #0 - tay - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .word ? - .send BSS - .pend - -p8s_shiftlsw0 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw1 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw2 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw3 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw4 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw5 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw6 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw7 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - sty P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - asl a - rol P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_B1 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw8 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - ldy p8v_q - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw9 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw10 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw11 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw12 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw13 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw14 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw15 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - pha - lda p8v_q - asl a - asl a - asl a - asl a - asl a - asl a - asl a - tay - pla - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw16 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - tay - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlsw17 .proc -; statements - lda #<-$3039 - ldy #>-$3039 - sta p8v_q - sty p8v_q+1 - - lda #0 - tay - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_q .sint ? - .send BSS - .pend - -p8s_shiftlb0 .proc -; statements - lda #$ed - sta p8v_yy - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb1 .proc -; statements - lda #$ed - sta p8v_yy - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb2 .proc -; statements - lda #$ed - sta p8v_yy - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb3 .proc -; statements - lda #$ed - sta p8v_yy - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb4 .proc -; statements - lda #$ed - sta p8v_yy - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb5 .proc -; statements - lda #$ed - sta p8v_yy - asl a - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb6 .proc -; statements - lda #$ed - sta p8v_yy - asl a - asl a - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb7 .proc -; statements - lda #$ed - sta p8v_yy - asl a - asl a - asl a - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb8 .proc -; statements - lda #$ed - sta p8v_yy - lda #0 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftlb9 .proc -; statements - lda #$ed - sta p8v_yy - lda #0 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftrb0 .proc -; statements - lda #$ed - sta p8v_yy - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftrb1 .proc -; statements - lda #$ed - sta p8v_yy - lsr a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .byte ? - .send BSS - .pend - -p8s_shiftrb2 .proc -p8v_yy = 121 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lsr a - lsr a - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb3 .proc -p8v_yy = 120 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lsr a - lsr a - lsr a - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb4 .proc -p8v_yy = 119 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lsr a - lsr a - lsr a - lsr a - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb5 .proc -p8v_yy = 118 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lsr a - lsr a - lsr a - lsr a - lsr a - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb6 .proc -p8v_yy = 117 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lsr a - lsr a - lsr a - lsr a - lsr a - lsr a - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb7 .proc -p8v_yy = 116 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lsr a - lsr a - lsr a - lsr a - lsr a - lsr a - lsr a - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb8 .proc -p8v_yy = 115 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lda #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrb9 .proc -p8v_yy = 114 ; zp UBYTE -; statements - lda #$ed - sta p8v_yy - lda #0 - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftlsb0 .proc -; statements - lda #-$7b - sta p8v_yy - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb1 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb2 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb3 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb4 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb5 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb6 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - asl a - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb7 .proc -; statements - lda #-$7b - sta p8v_yy - asl a - asl a - asl a - asl a - asl a - asl a - asl a - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb8 .proc -; statements - lda #-$7b - sta p8v_yy - lda #0 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftlsb9 .proc -; statements - lda #-$7b - sta p8v_yy - lda #0 - rts -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_yy .char ? - .send BSS - .pend - -p8s_shiftrsb0 .proc -p8v_yy = 113 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb1 .proc -p8v_yy = 112 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #1 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb2 .proc -p8v_yy = 111 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #2 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb3 .proc -p8v_yy = 110 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #3 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb4 .proc -p8v_yy = 109 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #4 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb5 .proc -p8v_yy = 108 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #5 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb6 .proc -p8v_yy = 107 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #6 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb7 .proc -p8v_yy = 106 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #7 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb8 .proc -p8v_yy = 105 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #8 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - -p8s_shiftrsb9 .proc -p8v_yy = 104 ; zp BYTE -; statements - lda #-$7b - sta p8v_yy - ldy #8 - jmp math.lsr_byte_A -; variables - .section BSS - .send BSS - - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"ubyte shift left\n" - .byte $55, $42, $59, $54, $45, $20, $53, $48, $49, $46, $54, $20, $4c, $45, $46, $54 - .byte $0d, $00 -string_2 ; PETSCII:"enter to continue:\n" - .byte $45, $4e, $54, $45, $52, $20, $54, $4f, $20, $43, $4f, $4e, $54, $49, $4e, $55 - .byte $45, $3a, $0d, $00 -string_3 ; PETSCII:"ubyte shift right\n" - .byte $55, $42, $59, $54, $45, $20, $53, $48, $49, $46, $54, $20, $52, $49, $47, $48 - .byte $54, $0d, $00 -string_4 ; PETSCII:"signed byte shift left\n" - .byte $53, $49, $47, $4e, $45, $44, $20, $42, $59, $54, $45, $20, $53, $48, $49, $46 - .byte $54, $20, $4c, $45, $46, $54, $0d, $00 -string_5 ; PETSCII:"signed byte shift right\n" - .byte $53, $49, $47, $4e, $45, $44, $20, $42, $59, $54, $45, $20, $53, $48, $49, $46 - .byte $54, $20, $52, $49, $47, $48, $54, $0d, $00 -string_6 ; PETSCII:"uword shift left\n" - .byte $55, $57, $4f, $52, $44, $20, $53, $48, $49, $46, $54, $20, $4c, $45, $46, $54 - .byte $0d, $00 -string_7 ; PETSCII:"uword shift right\n" - .byte $55, $57, $4f, $52, $44, $20, $53, $48, $49, $46, $54, $20, $52, $49, $47, $48 - .byte $54, $0d, $00 -string_8 ; PETSCII:"signed word shift left\n" - .byte $53, $49, $47, $4e, $45, $44, $20, $57, $4f, $52, $44, $20, $53, $48, $49, $46 - .byte $54, $20, $4c, $45, $46, $54, $0d, $00 -string_9 ; PETSCII:"signed word shift right\n" - .byte $53, $49, $47, $4e, $45, $44, $20, $57, $4f, $52, $44, $20, $53, $48, $49, $46 - .byte $54, $20, $52, $49, $47, $48, $54, $0d, $00 - - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/bitshift2.asm b/compiler/test/arithmetic/bitshift2.asm deleted file mode 100644 index e4bb2cff4..000000000 --- a/compiler/test/arithmetic/bitshift2.asm +++ /dev/null @@ -1,8278 +0,0 @@ -; w65c02 assembly code for 'bitshift2' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - -; non-zeropage variables without initialization value - .section BSS -p8v_barray .fill 2 -p8v_ubarray .fill 2 -p8v_uwarray .fill 4 -p8v_warray .fill 4 - .send BSS - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - jsr p8b_main.p8s_unsigned - jmp p8b_main.p8s_signed -; variables - .section BSS - .send BSS - - .pend - -p8s_print_bool .proc -; simple int arg(s) passed via register(s) - sta p8v_b -; statements - jmp txt.print_ub -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_b .byte ? - .send BSS - .pend - -p8s_value_and_carry .proc -p8v_value = 34 ; zp UBYTE -; simple int arg(s) passed via register(s) - sta p8v_value -; statements - sec - lda p8v_value - rts -; variables - .section BSS - .send BSS - - .pend - -p8s_unsigned .proc -; statements - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #$80 - sta p8b_main.p8s_test_rol_uw.p8v_value - sty p8b_main.p8s_test_rol_uw.p8v_value+1 - - stz p8b_main.p8s_test_rol_uw.p8v_carry - lda #<$0100 - ldy #>$0100 - sta p8b_main.p8s_test_rol_uw.p8v_test - sty p8b_main.p8s_test_rol_uw.p8v_test+1 - - stz p8b_main.p8s_test_rol_uw.p8v_newcarry - jsr p8b_main.p8s_test_rol_uw - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_test_rol_uw.p8v_value - sty p8b_main.p8s_test_rol_uw.p8v_value+1 - - lda #1 - sta p8b_main.p8s_test_rol_uw.p8v_carry - sta p8b_main.p8s_test_rol_uw.p8v_test - sta p8b_main.p8s_test_rol_uw.p8v_test+1 - - stz p8b_main.p8s_test_rol_uw.p8v_newcarry - jsr p8b_main.p8s_test_rol_uw - lda #<$4080 - ldy #>$4080 - sta p8b_main.p8s_test_rol_uw.p8v_value - sty p8b_main.p8s_test_rol_uw.p8v_value+1 - - stz p8b_main.p8s_test_rol_uw.p8v_carry - lda #<$8100 - ldy #>$8100 - sta p8b_main.p8s_test_rol_uw.p8v_test - sty p8b_main.p8s_test_rol_uw.p8v_test+1 - - stz p8b_main.p8s_test_rol_uw.p8v_newcarry - jsr p8b_main.p8s_test_rol_uw - lda #<$4080 - ldy #>$4080 - sta p8b_main.p8s_test_rol_uw.p8v_value - sty p8b_main.p8s_test_rol_uw.p8v_value+1 - - lda #1 - sta p8b_main.p8s_test_rol_uw.p8v_carry - lda #<$8101 - ldy #>$8101 - sta p8b_main.p8s_test_rol_uw.p8v_test - sty p8b_main.p8s_test_rol_uw.p8v_test+1 - - stz p8b_main.p8s_test_rol_uw.p8v_newcarry - jsr p8b_main.p8s_test_rol_uw - lda #$80 - sta p8b_main.p8s_test_rol_uw.p8v_value - sta p8b_main.p8s_test_rol_uw.p8v_value+1 - - stz p8b_main.p8s_test_rol_uw.p8v_carry - lda #<$0100 - ldy #>$0100 - sta p8b_main.p8s_test_rol_uw.p8v_test - sty p8b_main.p8s_test_rol_uw.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_rol_uw.p8v_newcarry - jsr p8b_main.p8s_test_rol_uw - lda #$80 - sta p8b_main.p8s_test_rol_uw.p8v_value - sta p8b_main.p8s_test_rol_uw.p8v_value+1 - - lda #1 - sta p8b_main.p8s_test_rol_uw.p8v_carry - sta p8b_main.p8s_test_rol_uw.p8v_test - sta p8b_main.p8s_test_rol_uw.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_rol_uw.p8v_newcarry - jsr p8b_main.p8s_test_rol_uw - ldy #>prog8_interned_strings.string_6 - lda #$0100 - sta p8b_main.p8s_test_ror_uw.p8v_value - sty p8b_main.p8s_test_ror_uw.p8v_value+1 - - stz p8b_main.p8s_test_ror_uw.p8v_carry - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_test_ror_uw.p8v_test - sty p8b_main.p8s_test_ror_uw.p8v_test+1 - - stz p8b_main.p8s_test_ror_uw.p8v_newcarry - jsr p8b_main.p8s_test_ror_uw - lda #<$0100 - ldy #>$0100 - sta p8b_main.p8s_test_ror_uw.p8v_value - sty p8b_main.p8s_test_ror_uw.p8v_value+1 - - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_carry - lda #$80 - sta p8b_main.p8s_test_ror_uw.p8v_test - sta p8b_main.p8s_test_ror_uw.p8v_test+1 - - stz p8b_main.p8s_test_ror_uw.p8v_newcarry - jsr p8b_main.p8s_test_ror_uw - lda #<$4100 - ldy #>$4100 - sta p8b_main.p8s_test_ror_uw.p8v_value - sty p8b_main.p8s_test_ror_uw.p8v_value+1 - - stz p8b_main.p8s_test_ror_uw.p8v_carry - lda #<$2080 - ldy #>$2080 - sta p8b_main.p8s_test_ror_uw.p8v_test - sty p8b_main.p8s_test_ror_uw.p8v_test+1 - - stz p8b_main.p8s_test_ror_uw.p8v_newcarry - jsr p8b_main.p8s_test_ror_uw - lda #<$4100 - ldy #>$4100 - sta p8b_main.p8s_test_ror_uw.p8v_value - sty p8b_main.p8s_test_ror_uw.p8v_value+1 - - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_carry - lda #<$a080 - ldy #>$a080 - sta p8b_main.p8s_test_ror_uw.p8v_test - sty p8b_main.p8s_test_ror_uw.p8v_test+1 - - stz p8b_main.p8s_test_ror_uw.p8v_newcarry - jsr p8b_main.p8s_test_ror_uw - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_value - sta p8b_main.p8s_test_ror_uw.p8v_value+1 - - stz p8b_main.p8s_test_ror_uw.p8v_carry - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_test_ror_uw.p8v_test - sty p8b_main.p8s_test_ror_uw.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_newcarry - jsr p8b_main.p8s_test_ror_uw - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_value - sta p8b_main.p8s_test_ror_uw.p8v_value+1 - - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_carry - lda #$80 - sta p8b_main.p8s_test_ror_uw.p8v_test - sta p8b_main.p8s_test_ror_uw.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_ror_uw.p8v_newcarry - jsr p8b_main.p8s_test_ror_uw - ldy #>prog8_interned_strings.string_7 - lda #$80 - sta p8b_main.p8s_test_rol2_uw.p8v_value - sty p8b_main.p8s_test_rol2_uw.p8v_value+1 - - lda #<$0100 - ldy #>$0100 - sta p8b_main.p8s_test_rol2_uw.p8v_test - sty p8b_main.p8s_test_rol2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_rol2_uw - lda #<$4180 - ldy #>$4180 - sta p8b_main.p8s_test_rol2_uw.p8v_value - sty p8b_main.p8s_test_rol2_uw.p8v_value+1 - - lda #<$8300 - ldy #>$8300 - sta p8b_main.p8s_test_rol2_uw.p8v_test - sty p8b_main.p8s_test_rol2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_rol2_uw - lda #<$8280 - ldy #>$8280 - sta p8b_main.p8s_test_rol2_uw.p8v_value - sty p8b_main.p8s_test_rol2_uw.p8v_value+1 - - lda #<$0501 - ldy #>$0501 - sta p8b_main.p8s_test_rol2_uw.p8v_test - sty p8b_main.p8s_test_rol2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_rol2_uw - lda #<$fe80 - ldy #>$fe80 - sta p8b_main.p8s_test_rol2_uw.p8v_value - sty p8b_main.p8s_test_rol2_uw.p8v_value+1 - - lda #<$fd01 - ldy #>$fd01 - sta p8b_main.p8s_test_rol2_uw.p8v_test - sty p8b_main.p8s_test_rol2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_rol2_uw - ldy #>prog8_interned_strings.string_8 - lda #$0100 - sta p8b_main.p8s_test_ror2_uw.p8v_value - sty p8b_main.p8s_test_ror2_uw.p8v_value+1 - - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_test_ror2_uw.p8v_test - sty p8b_main.p8s_test_ror2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_ror2_uw - lda #<$4100 - ldy #>$4100 - sta p8b_main.p8s_test_ror2_uw.p8v_value - sty p8b_main.p8s_test_ror2_uw.p8v_value+1 - - lda #<$2080 - ldy #>$2080 - sta p8b_main.p8s_test_ror2_uw.p8v_test - sty p8b_main.p8s_test_ror2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_ror2_uw - lda #<$8301 - ldy #>$8301 - sta p8b_main.p8s_test_ror2_uw.p8v_value - sty p8b_main.p8s_test_ror2_uw.p8v_value+1 - - lda #<$c180 - ldy #>$c180 - sta p8b_main.p8s_test_ror2_uw.p8v_test - sty p8b_main.p8s_test_ror2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_ror2_uw - lda #<$ff03 - ldy #>$ff03 - sta p8b_main.p8s_test_ror2_uw.p8v_value - sty p8b_main.p8s_test_ror2_uw.p8v_value+1 - - lda #<$ff81 - ldy #>$ff81 - sta p8b_main.p8s_test_ror2_uw.p8v_test - sty p8b_main.p8s_test_ror2_uw.p8v_test+1 - - jsr p8b_main.p8s_test_ror2_uw - ldy #>prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #1 - sta p8b_main.p8s_test_shiftl_uw.p8v_value - sty p8b_main.p8s_test_shiftl_uw.p8v_value+1 - - lda #<2 - ldy #>2 - sta p8b_main.p8s_test_shiftl_uw.p8v_test - sty p8b_main.p8s_test_shiftl_uw.p8v_test+1 - - stz p8b_main.p8s_test_shiftl_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_uw - lda #<$81 - ldy #>$81 - sta p8b_main.p8s_test_shiftl_uw.p8v_value - sty p8b_main.p8s_test_shiftl_uw.p8v_value+1 - - lda #<$0102 - ldy #>$0102 - sta p8b_main.p8s_test_shiftl_uw.p8v_test - sty p8b_main.p8s_test_shiftl_uw.p8v_test+1 - - stz p8b_main.p8s_test_shiftl_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_uw - lda #<$4080 - ldy #>$4080 - sta p8b_main.p8s_test_shiftl_uw.p8v_value - sty p8b_main.p8s_test_shiftl_uw.p8v_value+1 - - lda #<$8100 - ldy #>$8100 - sta p8b_main.p8s_test_shiftl_uw.p8v_test - sty p8b_main.p8s_test_shiftl_uw.p8v_test+1 - - stz p8b_main.p8s_test_shiftl_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_uw - lda #<$c080 - ldy #>$c080 - sta p8b_main.p8s_test_shiftl_uw.p8v_value - sty p8b_main.p8s_test_shiftl_uw.p8v_value+1 - - lda #<$8100 - ldy #>$8100 - sta p8b_main.p8s_test_shiftl_uw.p8v_test - sty p8b_main.p8s_test_shiftl_uw.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_shiftl_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_uw - lda #<$8000 - ldy #>$8000 - sta p8b_main.p8s_test_shiftl_uw.p8v_value - sty p8b_main.p8s_test_shiftl_uw.p8v_value+1 - - stz p8b_main.p8s_test_shiftl_uw.p8v_test - stz p8b_main.p8s_test_shiftl_uw.p8v_test+1 - lda #1 - sta p8b_main.p8s_test_shiftl_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_uw - ldy #>prog8_interned_strings.string_12 - lda #1 - sta p8b_main.p8s_test_shiftr_uw.p8v_value - sty p8b_main.p8s_test_shiftr_uw.p8v_value+1 - - stz p8b_main.p8s_test_shiftr_uw.p8v_test - stz p8b_main.p8s_test_shiftr_uw.p8v_test+1 - lda #1 - sta p8b_main.p8s_test_shiftr_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_uw - lda #<$0302 - ldy #>$0302 - sta p8b_main.p8s_test_shiftr_uw.p8v_value - sty p8b_main.p8s_test_shiftr_uw.p8v_value+1 - - lda #<$0181 - ldy #>$0181 - sta p8b_main.p8s_test_shiftr_uw.p8v_test - sty p8b_main.p8s_test_shiftr_uw.p8v_test+1 - - stz p8b_main.p8s_test_shiftr_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_uw - lda #3 - sta p8b_main.p8s_test_shiftr_uw.p8v_value - sta p8b_main.p8s_test_shiftr_uw.p8v_value+1 - - lda #<$0181 - ldy #>$0181 - sta p8b_main.p8s_test_shiftr_uw.p8v_test - sty p8b_main.p8s_test_shiftr_uw.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_shiftr_uw.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_uw - lda #<$8002 - ldy #>$8002 - sta p8b_main.p8s_test_shiftr_uw.p8v_value - sty p8b_main.p8s_test_shiftr_uw.p8v_value+1 - - lda #<$4001 - ldy #>$4001 - sta p8b_main.p8s_test_shiftr_uw.p8v_test - sty p8b_main.p8s_test_shiftr_uw.p8v_test+1 - - stz p8b_main.p8s_test_shiftr_uw.p8v_newcarry - jmp p8b_main.p8s_test_shiftr_uw -; variables - .section BSS - .send BSS - - .pend - -p8s_signed .proc -; statements - ldy #>prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #1 - sta p8b_main.p8s_test_shiftl_w.p8v_value - sty p8b_main.p8s_test_shiftl_w.p8v_value+1 - - lda #<2 - ldy #>2 - sta p8b_main.p8s_test_shiftl_w.p8v_test - sty p8b_main.p8s_test_shiftl_w.p8v_test+1 - - stz p8b_main.p8s_test_shiftl_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_w - lda #<$81 - ldy #>$81 - sta p8b_main.p8s_test_shiftl_w.p8v_value - sty p8b_main.p8s_test_shiftl_w.p8v_value+1 - - lda #<$0102 - ldy #>$0102 - sta p8b_main.p8s_test_shiftl_w.p8v_test - sty p8b_main.p8s_test_shiftl_w.p8v_test+1 - - stz p8b_main.p8s_test_shiftl_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_w - lda #<$4080 - ldy #>$4080 - sta p8b_main.p8s_test_shiftl_w.p8v_value - sty p8b_main.p8s_test_shiftl_w.p8v_value+1 - - lda #<-$7f00 - ldy #>-$7f00 - sta p8b_main.p8s_test_shiftl_w.p8v_test - sty p8b_main.p8s_test_shiftl_w.p8v_test+1 - - stz p8b_main.p8s_test_shiftl_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_w - lda #<-$3f80 - ldy #>-$3f80 - sta p8b_main.p8s_test_shiftl_w.p8v_value - sty p8b_main.p8s_test_shiftl_w.p8v_value+1 - - lda #<-$7f00 - ldy #>-$7f00 - sta p8b_main.p8s_test_shiftl_w.p8v_test - sty p8b_main.p8s_test_shiftl_w.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_shiftl_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_w - lda #<-$8000 - ldy #>-$8000 - sta p8b_main.p8s_test_shiftl_w.p8v_value - sty p8b_main.p8s_test_shiftl_w.p8v_value+1 - - stz p8b_main.p8s_test_shiftl_w.p8v_test - stz p8b_main.p8s_test_shiftl_w.p8v_test+1 - lda #1 - sta p8b_main.p8s_test_shiftl_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftl_w - ldy #>prog8_interned_strings.string_16 - lda #1 - sta p8b_main.p8s_test_shiftr_w.p8v_value - sty p8b_main.p8s_test_shiftr_w.p8v_value+1 - - stz p8b_main.p8s_test_shiftr_w.p8v_test - stz p8b_main.p8s_test_shiftr_w.p8v_test+1 - lda #1 - sta p8b_main.p8s_test_shiftr_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_w - lda #<$0302 - ldy #>$0302 - sta p8b_main.p8s_test_shiftr_w.p8v_value - sty p8b_main.p8s_test_shiftr_w.p8v_value+1 - - lda #<$0181 - ldy #>$0181 - sta p8b_main.p8s_test_shiftr_w.p8v_test - sty p8b_main.p8s_test_shiftr_w.p8v_test+1 - - stz p8b_main.p8s_test_shiftr_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_w - lda #3 - sta p8b_main.p8s_test_shiftr_w.p8v_value - sta p8b_main.p8s_test_shiftr_w.p8v_value+1 - - lda #<$0181 - ldy #>$0181 - sta p8b_main.p8s_test_shiftr_w.p8v_test - sty p8b_main.p8s_test_shiftr_w.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_shiftr_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_w - lda #<-$7ffe - ldy #>-$7ffe - sta p8b_main.p8s_test_shiftr_w.p8v_value - sty p8b_main.p8s_test_shiftr_w.p8v_value+1 - - lda #<-$3fff - ldy #>-$3fff - sta p8b_main.p8s_test_shiftr_w.p8v_test - sty p8b_main.p8s_test_shiftr_w.p8v_test+1 - - stz p8b_main.p8s_test_shiftr_w.p8v_newcarry - jsr p8b_main.p8s_test_shiftr_w - lda #<-$7fff - ldy #>-$7fff - sta p8b_main.p8s_test_shiftr_w.p8v_value - sty p8b_main.p8s_test_shiftr_w.p8v_value+1 - - lda #<-$4000 - ldy #>-$4000 - sta p8b_main.p8s_test_shiftr_w.p8v_test - sty p8b_main.p8s_test_shiftr_w.p8v_test+1 - - lda #1 - sta p8b_main.p8s_test_shiftr_w.p8v_newcarry - jmp p8b_main.p8s_test_shiftr_w -; variables - .section BSS - .send BSS - - .pend - -p8s_test_rol2_ub .proc -; simple int arg(s) passed via register(s) - sta p8v_value - sty p8v_test -; statements - sta p8v_original - - sec - lda p8v_value - cmp #$80 - rol a - sta p8v_value - cmp p8v_test - beq label_asm_1_afterif - ldy #>prog8_interned_strings.string_17 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_19 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_20 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_21 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_22 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_23 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_24 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_25 - lda #prog8_interned_strings.string_18 - lda #$8000 - lda #<$8000 - sta (+) + 1 - sty (+) + 2 - plx - plp -+ rol $ffff,x ; modified - bcc label_asm_27_branch_else - lda #1 - sta p8v_carrycheck -label_asm_27_branch_else - lda $8001 - cmp p8v_test - beq label_asm_30_else - lda #1 - bra label_asm_29_afterif -label_asm_30_else - lda #0 -label_asm_29_afterif - bne label_asm_28_shortcut - lda p8v_carrycheck - cmp p8v_newcarry - beq label_asm_32_else - lda #1 - bra label_asm_31_afterif -label_asm_32_else - lda #0 -label_asm_31_afterif -label_asm_28_shortcut - beq label_asm_33_afterif - ldy #>prog8_interned_strings.string_26 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_27 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_28 - lda #prog8_interned_strings.string_18 - lda #$8000 - lda #<$8000 - sta (+) + 1 - sty (+) + 2 - plx - plp -+ ror $ffff,x ; modified - bcc label_asm_54_branch_else - lda #1 - sta p8v_carrycheck -label_asm_54_branch_else - lda $8001 - cmp p8v_test - beq label_asm_57_else - lda #1 - bra label_asm_56_afterif -label_asm_57_else - lda #0 -label_asm_56_afterif - bne label_asm_55_shortcut - lda p8v_carrycheck - cmp p8v_newcarry - beq label_asm_59_else - lda #1 - bra label_asm_58_afterif -label_asm_59_else - lda #0 -label_asm_58_afterif -label_asm_55_shortcut - beq label_asm_60_afterif - ldy #>prog8_interned_strings.string_29 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_30 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_31 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_32 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_33 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_34 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_35 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_36 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_37 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_38 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_39 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_40 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_41 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_42 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_43 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_44 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_45 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_46 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_47 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_48 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_49 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_50 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_51 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_52 - lda #prog8_interned_strings.string_18 - lda #prog8_interned_strings.string_53 - lda #prog8_interned_strings.string_18 - lda #> ub\n" - .byte $3e, $3e, $20, $55, $42, $0d, $00 -string_11 ; PETSCII:"<< uw\n" - .byte $3c, $3c, $20, $55, $57, $0d, $00 -string_12 ; PETSCII:">> uw\n" - .byte $3e, $3e, $20, $55, $57, $0d, $00 -string_13 ; PETSCII:"<< b\n" - .byte $3c, $3c, $20, $42, $0d, $00 -string_14 ; PETSCII:">> b\n" - .byte $3e, $3e, $20, $42, $0d, $00 -string_15 ; PETSCII:"<< w\n" - .byte $3c, $3c, $20, $57, $0d, $00 -string_16 ; PETSCII:">> w\n" - .byte $3e, $3e, $20, $57, $0d, $00 -string_17 ; PETSCII:"rol2_ub error " - .byte $52, $4f, $4c, $32, $e4, $55, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_18 ; PETSCII:" exp: " - .byte $20, $45, $58, $50, $3a, $20, $00 -string_19 ; PETSCII:"rol2_ub array error " - .byte $52, $4f, $4c, $32, $e4, $55, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52 - .byte $52, $4f, $52, $20, $00 -string_2 ; PETSCII:"ror_ub\n" - .byte $52, $4f, $52, $e4, $55, $42, $0d, $00 -string_20 ; PETSCII:"rol2_ub mem error " - .byte $52, $4f, $4c, $32, $e4, $55, $42, $20, $4d, $45, $4d, $20, $45, $52, $52, $4f - .byte $52, $20, $00 -string_21 ; PETSCII:"ror2_ub error " - .byte $52, $4f, $52, $32, $e4, $55, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_22 ; PETSCII:"ror2_ub array error " - .byte $52, $4f, $52, $32, $e4, $55, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52 - .byte $52, $4f, $52, $20, $00 -string_23 ; PETSCII:"ror2_ub mem error " - .byte $52, $4f, $52, $32, $e4, $55, $42, $20, $4d, $45, $4d, $20, $45, $52, $52, $4f - .byte $52, $20, $00 -string_24 ; PETSCII:"rol_ub error " - .byte $52, $4f, $4c, $e4, $55, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_25 ; PETSCII:"rol_ub array error " - .byte $52, $4f, $4c, $e4, $55, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52 - .byte $4f, $52, $20, $00 -string_26 ; PETSCII:"rol_ub mem error " - .byte $52, $4f, $4c, $e4, $55, $42, $20, $4d, $45, $4d, $20, $45, $52, $52, $4f, $52 - .byte $20, $00 -string_27 ; PETSCII:"ror_ub error " - .byte $52, $4f, $52, $e4, $55, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_28 ; PETSCII:"ror_ub array error " - .byte $52, $4f, $52, $e4, $55, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52 - .byte $4f, $52, $20, $00 -string_29 ; PETSCII:"ror_ub mem error " - .byte $52, $4f, $52, $e4, $55, $42, $20, $4d, $45, $4d, $20, $45, $52, $52, $4f, $52 - .byte $20, $00 -string_3 ; PETSCII:"rol2_ub\n" - .byte $52, $4f, $4c, $32, $e4, $55, $42, $0d, $00 -string_30 ; PETSCII:"rol2_uw error " - .byte $52, $4f, $4c, $32, $e4, $55, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_31 ; PETSCII:"rol2_uw array error " - .byte $52, $4f, $4c, $32, $e4, $55, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52 - .byte $52, $4f, $52, $20, $00 -string_32 ; PETSCII:"ror2_uw error " - .byte $52, $4f, $52, $32, $e4, $55, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_33 ; PETSCII:"ror2_uw array error " - .byte $52, $4f, $52, $32, $e4, $55, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52 - .byte $52, $4f, $52, $20, $00 -string_34 ; PETSCII:"rol_uw error " - .byte $52, $4f, $4c, $e4, $55, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_35 ; PETSCII:"rol_uw array error " - .byte $52, $4f, $4c, $e4, $55, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52 - .byte $4f, $52, $20, $00 -string_36 ; PETSCII:"ror_uw error " - .byte $52, $4f, $52, $e4, $55, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_37 ; PETSCII:"ror_uw array error " - .byte $52, $4f, $52, $e4, $55, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52 - .byte $4f, $52, $20, $00 -string_38 ; PETSCII:"<< ub error " - .byte $3c, $3c, $20, $55, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_39 ; PETSCII:"<< ub array error " - .byte $3c, $3c, $20, $55, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f - .byte $52, $20, $00 -string_4 ; PETSCII:"ror2_ub\n" - .byte $52, $4f, $52, $32, $e4, $55, $42, $0d, $00 -string_40 ; PETSCII:">> ub error " - .byte $3e, $3e, $20, $55, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_41 ; PETSCII:">> ub array error " - .byte $3e, $3e, $20, $55, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f - .byte $52, $20, $00 -string_42 ; PETSCII:"<< uw error " - .byte $3c, $3c, $20, $55, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_43 ; PETSCII:"<< uw array error " - .byte $3c, $3c, $20, $55, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f - .byte $52, $20, $00 -string_44 ; PETSCII:">> uw error " - .byte $3e, $3e, $20, $55, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_45 ; PETSCII:">> uw array error " - .byte $3e, $3e, $20, $55, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f - .byte $52, $20, $00 -string_46 ; PETSCII:"<< b error " - .byte $3c, $3c, $20, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_47 ; PETSCII:"<< b array error " - .byte $3c, $3c, $20, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f, $52 - .byte $20, $00 -string_48 ; PETSCII:">> b error " - .byte $3e, $3e, $20, $42, $20, $45, $52, $52, $4f, $52, $20, $00 -string_49 ; PETSCII:">> b array error " - .byte $3e, $3e, $20, $42, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f, $52 - .byte $20, $00 -string_5 ; PETSCII:"rol_uw\n" - .byte $52, $4f, $4c, $e4, $55, $57, $0d, $00 -string_50 ; PETSCII:"<< w error " - .byte $3c, $3c, $20, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_51 ; PETSCII:"<< w array error " - .byte $3c, $3c, $20, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f, $52 - .byte $20, $00 -string_52 ; PETSCII:">> w error " - .byte $3e, $3e, $20, $57, $20, $45, $52, $52, $4f, $52, $20, $00 -string_53 ; PETSCII:">> w array error " - .byte $3e, $3e, $20, $57, $20, $41, $52, $52, $41, $59, $20, $45, $52, $52, $4f, $52 - .byte $20, $00 -string_6 ; PETSCII:"ror_uw\n" - .byte $52, $4f, $52, $e4, $55, $57, $0d, $00 -string_7 ; PETSCII:"rol2_uw\n" - .byte $52, $4f, $4c, $32, $e4, $55, $57, $0d, $00 -string_8 ; PETSCII:"ror2_uw\n" - .byte $52, $4f, $52, $32, $e4, $55, $57, $0d, $00 -string_9 ; PETSCII:"<< ub\n" - .byte $3c, $3c, $20, $55, $42, $0d, $00 - - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/builtins.asm b/compiler/test/arithmetic/builtins.asm deleted file mode 100644 index 2d202eb8e..000000000 --- a/compiler/test/arithmetic/builtins.asm +++ /dev/null @@ -1,7753 +0,0 @@ -; w65c02 assembly code for 'builtins' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - jsr p8b_main.p8s_rotations - jsr p8b_main.p8s_integers - jmp p8b_main.p8s_floatingpoint -; variables - .section BSS - .send BSS - - .pend - -p8s_rotations .proc -p8v_addr = 34 ; zp UWORD - p8v_membyte = $c000 -; statements - lda #10 - sta label_asm_3_counter -label_asm_2_repeat - lda #13 - jsr txt.chrout - dec label_asm_3_counter - bne label_asm_2_repeat - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_uwarr,x - rol p8v_uwarr+1,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_uwarr,x - rol p8v_uwarr+1,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_uwarr,x - rol p8v_uwarr+1,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_uwarr,x - rol p8v_uwarr+1,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - ldy #0 - lda #<$cfaa - sta p8v_uwarr,y - lda #>$cfaa - sta p8v_uwarr+1,y - ldx #0 - ror p8v_uwarr+1,x - ror p8v_uwarr,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_uwarr+1,x - ror p8v_uwarr,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_uwarr+1,x - ror p8v_uwarr,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_uwarr+1,x - ror p8v_uwarr,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_uwarr+1,x - ror p8v_uwarr,x - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - clc - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - asl p8v_uwarr,x - rol p8v_uwarr+1,x - bcc + - inc p8v_uwarr,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - asl p8v_uwarr,x - rol p8v_uwarr+1,x - bcc + - inc p8v_uwarr,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - asl p8v_uwarr,x - rol p8v_uwarr+1,x - bcc + - inc p8v_uwarr,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - asl p8v_uwarr,x - rol p8v_uwarr+1,x - bcc + - inc p8v_uwarr,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - lsr p8v_uwarr+1,x - ror p8v_uwarr,x - bcc + - lda p8v_uwarr+1,x - ora #$80 - sta p8v_uwarr+1,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - lsr p8v_uwarr+1,x - ror p8v_uwarr,x - bcc + - lda p8v_uwarr+1,x - ora #$80 - sta p8v_uwarr+1,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - lsr p8v_uwarr+1,x - ror p8v_uwarr,x - bcc + - lda p8v_uwarr+1,x - ora #$80 - sta p8v_uwarr+1,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - ldx #0 - lsr p8v_uwarr+1,x - ror p8v_uwarr,x - bcc + - lda p8v_uwarr+1,x - ora #$80 - sta p8v_uwarr+1,x -+ - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sec - jsr txt.print_uwbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - rol p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldx #0 - ror p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - cmp #$80 - rol a - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - cmp #$80 - rol a - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - cmp #$80 - rol a - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - cmp #$80 - rol a - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - lsr a - bcc + - ora #$80 -+ - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - lsr a - bcc + - ora #$80 -+ - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - lsr a - bcc + - ora #$80 -+ - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldx #0 - lda p8v_ubarr,x - lsr a - bcc + - ora #$80 -+ - sta p8v_ubarr,x - lda p8v_ubarr+0 - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda #<$c000 - ldy #>$c000 - sta p8v_addr - sty p8v_addr+1 - - lda #$b5 - sta (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ rol $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ rol $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ rol $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ rol $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda #$b5 - sta (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ ror $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ ror $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ ror $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - sec - ldy p8v_addr+1 - lda p8v_addr - sta (+) + 1 - sty (+) + 2 -+ ror $ffff ; modified - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda #$b5 - sta (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.rol2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.rol2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.rol2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.rol2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jsr txt.chrout - lda #$b5 - sta (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.ror2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.ror2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.ror2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - ldy p8v_addr+1 - lda p8v_addr - jsr prog8_lib.ror2_mem_ub - lda (p8v_addr) - sec - jsr txt.print_ubbin - lda #13 - jsr txt.chrout - lda #13 - jmp txt.chrout -; variables - .section BSS -label_asm_3_counter = 49 - .send BSS - -; non-zeropage variables -p8v_ubarr .byte $c7 -p8v_uwarr .word $cfaa - .pend - -p8s_integers .proc -p8v_zero = 36 ; zp UBYTE -p8v_ww = 37 ; zp WORD -p8v_uw = 39 ; zp UWORD -p8v_ub2 = 41 ; zp UBYTE -p8v_ub = 42 ; zp UBYTE -p8v_bb = 43 ; zp BYTE -; statements - stz p8v_zero - stz p8v_ub - stz p8v_ub2 - stz p8v_bb - stz p8v_uw - stz p8v_uw+1 - stz p8v_ww - stz p8v_ww+1 - lda #20 - sta label_asm_6_counter -label_asm_5_repeat - lda #13 - jsr txt.chrout - dec label_asm_6_counter - bne label_asm_5_repeat - ; inlined routine follows: read_flags - php - pla - ; inlined routine end: read_flags - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - ; inlined routine follows: read_flags - php - pla - ; inlined routine end: read_flags - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - jsr math.rnd - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - jsr math.rnd - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - jsr math.rndw - sta p8v_uw - sty p8v_uw+1 - jsr txt.print_uw - lda #13 - jsr txt.chrout - jsr math.rndw - clc - adc p8v_zero - bcc + - iny -+ - clc - adc p8v_zero - bcc + - iny -+ - sta p8v_uw - sty p8v_uw+1 - jsr txt.print_uw - lda #13 - jsr txt.chrout - lda #<$c350 - ldy #>$c350 - sta p8v_uw - sty p8v_uw+1 - - jsr prog8_lib.func_sqrt16_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - ldy p8v_uw+1 - lda p8v_uw - jsr prog8_lib.func_sqrt16_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #-$64 - sta p8v_bb - jsr prog8_lib.func_sign_b_into_A - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #-$64 - sta p8v_bb - jsr prog8_lib.func_sign_b_into_A - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #$64 - sta p8v_ub - jsr prog8_lib.func_sign_ub_into_A - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #$64 - sta p8v_ub - jsr prog8_lib.func_sign_ub_into_A - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #<-$03e8 - ldy #>-$03e8 - sta p8v_ww - sty p8v_ww+1 - - jsr prog8_lib.func_sign_w_into_A - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - ldy p8v_ww+1 - lda p8v_ww - jsr prog8_lib.func_sign_w_into_A - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #<$03e8 - ldy #>$03e8 - sta p8v_uw - sty p8v_uw+1 - - jsr prog8_lib.func_sign_uw_into_A - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - ldy p8v_uw+1 - lda p8v_uw - jsr prog8_lib.func_sign_uw_into_A - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #-$64 - sta p8v_bb - jsr prog8_lib.abs_b_into_A - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #-$64 - sta p8v_bb - jsr prog8_lib.abs_b_into_A - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - pha - lda p8v_zero - sta P8ZP_SCRATCH_B1 - pla - clc - adc P8ZP_SCRATCH_B1 - sta p8v_bb - jsr txt.print_b - lda #13 - jsr txt.chrout - lda #<-$03e8 - ldy #>-$03e8 - sta p8v_ww - sty p8v_ww+1 - - jsr prog8_lib.abs_w_into_AY - sta p8v_ww - sty p8v_ww+1 - jsr txt.print_w - lda #13 - jsr txt.chrout - lda #<-$03e8 - ldy #>-$03e8 - sta p8v_ww - sty p8v_ww+1 - - lda p8v_zero - sta P8ZP_SCRATCH_W1 - stz P8ZP_SCRATCH_W1+1 - lda p8v_zero - sta P8ZP_SCRATCH_W1 - stz P8ZP_SCRATCH_W1+1 - ldy p8v_ww+1 - lda p8v_ww - jsr prog8_lib.abs_w_into_AY - clc - adc P8ZP_SCRATCH_W1 - tax - tya - adc P8ZP_SCRATCH_W1+1 - tay - txa - clc - adc P8ZP_SCRATCH_W1 - tax - tya - adc P8ZP_SCRATCH_W1+1 - tay - txa - sta p8v_ww - sty p8v_ww+1 - jsr txt.print_w - lda #13 - jsr txt.chrout - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_any_b_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_any_b_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_any_b_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_any_b_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #10 - jsr prog8_lib.func_any_w_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #10 - jsr prog8_lib.func_any_w_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #12 - jsr prog8_lib.func_any_w_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #12 - jsr prog8_lib.func_any_w_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_all_b_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_all_b_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_all_b_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_all_b_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #10 - jsr prog8_lib.func_all_w_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #10 - jsr prog8_lib.func_all_w_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #12 - jsr prog8_lib.func_all_w_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #12 - jsr prog8_lib.func_all_w_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_sort_ub - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_sort_b - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #10 - jsr prog8_lib.func_sort_uw - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #12 - jsr prog8_lib.func_sort_w - lda #p8v_ubarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_reverse_b - lda #p8v_barr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #13 - jsr prog8_lib.func_reverse_b - lda #p8v_uwarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #10 - jsr prog8_lib.func_reverse_w - lda #p8v_warr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #12 - jmp prog8_lib.func_reverse_w -; variables - .section BSS -label_asm_6_counter = 50 - .send BSS - -; non-zeropage variables -p8v_barr .char $01, $02, $03, $04, $05, -$04, $00, -$03, $02, $01, -$80, -$80, -$7f -p8v_ubarr .byte $01, $02, $03, $04, $05, $00, $04, $03, $02, $01, $ff, $ff, $ff -p8v_uwarr .word $0064, $00c8, $012c, $0190, $0000, $01f4, $0190, $012c, $00c8, $0064 -p8v_warr .sint $0064, $00c8, $012c, $0190, $01f4, $0000, -$0190, -$012c, $00c8, $0064, -$0063, -$1000 - .pend - -p8s_floatingpoint .proc -p8v_zero = 44 ; zp UBYTE -p8v_uw = 45 ; zp UWORD -p8v_ub = 47 ; zp UBYTE -p8v_bb = 48 ; zp BYTE -; statements - stz p8v_zero - stz p8v_ub - stz p8v_bb - stz p8v_uw - stz p8v_uw+1 - stz p8v_fl - stz p8v_fl+1 - stz p8v_fl+2 - stz p8v_fl+3 - stz p8v_fl+4 - - stz p8v_fzero - stz p8v_fzero+1 - stz p8v_fzero+2 - stz p8v_fzero+3 - stz p8v_fzero+4 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_fl - jsr floats.copy_float - ldy #>p8v_fl - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_fl - jsr floats.copy_float - ldy #>p8v_fl - lda #p8v_flarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #7 - jsr floats.func_any_f_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_flarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #7 - jsr floats.func_any_f_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_flarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #7 - jsr floats.func_all_f_into_A - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_flarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #7 - jsr floats.func_all_f_into_A - clc - adc p8v_zero - clc - adc p8v_zero - sta p8v_ub - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #p8v_flarr - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #7 - jsr floats.func_reverse_f - lda #0 - sta p8v_ub -label_asm_7_for_loop - lda p8v_ub - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - ldy #>p8v_flarr - clc - adc #VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FREADSA .proc - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - -GIVUAYFAY .proc - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - -GIVAYFAY .proc - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - -GETADRAY .proc - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - -FREADUY .proc - lda #0 - jmp GIVAYF - .pend - -parse .proc - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - -normalize .proc - jmp floats.NORMAL - .pend -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'string' ---- -string .proc - - - -length .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - -left .proc - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - sta P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_W1+1 - lda cx16.r1 - sta P8ZP_SCRATCH_W2 - lda cx16.r1+1 - sta P8ZP_SCRATCH_W2+1 - lda #0 - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop - rts -_loop dey - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop -+ rts - .pend - -right .proc - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - stx P8ZP_SCRATCH_B1 - sta cx16.r0 - sty cx16.r0+1 - jsr string.length - tya - sec - sbc P8ZP_SCRATCH_B1 - clc - adc cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - adc #0 - sta P8ZP_SCRATCH_W1+1 - ldy cx16.r1 - sty P8ZP_SCRATCH_W2 - ldy cx16.r1+1 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop - rts -_loop dey - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop -+ rts - .pend - -slice .proc - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - ; substr(source, target, start, length) - sta P8ZP_SCRATCH_B1 - lda cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - sta P8ZP_SCRATCH_W1+1 - lda cx16.r1 - sta P8ZP_SCRATCH_W2 - lda cx16.r1+1 - sta P8ZP_SCRATCH_W2+1 - - ; adjust src location - clc - lda P8ZP_SCRATCH_W1 - adc P8ZP_SCRATCH_B1 - sta P8ZP_SCRATCH_W1 - bcc + - inc P8ZP_SCRATCH_W1+1 -+ lda #0 - sta (P8ZP_SCRATCH_W2),y - beq _startloop -- lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y -_startloop dey - cpy #$ff - bne - - rts - .pend - -find .proc - ; need to copy the the cx16 virtual registers to zeropage to make this run on C64... - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - stx P8ZP_SCRATCH_B1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _notfound - cmp P8ZP_SCRATCH_B1 - beq _found - iny - bne - -_notfound lda #0 - clc - rts -_found tya - sec - rts - .pend - -contains .proc - jmp find - .pend - -copy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -append .proc - lda cx16.r0 - ldy cx16.r0+1 - jsr length - sty P8ZP_SCRATCH_B1 - tya - clc - adc cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - adc #0 - sta P8ZP_SCRATCH_W1+1 - lda cx16.r1 - ldy cx16.r1+1 - jsr prog8_lib.strcpy - tya - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -compare .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcmp_mem - .pend - -lower .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _done - and #$7f - cmp #97 - bcc + - cmp #123 - bcs + - and #%11011111 -+ sta (P8ZP_SCRATCH_W1),y - iny - bne - -_done rts - .pend - -upper .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _done - cmp #65 - bcc + - cmp #91 - bcs + - ora #%00100000 -+ sta (P8ZP_SCRATCH_W1),y - iny - bne - -_done rts - .pend - -lowerchar .proc - and #$7f - cmp #97 - bcc + - cmp #123 - bcs + - and #%11011111 -+ rts - .pend - -upperchar .proc - cmp #65 - bcc + - cmp #91 - bcs + - ora #%00100000 -+ rts - .pend - -pattern_match .proc -; pattern matching of a string. -; Input: cx16.r0: A NUL-terminated, <255-length pattern -; AY: A NUL-terminated, <255-length string -; -; Output: A = 1 if the string matches the pattern, A = 0 if not. -; -; Notes: Clobbers A, X, Y. Each * in the pattern uses 4 bytes of stack. -; -; see http://6502.org/source/strings/patmatch.htm - -strptr = P8ZP_SCRATCH_W1 - - sta strptr - sty strptr+1 - lda cx16.r0 - sta modify_pattern1+1 - sta modify_pattern2+1 - lda cx16.r0+1 - sta modify_pattern1+2 - sta modify_pattern2+2 - jsr _match - lda #0 - rol a - rts - - -_match - ldx #$00 ; x is an index in the pattern - ldy #$ff ; y is an index in the string -modify_pattern1 -next lda $ffff,x ; look at next pattern character MODIFIED - cmp #'*' ; is it a star? - beq star ; yes, do the complicated stuff - iny ; no, let's look at the string - cmp #'?' ; is the pattern caracter a ques? - bne reg ; no, it's a regular character - lda (strptr),y ; yes, so it will match anything - beq fail ; except the end of string -reg cmp (strptr),y ; are both characters the same? - bne fail ; no, so no match - inx ; yes, keep checking - cmp #0 ; are we at end of string? - bne next ; not yet, loop -found rts ; success, return with c=1 - -star inx ; skip star in pattern -modify_pattern2 - cmp $ffff,x ; string of stars equals one star MODIFIED - beq star ; so skip them also -stloop txa ; we first try to match with * = "" - pha ; and grow it by 1 character every - tya ; time we loop - pha ; save x and y on stack - jsr next ; recursive call - pla ; restore x and y - tay - pla - tax - bcs found ; we found a match, return with c=1 - iny ; no match yet, try to grow * string - lda (strptr),y ; are we at the end of string? - bne stloop ; not yet, add a character -fail clc ; yes, no match found, return with c=0 - rts - .pend - -hash .proc - lda #179 - sta P8ZP_SCRATCH_REG - ldy #0 - clc -- lda (cx16.r0),y - beq + - rol P8ZP_SCRATCH_REG - eor P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_REG - iny - bne - -+ lda P8ZP_SCRATCH_REG - rts - .pend - -isdigit .proc - cmp #'0' - bcs + - rts -+ cmp #'9'+1 - bcc + - clc - rts -+ sec - rts - .pend - -isupper .proc - cmp #97 - bcs + - rts -+ cmp #122+1 - bcc _yes - cmp #193 - bcs + - rts -+ cmp #218+1 - bcc _yes - clc - rts -_yes sec - rts - .pend - -islower .proc - cmp #'a' - bcs + - rts -+ cmp #'z'+1 - bcc + - clc - rts -+ sec - rts - .pend - -isletter .proc - jsr islower - bcs + - jmp isupper -+ rts - .pend - -isspace .proc - cmp #32 - beq + - cmp #13 - beq + - cmp #9 - beq + - cmp #10 - beq + - cmp #141 - beq + - cmp #160 - beq + - clc - rts -+ sec - rts - .pend - -isprint .proc - cmp #160 - bcc + - rts -+ cmp #32 - bcs + - rts -+ cmp #128 - bcc + - clc - rts -+ sec - rts - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $84, $9e, $66, $66, $66 ; float -9.9 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/div.asm b/compiler/test/arithmetic/div.asm deleted file mode 100644 index 3dc8a4996..000000000 --- a/compiler/test/arithmetic/div.asm +++ /dev/null @@ -1,6527 +0,0 @@ -; w65c02 assembly code for 'div' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8b_main.p8s_div_ubyte.p8v_a1 - lda #1 - sta p8b_main.p8s_div_ubyte.p8v_a2 - stz p8b_main.p8s_div_ubyte.p8v_c - jsr p8b_main.p8s_div_ubyte - lda #$64 - sta p8b_main.p8s_div_ubyte.p8v_a1 - lda #6 - sta p8b_main.p8s_div_ubyte.p8v_a2 - lda #$10 - sta p8b_main.p8s_div_ubyte.p8v_c - jsr p8b_main.p8s_div_ubyte - lda #$ff - sta p8b_main.p8s_div_ubyte.p8v_a1 - lda #2 - sta p8b_main.p8s_div_ubyte.p8v_a2 - lda #$7f - sta p8b_main.p8s_div_ubyte.p8v_c - jsr p8b_main.p8s_div_ubyte - stz p8b_main.p8s_div_byte.p8v_a1 - lda #1 - sta p8b_main.p8s_div_byte.p8v_a2 - stz p8b_main.p8s_div_byte.p8v_c - jsr p8b_main.p8s_div_byte - lda #$64 - sta p8b_main.p8s_div_byte.p8v_a1 - lda #-6 - sta p8b_main.p8s_div_byte.p8v_a2 - lda #-$10 - sta p8b_main.p8s_div_byte.p8v_c - jsr p8b_main.p8s_div_byte - lda #$7f - sta p8b_main.p8s_div_byte.p8v_a1 - lda #-2 - sta p8b_main.p8s_div_byte.p8v_a2 - lda #-$3f - sta p8b_main.p8s_div_byte.p8v_c - jsr p8b_main.p8s_div_byte - stz p8b_main.p8s_div_uword.p8v_a1 - stz p8b_main.p8s_div_uword.p8v_a1+1 - lda #<1 - ldy #>1 - sta p8b_main.p8s_div_uword.p8v_a2 - sty p8b_main.p8s_div_uword.p8v_a2+1 - - stz p8b_main.p8s_div_uword.p8v_c - stz p8b_main.p8s_div_uword.p8v_c+1 - jsr p8b_main.p8s_div_uword - lda #<$9c40 - ldy #>$9c40 - sta p8b_main.p8s_div_uword.p8v_a1 - sty p8b_main.p8s_div_uword.p8v_a1+1 - - lda #<$01f4 - ldy #>$01f4 - sta p8b_main.p8s_div_uword.p8v_a2 - sty p8b_main.p8s_div_uword.p8v_a2+1 - - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_div_uword.p8v_c - sty p8b_main.p8s_div_uword.p8v_c+1 - - jsr p8b_main.p8s_div_uword - lda #<$a8cb - ldy #>$a8cb - sta p8b_main.p8s_div_uword.p8v_a1 - sty p8b_main.p8s_div_uword.p8v_a1+1 - - lda #<2 - ldy #>2 - sta p8b_main.p8s_div_uword.p8v_a2 - sty p8b_main.p8s_div_uword.p8v_a2+1 - - lda #<$5465 - ldy #>$5465 - sta p8b_main.p8s_div_uword.p8v_c - sty p8b_main.p8s_div_uword.p8v_c+1 - - jsr p8b_main.p8s_div_uword - stz p8b_main.p8s_div_word.p8v_a1 - stz p8b_main.p8s_div_word.p8v_a1+1 - lda #<1 - ldy #>1 - sta p8b_main.p8s_div_word.p8v_a2 - sty p8b_main.p8s_div_word.p8v_a2+1 - - stz p8b_main.p8s_div_word.p8v_c - stz p8b_main.p8s_div_word.p8v_c+1 - jsr p8b_main.p8s_div_word - lda #<-$4e20 - ldy #>-$4e20 - sta p8b_main.p8s_div_word.p8v_a1 - sty p8b_main.p8s_div_word.p8v_a1+1 - - lda #<$01f4 - ldy #>$01f4 - sta p8b_main.p8s_div_word.p8v_a2 - sty p8b_main.p8s_div_word.p8v_a2+1 - - lda #<-$28 - ldy #>-$28 - sta p8b_main.p8s_div_word.p8v_c - sty p8b_main.p8s_div_word.p8v_c+1 - - jsr p8b_main.p8s_div_word - lda #<-$08ae - ldy #>-$08ae - sta p8b_main.p8s_div_word.p8v_a1 - sty p8b_main.p8s_div_word.p8v_a1+1 - - lda #<2 - ldy #>2 - sta p8b_main.p8s_div_word.p8v_a2 - sty p8b_main.p8s_div_word.p8v_a2+1 - - lda #<-$0457 - ldy #>-$0457 - sta p8b_main.p8s_div_word.p8v_c - sty p8b_main.p8s_div_word.p8v_c+1 - - jsr p8b_main.p8s_div_word - stz p8b_main.p8s_div_float.p8v_a1 - stz p8b_main.p8s_div_float.p8v_a1+1 - stz p8b_main.p8s_div_float.p8v_a1+2 - stz p8b_main.p8s_div_float.p8v_a1+3 - stz p8b_main.p8s_div_float.p8v_a1+4 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_div_float.p8v_a2 - jsr floats.copy_float - stz p8b_main.p8s_div_float.p8v_c - stz p8b_main.p8s_div_float.p8v_c+1 - stz p8b_main.p8s_div_float.p8v_c+2 - stz p8b_main.p8s_div_float.p8v_c+3 - stz p8b_main.p8s_div_float.p8v_c+4 - - jsr p8b_main.p8s_div_float - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_div_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_div_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_3 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_div_float.p8v_c - jsr floats.copy_float - jmp p8b_main.p8s_div_float -; variables - .section BSS - .send BSS - - .pend - -p8s_div_ubyte .proc -p8v_r = 50 ; zp UBYTE -p8v_c = 51 ; zp UBYTE -p8v_a2 = 52 ; zp UBYTE -p8v_a1 = 53 ; zp UBYTE -; statements - lda p8v_a1 - ldy p8v_a2 - jsr math.divmod_ub_asm - sty p8v_r - lda p8v_r - cmp p8v_c - bne label_asm_2_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #p8v_a2 - jsr floats.MOVFM - lda #p8v_a1 - jsr floats.CONUPK - jsr floats.FDIVT - ldx #p8v_r - jsr floats.MOVMF - - lda #p8v_c - jsr floats.MOVFM - lda #p8v_r - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_float_const_4 - jsr floats.var_fac1_less_f - beq label_asm_10_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_9 - lda #p8v_a1 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_4 - lda #p8v_a2 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_5 - lda #p8v_r - jsr floats.MOVFM - jsr floats.print - lda #13 - jmp cbm.CHROUT -; variables - .section BSS -prog8_float_eval_result2 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_a1 .fill 5 -p8v_a2 .fill 5 -p8v_c .fill 5 -p8v_r .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:" ok " - .byte $20, $4f, $4b, $20, $20, $00 -string_2 ; PETSCII:"err! " - .byte $45, $52, $52, $21, $20, $00 -string_3 ; PETSCII:"ubyte " - .byte $55, $42, $59, $54, $45, $20, $00 -string_4 ; PETSCII:" / " - .byte $20, $2f, $20, $00 -string_5 ; PETSCII:" = " - .byte $20, $3d, $20, $00 -string_6 ; PETSCII:"byte " - .byte $42, $59, $54, $45, $20, $00 -string_7 ; PETSCII:"uword " - .byte $55, $57, $4f, $52, $44, $20, $00 -string_8 ; PETSCII:"word " - .byte $57, $4f, $52, $44, $20, $00 -string_9 ; PETSCII:"float " - .byte $46, $4c, $4f, $41, $54, $20, $00 - - .pend - -; ---- block: 'floats' ---- -floats .proc - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FREADSA .proc - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - -GIVUAYFAY .proc - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - -GIVAYFAY .proc - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - -GETADRAY .proc - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - -FREADUY .proc - lda #0 - jmp GIVAYF - .pend - -parse .proc - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - -normalize .proc - jmp floats.NORMAL - .pend -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -prog8_float_const_1 .byte $8a, $79, $f9, $99, $99 ; float 999.9 -prog8_float_const_2 .byte $87, $5e, $00, $00, $00 ; float 111.0 -prog8_float_const_3 .byte $84, $10, $21, $35, $f7 ; float 9.008108108108107 -prog8_float_const_4 .byte $70, $27, $c5, $ac, $47 ; float 1.0E-5 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/minus.asm b/compiler/test/arithmetic/minus.asm deleted file mode 100644 index f2575f04c..000000000 --- a/compiler/test/arithmetic/minus.asm +++ /dev/null @@ -1,6644 +0,0 @@ -; w65c02 assembly code for 'minus' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8b_main.p8s_minus_ubyte.p8v_a1 - stz p8b_main.p8s_minus_ubyte.p8v_a2 - stz p8b_main.p8s_minus_ubyte.p8v_c - jsr p8b_main.p8s_minus_ubyte - lda #$c8 - sta p8b_main.p8s_minus_ubyte.p8v_a1 - stz p8b_main.p8s_minus_ubyte.p8v_a2 - lda #$c8 - sta p8b_main.p8s_minus_ubyte.p8v_c - jsr p8b_main.p8s_minus_ubyte - lda #$c8 - sta p8b_main.p8s_minus_ubyte.p8v_a1 - lda #$64 - sta p8b_main.p8s_minus_ubyte.p8v_a2 - sta p8b_main.p8s_minus_ubyte.p8v_c - jsr p8b_main.p8s_minus_ubyte - lda #$64 - sta p8b_main.p8s_minus_ubyte.p8v_a1 - lda #$c8 - sta p8b_main.p8s_minus_ubyte.p8v_a2 - lda #$9c - sta p8b_main.p8s_minus_ubyte.p8v_c - jsr p8b_main.p8s_minus_ubyte - stz p8b_main.p8s_minus_byte.p8v_a1 - stz p8b_main.p8s_minus_byte.p8v_a2 - stz p8b_main.p8s_minus_byte.p8v_c - jsr p8b_main.p8s_minus_byte - lda #$64 - sta p8b_main.p8s_minus_byte.p8v_a1 - sta p8b_main.p8s_minus_byte.p8v_a2 - stz p8b_main.p8s_minus_byte.p8v_c - jsr p8b_main.p8s_minus_byte - lda #$32 - sta p8b_main.p8s_minus_byte.p8v_a1 - lda #-$32 - sta p8b_main.p8s_minus_byte.p8v_a2 - lda #$64 - sta p8b_main.p8s_minus_byte.p8v_c - jsr p8b_main.p8s_minus_byte - stz p8b_main.p8s_minus_byte.p8v_a1 - lda #-$1e - sta p8b_main.p8s_minus_byte.p8v_a2 - lda #$1e - sta p8b_main.p8s_minus_byte.p8v_c - jsr p8b_main.p8s_minus_byte - lda #-$1e - sta p8b_main.p8s_minus_byte.p8v_a1 - stz p8b_main.p8s_minus_byte.p8v_a2 - lda #-$1e - sta p8b_main.p8s_minus_byte.p8v_c - jsr p8b_main.p8s_minus_byte - stz p8b_main.p8s_minus_uword.p8v_a1 - stz p8b_main.p8s_minus_uword.p8v_a1+1 - stz p8b_main.p8s_minus_uword.p8v_a2 - stz p8b_main.p8s_minus_uword.p8v_a2+1 - stz p8b_main.p8s_minus_uword.p8v_c - stz p8b_main.p8s_minus_uword.p8v_c+1 - jsr p8b_main.p8s_minus_uword - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_minus_uword.p8v_a1 - sty p8b_main.p8s_minus_uword.p8v_a1+1 - - stz p8b_main.p8s_minus_uword.p8v_a2 - stz p8b_main.p8s_minus_uword.p8v_a2+1 - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_minus_uword.p8v_c - sty p8b_main.p8s_minus_uword.p8v_c+1 - - jsr p8b_main.p8s_minus_uword - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_minus_uword.p8v_a1 - sty p8b_main.p8s_minus_uword.p8v_a1+1 - - lda #<$4e20 - ldy #>$4e20 - sta p8b_main.p8s_minus_uword.p8v_a2 - sty p8b_main.p8s_minus_uword.p8v_a2+1 - - lda #<$7530 - ldy #>$7530 - sta p8b_main.p8s_minus_uword.p8v_c - sty p8b_main.p8s_minus_uword.p8v_c+1 - - jsr p8b_main.p8s_minus_uword - lda #<$4e20 - ldy #>$4e20 - sta p8b_main.p8s_minus_uword.p8v_a1 - sty p8b_main.p8s_minus_uword.p8v_a1+1 - - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_minus_uword.p8v_a2 - sty p8b_main.p8s_minus_uword.p8v_a2+1 - - lda #<$8ad0 - ldy #>$8ad0 - sta p8b_main.p8s_minus_uword.p8v_c - sty p8b_main.p8s_minus_uword.p8v_c+1 - - jsr p8b_main.p8s_minus_uword - stz p8b_main.p8s_minus_word.p8v_a1 - stz p8b_main.p8s_minus_word.p8v_a1+1 - stz p8b_main.p8s_minus_word.p8v_a2 - stz p8b_main.p8s_minus_word.p8v_a2+1 - stz p8b_main.p8s_minus_word.p8v_c - stz p8b_main.p8s_minus_word.p8v_c+1 - jsr p8b_main.p8s_minus_word - lda #<$03e8 - ldy #>$03e8 - sta p8b_main.p8s_minus_word.p8v_a1 - sty p8b_main.p8s_minus_word.p8v_a1+1 - - sta p8b_main.p8s_minus_word.p8v_a2 - sty p8b_main.p8s_minus_word.p8v_a2+1 - - stz p8b_main.p8s_minus_word.p8v_c - stz p8b_main.p8s_minus_word.p8v_c+1 - jsr p8b_main.p8s_minus_word - lda #<-$03e8 - ldy #>-$03e8 - sta p8b_main.p8s_minus_word.p8v_a1 - sty p8b_main.p8s_minus_word.p8v_a1+1 - - lda #<$03e8 - ldy #>$03e8 - sta p8b_main.p8s_minus_word.p8v_a2 - sty p8b_main.p8s_minus_word.p8v_a2+1 - - lda #<-$07d0 - ldy #>-$07d0 - sta p8b_main.p8s_minus_word.p8v_c - sty p8b_main.p8s_minus_word.p8v_c+1 - - jsr p8b_main.p8s_minus_word - lda #<$03e8 - ldy #>$03e8 - sta p8b_main.p8s_minus_word.p8v_a1 - sty p8b_main.p8s_minus_word.p8v_a1+1 - - lda #<$01f4 - ldy #>$01f4 - sta p8b_main.p8s_minus_word.p8v_a2 - sty p8b_main.p8s_minus_word.p8v_a2+1 - - sta p8b_main.p8s_minus_word.p8v_c - sty p8b_main.p8s_minus_word.p8v_c+1 - - jsr p8b_main.p8s_minus_word - stz p8b_main.p8s_minus_word.p8v_a1 - stz p8b_main.p8s_minus_word.p8v_a1+1 - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_minus_word.p8v_a2 - sty p8b_main.p8s_minus_word.p8v_a2+1 - - lda #<$0d05 - ldy #>$0d05 - sta p8b_main.p8s_minus_word.p8v_c - sty p8b_main.p8s_minus_word.p8v_c+1 - - jsr p8b_main.p8s_minus_word - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_minus_word.p8v_a1 - sty p8b_main.p8s_minus_word.p8v_a1+1 - - stz p8b_main.p8s_minus_word.p8v_a2 - stz p8b_main.p8s_minus_word.p8v_a2+1 - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_minus_word.p8v_c - sty p8b_main.p8s_minus_word.p8v_c+1 - - jsr p8b_main.p8s_minus_word - stz p8b_main.p8s_minus_float.p8v_a1 - stz p8b_main.p8s_minus_float.p8v_a1+1 - stz p8b_main.p8s_minus_float.p8v_a1+2 - stz p8b_main.p8s_minus_float.p8v_a1+3 - stz p8b_main.p8s_minus_float.p8v_a1+4 - - stz p8b_main.p8s_minus_float.p8v_a2 - stz p8b_main.p8s_minus_float.p8v_a2+1 - stz p8b_main.p8s_minus_float.p8v_a2+2 - stz p8b_main.p8s_minus_float.p8v_a2+3 - stz p8b_main.p8s_minus_float.p8v_a2+4 - - stz p8b_main.p8s_minus_float.p8v_c - stz p8b_main.p8s_minus_float.p8v_c+1 - stz p8b_main.p8s_minus_float.p8v_c+2 - stz p8b_main.p8s_minus_float.p8v_c+3 - stz p8b_main.p8s_minus_float.p8v_c+4 - - jsr p8b_main.p8s_minus_float - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_minus_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_minus_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_minus_float.p8v_c - jsr floats.copy_float - jsr p8b_main.p8s_minus_float - lda #prog8_float_const_3 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_minus_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_minus_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_5 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_minus_float.p8v_c - jsr floats.copy_float - jsr p8b_main.p8s_minus_float - jmp test_stack.test -; variables - .section BSS - .send BSS - - .pend - -p8s_minus_ubyte .proc -p8v_r = 50 ; zp UBYTE -p8v_c = 51 ; zp UBYTE -p8v_a2 = 52 ; zp UBYTE -p8v_a1 = 53 ; zp UBYTE -; statements - lda p8v_a1 - sec - sbc p8v_a2 - sta p8v_r - cmp p8v_c - bne label_asm_2_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #p8v_a2 - jsr floats.MOVFM - lda #p8v_a1 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #p8v_r - jsr floats.MOVMF - - lda #p8v_c - jsr floats.MOVFM - lda #p8v_r - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_float_const_6 - jsr floats.var_fac1_less_f - beq label_asm_10_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_9 - lda #p8v_a1 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_4 - lda #p8v_a2 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_5 - lda #p8v_r - jsr floats.MOVFM - jsr floats.print - lda #13 - jmp cbm.CHROUT -; variables - .section BSS -prog8_float_eval_result2 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_a1 .fill 5 -p8v_a2 .fill 5 -p8v_c .fill 5 -p8v_r .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:" ok " - .byte $20, $4f, $4b, $20, $20, $00 -string_2 ; PETSCII:"err! " - .byte $45, $52, $52, $21, $20, $00 -string_3 ; PETSCII:"ubyte " - .byte $55, $42, $59, $54, $45, $20, $00 -string_4 ; PETSCII:" - " - .byte $20, $2d, $20, $00 -string_5 ; PETSCII:" = " - .byte $20, $3d, $20, $00 -string_6 ; PETSCII:"byte " - .byte $42, $59, $54, $45, $20, $00 -string_7 ; PETSCII:"uword " - .byte $55, $57, $4f, $52, $44, $20, $00 -string_8 ; PETSCII:"word " - .byte $57, $4f, $52, $44, $20, $00 -string_9 ; PETSCII:" float " - .byte $20, $20, $46, $4c, $4f, $41, $54, $20, $00 - - .pend - -; ---- block: 'floats' ---- -floats .proc - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FREADSA .proc - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - -GIVUAYFAY .proc - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - -GIVAYFAY .proc - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - -GETADRAY .proc - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - -FREADUY .proc - lda #0 - jmp GIVAYF - .pend - -parse .proc - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - -normalize .proc - jmp floats.NORMAL - .pend -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - - - -test .proc - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $82, $20, $00, $00, $00 ; float 2.5 -prog8_float_const_1 .byte $81, $40, $00, $00, $00 ; float 1.5 -prog8_float_const_2 .byte $81, $00, $00, $00, $00 ; float 1.0 -prog8_float_const_3 .byte $81, $c0, $00, $00, $00 ; float -1.5 -prog8_float_const_4 .byte $82, $60, $00, $00, $00 ; float 3.5 -prog8_float_const_5 .byte $83, $a0, $00, $00, $00 ; float -5.0 -prog8_float_const_6 .byte $70, $27, $c5, $ac, $47 ; float 1.0E-5 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/mult.asm b/compiler/test/arithmetic/mult.asm deleted file mode 100644 index 16642f665..000000000 --- a/compiler/test/arithmetic/mult.asm +++ /dev/null @@ -1,6541 +0,0 @@ -; w65c02 assembly code for 'mult' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8b_main.p8s_mul_ubyte.p8v_a1 - stz p8b_main.p8s_mul_ubyte.p8v_a2 - stz p8b_main.p8s_mul_ubyte.p8v_c - jsr p8b_main.p8s_mul_ubyte - lda #$14 - sta p8b_main.p8s_mul_ubyte.p8v_a1 - lda #1 - sta p8b_main.p8s_mul_ubyte.p8v_a2 - lda #$14 - sta p8b_main.p8s_mul_ubyte.p8v_c - jsr p8b_main.p8s_mul_ubyte - lda #$14 - sta p8b_main.p8s_mul_ubyte.p8v_a1 - lda #10 - sta p8b_main.p8s_mul_ubyte.p8v_a2 - lda #$c8 - sta p8b_main.p8s_mul_ubyte.p8v_c - jsr p8b_main.p8s_mul_ubyte - stz p8b_main.p8s_mul_byte.p8v_a1 - stz p8b_main.p8s_mul_byte.p8v_a2 - stz p8b_main.p8s_mul_byte.p8v_c - jsr p8b_main.p8s_mul_byte - lda #10 - sta p8b_main.p8s_mul_byte.p8v_a1 - sta p8b_main.p8s_mul_byte.p8v_a2 - lda #$64 - sta p8b_main.p8s_mul_byte.p8v_c - jsr p8b_main.p8s_mul_byte - lda #5 - sta p8b_main.p8s_mul_byte.p8v_a1 - lda #-5 - sta p8b_main.p8s_mul_byte.p8v_a2 - lda #-$19 - sta p8b_main.p8s_mul_byte.p8v_c - jsr p8b_main.p8s_mul_byte - stz p8b_main.p8s_mul_byte.p8v_a1 - lda #-$1e - sta p8b_main.p8s_mul_byte.p8v_a2 - stz p8b_main.p8s_mul_byte.p8v_c - jsr p8b_main.p8s_mul_byte - stz p8b_main.p8s_mul_uword.p8v_a1 - stz p8b_main.p8s_mul_uword.p8v_a1+1 - stz p8b_main.p8s_mul_uword.p8v_a2 - stz p8b_main.p8s_mul_uword.p8v_a2+1 - stz p8b_main.p8s_mul_uword.p8v_c - stz p8b_main.p8s_mul_uword.p8v_c+1 - jsr p8b_main.p8s_mul_uword - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_mul_uword.p8v_a1 - sty p8b_main.p8s_mul_uword.p8v_a1+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_mul_uword.p8v_a2 - sty p8b_main.p8s_mul_uword.p8v_a2+1 - - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_mul_uword.p8v_c - sty p8b_main.p8s_mul_uword.p8v_c+1 - - jsr p8b_main.p8s_mul_uword - lda #<$01f4 - ldy #>$01f4 - sta p8b_main.p8s_mul_uword.p8v_a1 - sty p8b_main.p8s_mul_uword.p8v_a1+1 - - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_mul_uword.p8v_a2 - sty p8b_main.p8s_mul_uword.p8v_a2+1 - - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_mul_uword.p8v_c - sty p8b_main.p8s_mul_uword.p8v_c+1 - - jsr p8b_main.p8s_mul_uword - stz p8b_main.p8s_mul_word.p8v_a1 - stz p8b_main.p8s_mul_word.p8v_a1+1 - stz p8b_main.p8s_mul_word.p8v_a2 - stz p8b_main.p8s_mul_word.p8v_a2+1 - stz p8b_main.p8s_mul_word.p8v_c - stz p8b_main.p8s_mul_word.p8v_c+1 - jsr p8b_main.p8s_mul_word - lda #<-10 - ldy #>-10 - sta p8b_main.p8s_mul_word.p8v_a1 - sty p8b_main.p8s_mul_word.p8v_a1+1 - - lda #<$03e8 - ldy #>$03e8 - sta p8b_main.p8s_mul_word.p8v_a2 - sty p8b_main.p8s_mul_word.p8v_a2+1 - - lda #<-$2710 - ldy #>-$2710 - sta p8b_main.p8s_mul_word.p8v_c - sty p8b_main.p8s_mul_word.p8v_c+1 - - jsr p8b_main.p8s_mul_word - lda #<1 - ldy #>1 - sta p8b_main.p8s_mul_word.p8v_a1 - sty p8b_main.p8s_mul_word.p8v_a1+1 - - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_mul_word.p8v_a2 - sty p8b_main.p8s_mul_word.p8v_a2+1 - - sta p8b_main.p8s_mul_word.p8v_c - sty p8b_main.p8s_mul_word.p8v_c+1 - - jsr p8b_main.p8s_mul_word - stz p8b_main.p8s_mul_float.p8v_a1 - stz p8b_main.p8s_mul_float.p8v_a1+1 - stz p8b_main.p8s_mul_float.p8v_a1+2 - stz p8b_main.p8s_mul_float.p8v_a1+3 - stz p8b_main.p8s_mul_float.p8v_a1+4 - - stz p8b_main.p8s_mul_float.p8v_a2 - stz p8b_main.p8s_mul_float.p8v_a2+1 - stz p8b_main.p8s_mul_float.p8v_a2+2 - stz p8b_main.p8s_mul_float.p8v_a2+3 - stz p8b_main.p8s_mul_float.p8v_a2+4 - - stz p8b_main.p8s_mul_float.p8v_c - stz p8b_main.p8s_mul_float.p8v_c+1 - stz p8b_main.p8s_mul_float.p8v_c+2 - stz p8b_main.p8s_mul_float.p8v_c+3 - stz p8b_main.p8s_mul_float.p8v_c+4 - - jsr p8b_main.p8s_mul_float - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_mul_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_mul_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_mul_float.p8v_c - jsr floats.copy_float - jsr p8b_main.p8s_mul_float - lda #prog8_float_const_3 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_mul_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_mul_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_mul_float.p8v_c - jsr floats.copy_float - jmp p8b_main.p8s_mul_float -; variables - .section BSS - .send BSS - - .pend - -p8s_mul_ubyte .proc -p8v_r = 50 ; zp UBYTE -p8v_c = 51 ; zp UBYTE -p8v_a2 = 52 ; zp UBYTE -p8v_a1 = 53 ; zp UBYTE -; statements - lda p8v_a1 - ldy p8v_a2 - jsr math.multiply_bytes - sta p8v_r - cmp p8v_c - bne label_asm_2_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #p8v_a1 - jsr floats.MOVFM - lda #p8v_a2 - jsr floats.CONUPK - jsr floats.FMULTT - ldx #p8v_r - jsr floats.MOVMF - - lda #p8v_c - jsr floats.MOVFM - lda #p8v_r - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_float_const_5 - jsr floats.var_fac1_less_f - beq label_asm_10_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_9 - lda #p8v_a1 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_4 - lda #p8v_a2 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_5 - lda #p8v_r - jsr floats.MOVFM - jsr floats.print - lda #13 - jmp cbm.CHROUT -; variables - .section BSS -prog8_float_eval_result2 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_a1 .fill 5 -p8v_a2 .fill 5 -p8v_c .fill 5 -p8v_r .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:" ok " - .byte $20, $4f, $4b, $20, $20, $00 -string_2 ; PETSCII:"err! " - .byte $45, $52, $52, $21, $20, $00 -string_3 ; PETSCII:"ubyte " - .byte $55, $42, $59, $54, $45, $20, $00 -string_4 ; PETSCII:" * " - .byte $20, $2a, $20, $00 -string_5 ; PETSCII:" = " - .byte $20, $3d, $20, $00 -string_6 ; PETSCII:"byte " - .byte $42, $59, $54, $45, $20, $00 -string_7 ; PETSCII:"uword " - .byte $55, $57, $4f, $52, $44, $20, $00 -string_8 ; PETSCII:"word " - .byte $57, $4f, $52, $44, $20, $00 -string_9 ; PETSCII:"float " - .byte $46, $4c, $4f, $41, $54, $20, $00 - - .pend - -; ---- block: 'floats' ---- -floats .proc - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FREADSA .proc - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - -GIVUAYFAY .proc - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - -GIVAYFAY .proc - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - -GETADRAY .proc - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - -FREADUY .proc - lda #0 - jmp GIVAYF - .pend - -parse .proc - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - -normalize .proc - jmp floats.NORMAL - .pend -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $82, $20, $00, $00, $00 ; float 2.5 -prog8_float_const_1 .byte $84, $20, $00, $00, $00 ; float 10.0 -prog8_float_const_2 .byte $85, $48, $00, $00, $00 ; float 25.0 -prog8_float_const_3 .byte $81, $c0, $00, $00, $00 ; float -1.5 -prog8_float_const_4 .byte $84, $f0, $00, $00, $00 ; float -15.0 -prog8_float_const_5 .byte $70, $27, $c5, $ac, $47 ; float 1.0E-5 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/plus.asm b/compiler/test/arithmetic/plus.asm deleted file mode 100644 index dcff9da9c..000000000 --- a/compiler/test/arithmetic/plus.asm +++ /dev/null @@ -1,6593 +0,0 @@ -; w65c02 assembly code for 'plus' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:57 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8b_main.p8s_plus_ubyte.p8v_a1 - stz p8b_main.p8s_plus_ubyte.p8v_a2 - stz p8b_main.p8s_plus_ubyte.p8v_c - jsr p8b_main.p8s_plus_ubyte - stz p8b_main.p8s_plus_ubyte.p8v_a1 - lda #$c8 - sta p8b_main.p8s_plus_ubyte.p8v_a2 - sta p8b_main.p8s_plus_ubyte.p8v_c - jsr p8b_main.p8s_plus_ubyte - lda #$64 - sta p8b_main.p8s_plus_ubyte.p8v_a1 - lda #$c8 - sta p8b_main.p8s_plus_ubyte.p8v_a2 - lda #$2c - sta p8b_main.p8s_plus_ubyte.p8v_c - jsr p8b_main.p8s_plus_ubyte - stz p8b_main.p8s_plus_byte.p8v_a1 - stz p8b_main.p8s_plus_byte.p8v_a2 - stz p8b_main.p8s_plus_byte.p8v_c - jsr p8b_main.p8s_plus_byte - lda #-$64 - sta p8b_main.p8s_plus_byte.p8v_a1 - lda #$64 - sta p8b_main.p8s_plus_byte.p8v_a2 - stz p8b_main.p8s_plus_byte.p8v_c - jsr p8b_main.p8s_plus_byte - lda #-$32 - sta p8b_main.p8s_plus_byte.p8v_a1 - lda #$64 - sta p8b_main.p8s_plus_byte.p8v_a2 - lda #$32 - sta p8b_main.p8s_plus_byte.p8v_c - jsr p8b_main.p8s_plus_byte - stz p8b_main.p8s_plus_byte.p8v_a1 - lda #-$1e - sta p8b_main.p8s_plus_byte.p8v_a2 - sta p8b_main.p8s_plus_byte.p8v_c - jsr p8b_main.p8s_plus_byte - lda #-$1e - sta p8b_main.p8s_plus_byte.p8v_a1 - stz p8b_main.p8s_plus_byte.p8v_a2 - lda #-$1e - sta p8b_main.p8s_plus_byte.p8v_c - jsr p8b_main.p8s_plus_byte - stz p8b_main.p8s_plus_uword.p8v_a1 - stz p8b_main.p8s_plus_uword.p8v_a1+1 - stz p8b_main.p8s_plus_uword.p8v_a2 - stz p8b_main.p8s_plus_uword.p8v_a2+1 - stz p8b_main.p8s_plus_uword.p8v_c - stz p8b_main.p8s_plus_uword.p8v_c+1 - jsr p8b_main.p8s_plus_uword - stz p8b_main.p8s_plus_uword.p8v_a1 - stz p8b_main.p8s_plus_uword.p8v_a1+1 - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_plus_uword.p8v_a2 - sty p8b_main.p8s_plus_uword.p8v_a2+1 - - sta p8b_main.p8s_plus_uword.p8v_c - sty p8b_main.p8s_plus_uword.p8v_c+1 - - jsr p8b_main.p8s_plus_uword - lda #<$c350 - ldy #>$c350 - sta p8b_main.p8s_plus_uword.p8v_a1 - sty p8b_main.p8s_plus_uword.p8v_a1+1 - - lda #<$4e20 - ldy #>$4e20 - sta p8b_main.p8s_plus_uword.p8v_a2 - sty p8b_main.p8s_plus_uword.p8v_a2+1 - - lda #<$1170 - ldy #>$1170 - sta p8b_main.p8s_plus_uword.p8v_c - sty p8b_main.p8s_plus_uword.p8v_c+1 - - jsr p8b_main.p8s_plus_uword - stz p8b_main.p8s_plus_word.p8v_a1 - stz p8b_main.p8s_plus_word.p8v_a1+1 - stz p8b_main.p8s_plus_word.p8v_a2 - stz p8b_main.p8s_plus_word.p8v_a2+1 - stz p8b_main.p8s_plus_word.p8v_c - stz p8b_main.p8s_plus_word.p8v_c+1 - jsr p8b_main.p8s_plus_word - lda #<-$03e8 - ldy #>-$03e8 - sta p8b_main.p8s_plus_word.p8v_a1 - sty p8b_main.p8s_plus_word.p8v_a1+1 - - lda #<$03e8 - ldy #>$03e8 - sta p8b_main.p8s_plus_word.p8v_a2 - sty p8b_main.p8s_plus_word.p8v_a2+1 - - stz p8b_main.p8s_plus_word.p8v_c - stz p8b_main.p8s_plus_word.p8v_c+1 - jsr p8b_main.p8s_plus_word - lda #<-$01f4 - ldy #>-$01f4 - sta p8b_main.p8s_plus_word.p8v_a1 - sty p8b_main.p8s_plus_word.p8v_a1+1 - - lda #<$03e8 - ldy #>$03e8 - sta p8b_main.p8s_plus_word.p8v_a2 - sty p8b_main.p8s_plus_word.p8v_a2+1 - - lda #<$01f4 - ldy #>$01f4 - sta p8b_main.p8s_plus_word.p8v_c - sty p8b_main.p8s_plus_word.p8v_c+1 - - jsr p8b_main.p8s_plus_word - stz p8b_main.p8s_plus_word.p8v_a1 - stz p8b_main.p8s_plus_word.p8v_a1+1 - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_plus_word.p8v_a2 - sty p8b_main.p8s_plus_word.p8v_a2+1 - - sta p8b_main.p8s_plus_word.p8v_c - sty p8b_main.p8s_plus_word.p8v_c+1 - - jsr p8b_main.p8s_plus_word - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_plus_word.p8v_a1 - sty p8b_main.p8s_plus_word.p8v_a1+1 - - stz p8b_main.p8s_plus_word.p8v_a2 - stz p8b_main.p8s_plus_word.p8v_a2+1 - lda #<-$0d05 - ldy #>-$0d05 - sta p8b_main.p8s_plus_word.p8v_c - sty p8b_main.p8s_plus_word.p8v_c+1 - - jsr p8b_main.p8s_plus_word - stz p8b_main.p8s_plus_float.p8v_a1 - stz p8b_main.p8s_plus_float.p8v_a1+1 - stz p8b_main.p8s_plus_float.p8v_a1+2 - stz p8b_main.p8s_plus_float.p8v_a1+3 - stz p8b_main.p8s_plus_float.p8v_a1+4 - - stz p8b_main.p8s_plus_float.p8v_a2 - stz p8b_main.p8s_plus_float.p8v_a2+1 - stz p8b_main.p8s_plus_float.p8v_a2+2 - stz p8b_main.p8s_plus_float.p8v_a2+3 - stz p8b_main.p8s_plus_float.p8v_a2+4 - - stz p8b_main.p8s_plus_float.p8v_c - stz p8b_main.p8s_plus_float.p8v_c+1 - stz p8b_main.p8s_plus_float.p8v_c+2 - stz p8b_main.p8s_plus_float.p8v_c+3 - stz p8b_main.p8s_plus_float.p8v_c+4 - - jsr p8b_main.p8s_plus_float - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_c - jsr floats.copy_float - jsr p8b_main.p8s_plus_float - lda #prog8_float_const_3 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_5 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_c - jsr floats.copy_float - jsr p8b_main.p8s_plus_float - lda #prog8_float_const_6 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_a1 - jsr floats.copy_float - lda #prog8_float_const_7 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_a2 - jsr floats.copy_float - lda #prog8_float_const_8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_plus_float.p8v_c - jsr floats.copy_float - jmp p8b_main.p8s_plus_float -; variables - .section BSS - .send BSS - - .pend - -p8s_plus_ubyte .proc -p8v_r = 50 ; zp UBYTE -p8v_c = 51 ; zp UBYTE -p8v_a2 = 52 ; zp UBYTE -p8v_a1 = 53 ; zp UBYTE -; statements - lda p8v_a1 - clc - adc p8v_a2 - sta p8v_r - cmp p8v_c - bne label_asm_2_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #p8v_a1 - jsr floats.MOVFM - lda #p8v_a2 - jsr floats.CONUPK - jsr floats.FADDT - ldx #p8v_r - jsr floats.MOVMF - - lda #p8v_c - jsr floats.MOVFM - lda #p8v_r - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_float_const_9 - jsr floats.var_fac1_less_f - beq label_asm_10_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_9 - lda #p8v_a1 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_4 - lda #p8v_a2 - jsr floats.MOVFM - jsr floats.print - ldy #>prog8_interned_strings.string_5 - lda #p8v_r - jsr floats.MOVFM - jsr floats.print - lda #13 - jmp cbm.CHROUT -; variables - .section BSS -prog8_float_eval_result2 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_a1 .fill 5 -p8v_a2 .fill 5 -p8v_c .fill 5 -p8v_r .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:" ok " - .byte $20, $4f, $4b, $20, $20, $00 -string_2 ; PETSCII:"err! " - .byte $45, $52, $52, $21, $20, $00 -string_3 ; PETSCII:"ubyte " - .byte $55, $42, $59, $54, $45, $20, $00 -string_4 ; PETSCII:" + " - .byte $20, $2b, $20, $00 -string_5 ; PETSCII:" = " - .byte $20, $3d, $20, $00 -string_6 ; PETSCII:"byte " - .byte $42, $59, $54, $45, $20, $00 -string_7 ; PETSCII:"uword " - .byte $55, $57, $4f, $52, $44, $20, $00 -string_8 ; PETSCII:"word " - .byte $57, $4f, $52, $44, $20, $00 -string_9 ; PETSCII:"float " - .byte $46, $4c, $4f, $41, $54, $20, $00 - - .pend - -; ---- block: 'floats' ---- -floats .proc - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FREADSA .proc - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - -GIVUAYFAY .proc - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - -GIVAYFAY .proc - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - -GETADRAY .proc - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - -FREADUY .proc - lda #0 - jmp GIVAYF - .pend - -parse .proc - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - -normalize .proc - jmp floats.NORMAL - .pend -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $40, $00, $00, $00 ; float 1.5 -prog8_float_const_1 .byte $82, $20, $00, $00, $00 ; float 2.5 -prog8_float_const_2 .byte $83, $00, $00, $00, $00 ; float 4.0 -prog8_float_const_3 .byte $81, $c0, $00, $00, $00 ; float -1.5 -prog8_float_const_4 .byte $82, $60, $00, $00, $00 ; float 3.5 -prog8_float_const_5 .byte $82, $00, $00, $00, $00 ; float 2.0 -prog8_float_const_6 .byte $81, $8c, $cc, $cc, $cc ; float -1.1 -prog8_float_const_7 .byte $82, $53, $33, $33, $33 ; float 3.3 -prog8_float_const_8 .byte $82, $0c, $cc, $cc, $cc ; float 2.2 -prog8_float_const_9 .byte $70, $27, $c5, $ac, $47 ; float 1.0E-5 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/postincrdecr.asm b/compiler/test/arithmetic/postincrdecr.asm deleted file mode 100644 index 9c0080aa8..000000000 --- a/compiler/test/arithmetic/postincrdecr.asm +++ /dev/null @@ -1,6591 +0,0 @@ -; w65c02 assembly code for 'postincrdecr' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:58 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -p8v_y = 34 ; zp UBYTE -p8v_ww = 35 ; zp WORD -p8v_uw = 37 ; zp UWORD -p8v_ub = 39 ; zp UBYTE -p8v_bb = 40 ; zp BYTE -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - ldy #0 - ldx #$18 - jsr txt.plot - stz p8v_y - lda #$c8 - sta p8v_ub - lda #-$64 - sta p8v_bb - lda #<$07d0 - ldy #>$07d0 - sta p8v_uw - sty p8v_uw+1 - - lda #<-$03e8 - ldy #>-$03e8 - sta p8v_ww - sty p8v_ww+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_fl - jsr floats.copy_float - ldy #>prog8_interned_strings.string_1 - lda #(p8v_fl) - jsr floats.inc_var_f - inc p8v_ubarr + 1 - inc p8v_barr + 1 - inc p8v_uwarr + 2 - bne + - inc p8v_uwarr + 2+1 -+ - inc p8v_warr + 2 - bne + - inc p8v_warr + 2+1 -+ - lda #<(p8v_flarr + 5) - ldy #>(p8v_flarr + 5) - jsr floats.inc_var_f - lda p8v_ub - ldy #$c9 - jsr p8b_main.p8s_check_ub - lda #$64 - sta p8v_y - inc p8v_y - lda p8v_y - ldy #$65 - jsr p8b_main.p8s_check_ub - lda #p8v_fl - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_value - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_expected - jsr floats.copy_float - jsr p8b_main.p8s_check_fl - lda p8v_bb - ldy #-$63 - jsr p8b_main.p8s_check_b - lda p8v_uw - ldy p8v_uw+1 - sta p8b_main.p8s_check_uw.p8v_value - sty p8b_main.p8s_check_uw.p8v_value+1 - lda #<$07d1 - ldy #>$07d1 - sta p8b_main.p8s_check_uw.p8v_expected - sty p8b_main.p8s_check_uw.p8v_expected+1 - - jsr p8b_main.p8s_check_uw - lda p8v_ww - ldy p8v_ww+1 - sta p8b_main.p8s_check_w.p8v_value - sty p8b_main.p8s_check_w.p8v_value+1 - lda #<-$03e7 - ldy #>-$03e7 - sta p8b_main.p8s_check_w.p8v_expected - sty p8b_main.p8s_check_w.p8v_expected+1 - - jsr p8b_main.p8s_check_w - lda p8v_ubarr+0 - ldy #$c8 - jsr p8b_main.p8s_check_ub - lda #<(p8v_flarr+0) - ldy #>(p8v_flarr+0) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_value - jsr floats.copy_float - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_expected - jsr floats.copy_float - jsr p8b_main.p8s_check_fl - lda p8v_barr+0 - ldy #-$64 - jsr p8b_main.p8s_check_b - lda p8v_uwarr+0 - ldy p8v_uwarr+0+1 - sta p8b_main.p8s_check_uw.p8v_value - sty p8b_main.p8s_check_uw.p8v_value+1 - lda #<$07d0 - ldy #>$07d0 - sta p8b_main.p8s_check_uw.p8v_expected - sty p8b_main.p8s_check_uw.p8v_expected+1 - - jsr p8b_main.p8s_check_uw - lda p8v_warr+0 - ldy p8v_warr+0+1 - sta p8b_main.p8s_check_w.p8v_value - sty p8b_main.p8s_check_w.p8v_value+1 - lda #<-$03e8 - ldy #>-$03e8 - sta p8b_main.p8s_check_w.p8v_expected - sty p8b_main.p8s_check_w.p8v_expected+1 - - jsr p8b_main.p8s_check_w - lda p8v_ubarr+1 - ldy #$c9 - jsr p8b_main.p8s_check_ub - lda #<(p8v_flarr+5) - ldy #>(p8v_flarr+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_value - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_expected - jsr floats.copy_float - jsr p8b_main.p8s_check_fl - lda p8v_barr+1 - ldy #-$63 - jsr p8b_main.p8s_check_b - lda p8v_uwarr+2 - ldy p8v_uwarr+2+1 - sta p8b_main.p8s_check_uw.p8v_value - sty p8b_main.p8s_check_uw.p8v_value+1 - lda #<$07d1 - ldy #>$07d1 - sta p8b_main.p8s_check_uw.p8v_expected - sty p8b_main.p8s_check_uw.p8v_expected+1 - - jsr p8b_main.p8s_check_uw - lda p8v_warr+2 - ldy p8v_warr+2+1 - sta p8b_main.p8s_check_w.p8v_value - sty p8b_main.p8s_check_w.p8v_value+1 - lda #<-$03e7 - ldy #>-$03e7 - sta p8b_main.p8s_check_w.p8v_expected - sty p8b_main.p8s_check_w.p8v_expected+1 - - jsr p8b_main.p8s_check_w - ldy #>prog8_interned_strings.string_2 - lda #(p8v_fl) - jsr floats.dec_var_f - dec p8v_ubarr + 1 - dec p8v_barr + 1 - lda p8v_uwarr + 2 - bne + - dec p8v_uwarr + 2+1 -+ dec p8v_uwarr + 2 - lda p8v_warr + 2 - bne + - dec p8v_warr + 2+1 -+ dec p8v_warr + 2 - lda #<(p8v_flarr + 5) - ldy #>(p8v_flarr + 5) - jsr floats.dec_var_f - lda p8v_ub - ldy #$c8 - jsr p8b_main.p8s_check_ub - lda #$64 - sta p8v_y - dec p8v_y - lda p8v_y - ldy #$63 - jsr p8b_main.p8s_check_ub - lda #p8v_fl - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_value - jsr floats.copy_float - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_expected - jsr floats.copy_float - jsr p8b_main.p8s_check_fl - lda p8v_bb - ldy #-$64 - jsr p8b_main.p8s_check_b - lda p8v_uw - ldy p8v_uw+1 - sta p8b_main.p8s_check_uw.p8v_value - sty p8b_main.p8s_check_uw.p8v_value+1 - lda #<$07d0 - ldy #>$07d0 - sta p8b_main.p8s_check_uw.p8v_expected - sty p8b_main.p8s_check_uw.p8v_expected+1 - - jsr p8b_main.p8s_check_uw - lda p8v_ww - ldy p8v_ww+1 - sta p8b_main.p8s_check_w.p8v_value - sty p8b_main.p8s_check_w.p8v_value+1 - lda #<-$03e8 - ldy #>-$03e8 - sta p8b_main.p8s_check_w.p8v_expected - sty p8b_main.p8s_check_w.p8v_expected+1 - - jsr p8b_main.p8s_check_w - lda p8v_ubarr+1 - ldy #$c8 - jsr p8b_main.p8s_check_ub - lda #<(p8v_flarr+5) - ldy #>(p8v_flarr+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_value - jsr floats.copy_float - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_check_fl.p8v_expected - jsr floats.copy_float - jsr p8b_main.p8s_check_fl - lda p8v_barr+1 - ldy #-$64 - jsr p8b_main.p8s_check_b - lda p8v_uwarr+2 - ldy p8v_uwarr+2+1 - sta p8b_main.p8s_check_uw.p8v_value - sty p8b_main.p8s_check_uw.p8v_value+1 - lda #<$07d0 - ldy #>$07d0 - sta p8b_main.p8s_check_uw.p8v_expected - sty p8b_main.p8s_check_uw.p8v_expected+1 - - jsr p8b_main.p8s_check_uw - lda p8v_warr+2 - ldy p8v_warr+2+1 - sta p8b_main.p8s_check_w.p8v_value - sty p8b_main.p8s_check_w.p8v_value+1 - lda #<-$03e8 - ldy #>-$03e8 - sta p8b_main.p8s_check_w.p8v_expected - sty p8b_main.p8s_check_w.p8v_expected+1 - - jmp p8b_main.p8s_check_w -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_fl .fill 5 - .send BSS -; non-zeropage variables -p8v_barr .char -$64, -$64, -$64 -p8v_flarr - .byte $8a, $79, $ff, $5c, $28 ; float prog8.code.StArrayElement@37a0ec3c - .byte $8a, $79, $ff, $5c, $28 ; float prog8.code.StArrayElement@422ad5e2 - .byte $8a, $79, $ff, $5c, $28 ; float prog8.code.StArrayElement@62a54948 -p8v_ubarr .byte $c8, $c8, $c8 -p8v_uwarr .word $07d0, $07d0, $07d0 -p8v_warr .sint -$03e8, -$03e8, -$03e8 - .pend - -p8s_check_ub .proc -p8v_value = 49 ; zp UBYTE -p8v_expected = 50 ; zp UBYTE -; simple int arg(s) passed via register(s) - sta p8v_value - sty p8v_expected -; statements - cmp p8v_expected - bne label_asm_2_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_8 - lda #p8v_value - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_expected - jsr floats.vars_equal_f - beq label_asm_10_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_9 - lda #p8v_value - jsr floats.MOVFM - jsr floats.print - lda #$2c - jsr cbm.CHROUT - lda #p8v_expected - jsr floats.MOVFM - jsr floats.print - lda #13 - jmp cbm.CHROUT -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_expected .fill 5 -p8v_value .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"++\n" - .byte $2b, $2b, $0d, $00 -string_2 ; PETSCII:"--\n" - .byte $2d, $2d, $0d, $00 -string_3 ; PETSCII:" ok " - .byte $20, $4f, $4b, $20, $20, $00 -string_4 ; PETSCII:"err! " - .byte $45, $52, $52, $21, $20, $00 -string_5 ; PETSCII:" ubyte " - .byte $20, $55, $42, $59, $54, $45, $20, $00 -string_6 ; PETSCII:" byte " - .byte $20, $42, $59, $54, $45, $20, $00 -string_7 ; PETSCII:" uword " - .byte $20, $55, $57, $4f, $52, $44, $20, $00 -string_8 ; PETSCII:" word " - .byte $20, $57, $4f, $52, $44, $20, $00 -string_9 ; PETSCII:" float " - .byte $20, $46, $4c, $4f, $41, $54, $20, $00 - - .pend - -; ---- block: 'floats' ---- -floats .proc - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FREADSA .proc - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - -GIVUAYFAY .proc - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - -GIVAYFAY .proc - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - -GETADRAY .proc - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - -FREADUY .proc - lda #0 - jmp GIVAYF - .pend - -parse .proc - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - -normalize .proc - jmp floats.NORMAL - .pend -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $8a, $79, $ff, $5c, $28 ; float 999.99 -prog8_float_const_1 .byte $81, $00, $00, $00, $00 ; float 1.0 -prog8_float_const_2 .byte $8a, $7a, $3f, $5c, $28 ; float 1000.99 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/remainder.asm b/compiler/test/arithmetic/remainder.asm deleted file mode 100644 index 8d620dc83..000000000 --- a/compiler/test/arithmetic/remainder.asm +++ /dev/null @@ -1,5344 +0,0 @@ -; w65c02 assembly code for 'remainder' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:58 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8b_main.p8s_remainder_ubyte.p8v_a1 - lda #1 - sta p8b_main.p8s_remainder_ubyte.p8v_a2 - stz p8b_main.p8s_remainder_ubyte.p8v_c - jsr p8b_main.p8s_remainder_ubyte - lda #$64 - sta p8b_main.p8s_remainder_ubyte.p8v_a1 - lda #6 - sta p8b_main.p8s_remainder_ubyte.p8v_a2 - lda #4 - sta p8b_main.p8s_remainder_ubyte.p8v_c - jsr p8b_main.p8s_remainder_ubyte - lda #$ff - sta p8b_main.p8s_remainder_ubyte.p8v_a1 - lda #2 - sta p8b_main.p8s_remainder_ubyte.p8v_a2 - lda #1 - sta p8b_main.p8s_remainder_ubyte.p8v_c - jsr p8b_main.p8s_remainder_ubyte - lda #$ff - sta p8b_main.p8s_remainder_ubyte.p8v_a1 - lda #$14 - sta p8b_main.p8s_remainder_ubyte.p8v_a2 - lda #15 - sta p8b_main.p8s_remainder_ubyte.p8v_c - jsr p8b_main.p8s_remainder_ubyte - stz p8b_main.p8s_remainder_uword.p8v_a1 - stz p8b_main.p8s_remainder_uword.p8v_a1+1 - lda #<1 - ldy #>1 - sta p8b_main.p8s_remainder_uword.p8v_a2 - sty p8b_main.p8s_remainder_uword.p8v_a2+1 - - stz p8b_main.p8s_remainder_uword.p8v_c - stz p8b_main.p8s_remainder_uword.p8v_c+1 - jsr p8b_main.p8s_remainder_uword - lda #<$9c40 - ldy #>$9c40 - sta p8b_main.p8s_remainder_uword.p8v_a1 - sty p8b_main.p8s_remainder_uword.p8v_a1+1 - - lda #<$01ff - ldy #>$01ff - sta p8b_main.p8s_remainder_uword.p8v_a2 - sty p8b_main.p8s_remainder_uword.p8v_a2+1 - - lda #<$8e - ldy #>$8e - sta p8b_main.p8s_remainder_uword.p8v_c - sty p8b_main.p8s_remainder_uword.p8v_c+1 - - jsr p8b_main.p8s_remainder_uword - lda #<$9c40 - ldy #>$9c40 - sta p8b_main.p8s_remainder_uword.p8v_a1 - sty p8b_main.p8s_remainder_uword.p8v_a1+1 - - lda #<$01f4 - ldy #>$01f4 - sta p8b_main.p8s_remainder_uword.p8v_a2 - sty p8b_main.p8s_remainder_uword.p8v_a2+1 - - stz p8b_main.p8s_remainder_uword.p8v_c - stz p8b_main.p8s_remainder_uword.p8v_c+1 - jsr p8b_main.p8s_remainder_uword - lda #<$a8cb - ldy #>$a8cb - sta p8b_main.p8s_remainder_uword.p8v_a1 - sty p8b_main.p8s_remainder_uword.p8v_a1+1 - - lda #<12 - ldy #>12 - sta p8b_main.p8s_remainder_uword.p8v_a2 - sty p8b_main.p8s_remainder_uword.p8v_a2+1 - - lda #<11 - ldy #>11 - sta p8b_main.p8s_remainder_uword.p8v_c - sty p8b_main.p8s_remainder_uword.p8v_c+1 - - jmp p8b_main.p8s_remainder_uword -; variables - .section BSS - .send BSS - - .pend - -p8s_remainder_ubyte .proc -p8v_r = 42 ; zp UBYTE -p8v_c = 43 ; zp UBYTE -p8v_a2 = 44 ; zp UBYTE -p8v_a1 = 45 ; zp UBYTE -; statements - lda p8v_a1 - ldy p8v_a2 - jsr math.divmod_ub_asm - sta p8v_r - cmp p8v_c - bne label_asm_2_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/sgn.asm b/compiler/test/arithmetic/sgn.asm deleted file mode 100644 index ad9502efd..000000000 --- a/compiler/test/arithmetic/sgn.asm +++ /dev/null @@ -1,6600 +0,0 @@ -; w65c02 assembly code for 'sgn' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:58 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -p8v_w2 = 34 ; zp WORD -p8v_w1 = 36 ; zp WORD -p8v_uw2 = 38 ; zp UWORD -p8v_uw1 = 40 ; zp UWORD -p8v_ub2 = 42 ; zp UBYTE -p8v_ub1 = 43 ; zp UBYTE -p8v_b2 = 44 ; zp BYTE -p8v_b1 = 45 ; zp BYTE -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8v_b1 - stz p8v_b2 - stz p8v_ub1 - stz p8v_ub2 - stz p8v_w1 - stz p8v_w1+1 - stz p8v_w2 - stz p8v_w2+1 - stz p8v_uw1 - stz p8v_uw1+1 - stz p8v_uw2 - stz p8v_uw2+1 - stz p8v_f1 - stz p8v_f1+1 - stz p8v_f1+2 - stz p8v_f1+3 - stz p8v_f1+4 - - stz p8v_f2 - stz p8v_f2+1 - stz p8v_f2+2 - stz p8v_f2+3 - stz p8v_f2+4 - - lda #10 - sta p8v_b1 - sta p8v_b2 - sec - sbc p8v_b1 - jsr prog8_lib.func_sign_b_into_A - cmp #0 - beq label_asm_1_afterif - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #$64 - sta p8v_w1 - sty p8v_w1+1 - - sta p8v_w2 - sty p8v_w2+1 - - sec - sbc p8v_w1 - tax - tya - sbc p8v_w1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #0 - beq label_asm_4_afterif - ldy #>prog8_interned_strings.string_4 - lda #-$07d0 - sta p8v_w1 - sty p8v_w1+1 - - sta p8v_w2 - sty p8v_w2+1 - - sec - sbc p8v_w1 - tax - tya - sbc p8v_w1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #0 - beq label_asm_5_afterif - ldy #>prog8_interned_strings.string_5 - lda #$03e7 - sta p8v_uw1 - sty p8v_uw1+1 - - sta p8v_uw2 - sty p8v_uw2+1 - - sec - sbc p8v_uw1 - tax - tya - sbc p8v_uw1+1 - tay - txa - jsr prog8_lib.func_sign_uw_into_A - cmp #0 - beq label_asm_6_afterif - ldy #>prog8_interned_strings.string_6 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f1 - jsr floats.copy_float - lda #p8v_f2 - jsr floats.copy_float - lda #p8v_f1 - jsr floats.MOVFM - lda #p8v_f2 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #$65 - sta p8v_w1 - sty p8v_w1+1 - - lda #<$64 - ldy #>$64 - sta p8v_w2 - sty p8v_w2+1 - - sec - sbc p8v_w1 - tax - tya - sbc p8v_w1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #-1 - beq label_asm_11_afterif - ldy #>prog8_interned_strings.string_11 - lda #-$c8 - sta p8v_w1 - sty p8v_w1+1 - - lda #<-$07d0 - ldy #>-$07d0 - sta p8v_w2 - sty p8v_w2+1 - - sec - sbc p8v_w1 - tax - tya - sbc p8v_w1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #-1 - beq label_asm_12_afterif - ldy #>prog8_interned_strings.string_12 - lda #$08ae - sta p8v_uw1 - sty p8v_uw1+1 - - lda #<$03e7 - ldy #>$03e7 - sta p8v_uw2 - sty p8v_uw2+1 - - lda p8v_uw1 - sta P8ZP_SCRATCH_W1 - lda p8v_uw1+1 - sta P8ZP_SCRATCH_W1+1 - ldy p8v_uw2+1 - lda p8v_uw2 - sec - sbc P8ZP_SCRATCH_W1 - tax - tya - sbc P8ZP_SCRATCH_W1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #-1 - beq label_asm_13_afterif - ldy #>prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f1 - jsr floats.copy_float - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f2 - jsr floats.copy_float - lda #p8v_f1 - jsr floats.MOVFM - lda #p8v_f2 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #prog8_interned_strings.string_17 - lda #prog8_interned_strings.string_18 - lda #$65 - sta p8v_w1 - sty p8v_w1+1 - - lda #<$c8 - ldy #>$c8 - sta p8v_w2 - sty p8v_w2+1 - - sec - sbc p8v_w1 - tax - tya - sbc p8v_w1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #1 - beq label_asm_19_afterif - ldy #>prog8_interned_strings.string_19 - lda #-$c8 - sta p8v_w1 - sty p8v_w1+1 - - lda #<-$14 - ldy #>-$14 - sta p8v_w2 - sty p8v_w2+1 - - sec - sbc p8v_w1 - tax - tya - sbc p8v_w1+1 - tay - txa - jsr prog8_lib.func_sign_w_into_A - cmp #1 - beq label_asm_20_afterif - ldy #>prog8_interned_strings.string_20 - lda #$08ae - sta p8v_uw1 - sty p8v_uw1+1 - - lda #<$270f - ldy #>$270f - sta p8v_uw2 - sty p8v_uw2+1 - - sec - sbc p8v_uw1 - tax - tya - sbc p8v_uw1+1 - tay - txa - jsr prog8_lib.func_sign_uw_into_A - cmp #1 - beq label_asm_21_afterif - ldy #>prog8_interned_strings.string_21 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f1 - jsr floats.copy_float - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f2 - jsr floats.copy_float - lda #p8v_f1 - jsr floats.MOVFM - lda #p8v_f2 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result2 - jsr floats.MOVMF - - ldy #>prog8_float_eval_result2 - lda #prog8_interned_strings.string_22 - lda #prog8_interned_strings.string_23 - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - -print .proc - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -tostr .proc - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -sin .proc -; statements - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - -rad .proc -; statements - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $82, $5c, $cc, $cc, $cc ; float 3.45 -prog8_float_const_1 .byte $81, $0e, $14, $7a, $e1 ; float 1.11 -prog8_float_const_2 .byte $83, $23, $85, $1e, $b8 ; float 5.11 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/testforloops.asm b/compiler/test/arithmetic/testforloops.asm deleted file mode 100644 index b373949c6..000000000 --- a/compiler/test/arithmetic/testforloops.asm +++ /dev/null @@ -1,10713 +0,0 @@ -; w65c02 assembly code for 'testforloops' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:58 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -p8v_ww = 34 ; zp WORD -p8v_uw = 36 ; zp UWORD -p8v_ub = 38 ; zp UBYTE -p8v_totaluw = 39 ; zp UWORD -p8v_total = 41 ; zp WORD -p8v_endw1 = 43 ; zp WORD -p8v_enduw1 = 45 ; zp UWORD -p8v_endub1 = 47 ; zp UBYTE -p8v_endb1 = 48 ; zp BYTE -p8v_count = 49 ; zp UWORD -p8v_bb = 51 ; zp BYTE -p8v_aa = 52 ; zp UBYTE -p8v_a = 53 ; zp UBYTE -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8v_endub1 - stz p8v_endb1 - stz p8v_count - stz p8v_count+1 - stz p8v_aa - stz p8v_ub - stz p8v_bb - stz p8v_total - stz p8v_total+1 - stz p8v_a - ldy #0 - ldx #$18 - jsr txt.plot - stz p8v_count - stz p8v_count+1 - stz p8v_total - stz p8v_total+1 - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - sta label_asm_1_for_loop+1 - sty label_asm_1_for_loop+2 -label_asm_1_for_loop lda $ffff ; modified - beq label_asm_2_for_end - sta p8v_a - sta p8v_aa - - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_aa - sta p8v_total - bcc + - inc p8v_total+1 -+ - inc label_asm_1_for_loop+1 - bne label_asm_1_for_loop - inc label_asm_1_for_loop+2 - bne label_asm_1_for_loop -label_asm_2_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<5 - bne label_asm_5_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>5 - bne label_asm_5_else - lda #1 - bra label_asm_4_afterif -label_asm_5_else - lda #0 -label_asm_4_afterif - beq label_asm_3_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<372 - bne label_asm_7_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>372 - bne label_asm_7_else - lda #1 - bra label_asm_6_afterif -label_asm_7_else - lda #0 -label_asm_6_afterif -label_asm_3_shortcut - beq label_asm_9_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #4 - bne label_asm_15_else - lda #1 - bra label_asm_14_afterif -label_asm_15_else - lda #0 -label_asm_14_afterif - beq label_asm_13_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<108 - bne label_asm_17_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>108 - bne label_asm_17_else - lda #1 - bra label_asm_16_afterif -label_asm_17_else - lda #0 -label_asm_16_afterif -label_asm_13_shortcut - beq label_asm_19_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_6 - lda #5 - bne label_asm_25_else - lda #1 - bra label_asm_24_afterif -label_asm_25_else - lda #0 -label_asm_24_afterif - beq label_asm_23_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<220 - bne label_asm_27_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>220 - bne label_asm_27_else - lda #1 - bra label_asm_26_afterif -label_asm_27_else - lda #0 -label_asm_26_afterif -label_asm_23_shortcut - beq label_asm_29_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_7 - lda #11 - bne label_asm_34_else - lda #1 - bra label_asm_33_afterif -label_asm_34_else - lda #0 -label_asm_33_afterif - beq label_asm_32_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<165 - bne label_asm_36_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>165 - bne label_asm_36_else - lda #1 - bra label_asm_35_afterif -label_asm_36_else - lda #0 -label_asm_35_afterif -label_asm_32_shortcut - beq label_asm_38_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_8 - lda #11 - bne label_asm_43_else - lda #1 - bra label_asm_42_afterif -label_asm_43_else - lda #0 -label_asm_42_afterif - beq label_asm_41_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<165 - bne label_asm_45_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>165 - bne label_asm_45_else - lda #1 - bra label_asm_44_afterif -label_asm_45_else - lda #0 -label_asm_44_afterif -label_asm_41_shortcut - beq label_asm_47_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_9 - lda #4 - bne label_asm_52_else - lda #1 - bra label_asm_51_afterif -label_asm_52_else - lda #0 -label_asm_51_afterif - beq label_asm_50_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<58 - bne label_asm_54_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>58 - bne label_asm_54_else - lda #1 - bra label_asm_53_afterif -label_asm_54_else - lda #0 -label_asm_53_afterif -label_asm_50_shortcut - beq label_asm_56_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_10 - lda #5 - bne label_asm_61_else - lda #1 - bra label_asm_60_afterif -label_asm_61_else - lda #0 -label_asm_60_afterif - beq label_asm_59_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<80 - bne label_asm_63_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>80 - bne label_asm_63_else - lda #1 - bra label_asm_62_afterif -label_asm_63_else - lda #0 -label_asm_62_afterif -label_asm_59_shortcut - beq label_asm_65_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_11 - lda #5 - bne label_asm_70_else - lda #1 - bra label_asm_69_afterif -label_asm_70_else - lda #0 -label_asm_69_afterif - beq label_asm_68_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<90 - bne label_asm_72_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>90 - bne label_asm_72_else - lda #1 - bra label_asm_71_afterif -label_asm_72_else - lda #0 -label_asm_71_afterif -label_asm_68_shortcut - beq label_asm_74_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_12 - lda #6 - bne label_asm_79_else - lda #1 - bra label_asm_78_afterif -label_asm_79_else - lda #0 -label_asm_78_afterif - beq label_asm_77_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<99 - bne label_asm_81_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>99 - bne label_asm_81_else - lda #1 - bra label_asm_80_afterif -label_asm_81_else - lda #0 -label_asm_80_afterif -label_asm_77_shortcut - beq label_asm_83_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_13 - lda #7 - bne label_asm_90_else - lda #1 - bra label_asm_89_afterif -label_asm_90_else - lda #0 -label_asm_89_afterif - beq label_asm_88_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<686 - bne label_asm_92_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>686 - bne label_asm_92_else - lda #1 - bra label_asm_91_afterif -label_asm_92_else - lda #0 -label_asm_91_afterif -label_asm_88_shortcut - beq label_asm_94_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_14 - lda #7 - bne label_asm_101_else - lda #1 - bra label_asm_100_afterif -label_asm_101_else - lda #0 -label_asm_100_afterif - beq label_asm_99_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<686 - bne label_asm_103_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>686 - bne label_asm_103_else - lda #1 - bra label_asm_102_afterif -label_asm_103_else - lda #0 -label_asm_102_afterif -label_asm_99_shortcut - beq label_asm_105_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_15 - lda #4 - bne label_asm_112_else - lda #1 - bra label_asm_111_afterif -label_asm_112_else - lda #0 -label_asm_111_afterif - beq label_asm_110_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<398 - bne label_asm_114_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>398 - bne label_asm_114_else - lda #1 - bra label_asm_113_afterif -label_asm_114_else - lda #0 -label_asm_113_afterif -label_asm_110_shortcut - beq label_asm_116_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_16 - lda #4 - bne label_asm_123_else - lda #1 - bra label_asm_122_afterif -label_asm_123_else - lda #0 -label_asm_122_afterif - beq label_asm_121_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<402 - bne label_asm_125_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>402 - bne label_asm_125_else - lda #1 - bra label_asm_124_afterif -label_asm_125_else - lda #0 -label_asm_124_afterif -label_asm_121_shortcut - beq label_asm_127_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_17 - lda #5 - bne label_asm_134_else - lda #1 - bra label_asm_133_afterif -label_asm_134_else - lda #0 -label_asm_133_afterif - beq label_asm_132_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<505 - bne label_asm_136_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>505 - bne label_asm_136_else - lda #1 - bra label_asm_135_afterif -label_asm_136_else - lda #0 -label_asm_135_afterif -label_asm_132_shortcut - beq label_asm_138_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_18 - lda #5 - bne label_asm_145_else - lda #1 - bra label_asm_144_afterif -label_asm_145_else - lda #0 -label_asm_144_afterif - beq label_asm_143_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<505 - bne label_asm_147_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>505 - bne label_asm_147_else - lda #1 - bra label_asm_146_afterif -label_asm_147_else - lda #0 -label_asm_146_afterif -label_asm_143_shortcut - beq label_asm_149_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_19 - lda #prog8_interned_strings.string_2 - sta label_asm_150_for_loop+1 - sty label_asm_150_for_loop+2 -label_asm_150_for_loop lda $ffff ; modified - beq label_asm_151_for_end - sta p8v_ub - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ub - sta p8v_total - bcc + - inc p8v_total+1 -+ - inc label_asm_150_for_loop+1 - bne label_asm_150_for_loop - inc label_asm_150_for_loop+2 - bne label_asm_150_for_loop -label_asm_151_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<5 - bne label_asm_154_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>5 - bne label_asm_154_else - lda #1 - bra label_asm_153_afterif -label_asm_154_else - lda #0 -label_asm_153_afterif - beq label_asm_152_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<372 - bne label_asm_156_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>372 - bne label_asm_156_else - lda #1 - bra label_asm_155_afterif -label_asm_156_else - lda #0 -label_asm_155_afterif -label_asm_152_shortcut - beq label_asm_158_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_20 - lda #4 - bne label_asm_164_else - lda #1 - bra label_asm_163_afterif -label_asm_164_else - lda #0 -label_asm_163_afterif - beq label_asm_162_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<108 - bne label_asm_166_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>108 - bne label_asm_166_else - lda #1 - bra label_asm_165_afterif -label_asm_166_else - lda #0 -label_asm_165_afterif -label_asm_162_shortcut - beq label_asm_168_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_21 - lda #5 - bne label_asm_174_else - lda #1 - bra label_asm_173_afterif -label_asm_174_else - lda #0 -label_asm_173_afterif - beq label_asm_172_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<220 - bne label_asm_176_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>220 - bne label_asm_176_else - lda #1 - bra label_asm_175_afterif -label_asm_176_else - lda #0 -label_asm_175_afterif -label_asm_172_shortcut - beq label_asm_178_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_22 - lda #11 - bne label_asm_183_else - lda #1 - bra label_asm_182_afterif -label_asm_183_else - lda #0 -label_asm_182_afterif - beq label_asm_181_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<165 - bne label_asm_185_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>165 - bne label_asm_185_else - lda #1 - bra label_asm_184_afterif -label_asm_185_else - lda #0 -label_asm_184_afterif -label_asm_181_shortcut - beq label_asm_187_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_23 - lda #11 - bne label_asm_192_else - lda #1 - bra label_asm_191_afterif -label_asm_192_else - lda #0 -label_asm_191_afterif - beq label_asm_190_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<165 - bne label_asm_194_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>165 - bne label_asm_194_else - lda #1 - bra label_asm_193_afterif -label_asm_194_else - lda #0 -label_asm_193_afterif -label_asm_190_shortcut - beq label_asm_196_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_24 - lda #4 - bne label_asm_201_else - lda #1 - bra label_asm_200_afterif -label_asm_201_else - lda #0 -label_asm_200_afterif - beq label_asm_199_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<58 - bne label_asm_203_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>58 - bne label_asm_203_else - lda #1 - bra label_asm_202_afterif -label_asm_203_else - lda #0 -label_asm_202_afterif -label_asm_199_shortcut - beq label_asm_205_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_25 - lda #5 - bne label_asm_210_else - lda #1 - bra label_asm_209_afterif -label_asm_210_else - lda #0 -label_asm_209_afterif - beq label_asm_208_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<80 - bne label_asm_212_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>80 - bne label_asm_212_else - lda #1 - bra label_asm_211_afterif -label_asm_212_else - lda #0 -label_asm_211_afterif -label_asm_208_shortcut - beq label_asm_214_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_26 - lda #5 - bne label_asm_219_else - lda #1 - bra label_asm_218_afterif -label_asm_219_else - lda #0 -label_asm_218_afterif - beq label_asm_217_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<90 - bne label_asm_221_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>90 - bne label_asm_221_else - lda #1 - bra label_asm_220_afterif -label_asm_221_else - lda #0 -label_asm_220_afterif -label_asm_217_shortcut - beq label_asm_223_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_27 - lda #6 - bne label_asm_228_else - lda #1 - bra label_asm_227_afterif -label_asm_228_else - lda #0 -label_asm_227_afterif - beq label_asm_226_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<99 - bne label_asm_230_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>99 - bne label_asm_230_else - lda #1 - bra label_asm_229_afterif -label_asm_230_else - lda #0 -label_asm_229_afterif -label_asm_226_shortcut - beq label_asm_232_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_28 - lda #7 - bne label_asm_239_else - lda #1 - bra label_asm_238_afterif -label_asm_239_else - lda #0 -label_asm_238_afterif - beq label_asm_237_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<686 - bne label_asm_241_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>686 - bne label_asm_241_else - lda #1 - bra label_asm_240_afterif -label_asm_241_else - lda #0 -label_asm_240_afterif -label_asm_237_shortcut - beq label_asm_243_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_29 - lda #7 - bne label_asm_250_else - lda #1 - bra label_asm_249_afterif -label_asm_250_else - lda #0 -label_asm_249_afterif - beq label_asm_248_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<686 - bne label_asm_252_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>686 - bne label_asm_252_else - lda #1 - bra label_asm_251_afterif -label_asm_252_else - lda #0 -label_asm_251_afterif -label_asm_248_shortcut - beq label_asm_254_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_30 - lda #4 - bne label_asm_261_else - lda #1 - bra label_asm_260_afterif -label_asm_261_else - lda #0 -label_asm_260_afterif - beq label_asm_259_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<398 - bne label_asm_263_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>398 - bne label_asm_263_else - lda #1 - bra label_asm_262_afterif -label_asm_263_else - lda #0 -label_asm_262_afterif -label_asm_259_shortcut - beq label_asm_265_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_31 - lda #4 - bne label_asm_272_else - lda #1 - bra label_asm_271_afterif -label_asm_272_else - lda #0 -label_asm_271_afterif - beq label_asm_270_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<402 - bne label_asm_274_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>402 - bne label_asm_274_else - lda #1 - bra label_asm_273_afterif -label_asm_274_else - lda #0 -label_asm_273_afterif -label_asm_270_shortcut - beq label_asm_276_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_32 - lda #5 - bne label_asm_283_else - lda #1 - bra label_asm_282_afterif -label_asm_283_else - lda #0 -label_asm_282_afterif - beq label_asm_281_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<505 - bne label_asm_285_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>505 - bne label_asm_285_else - lda #1 - bra label_asm_284_afterif -label_asm_285_else - lda #0 -label_asm_284_afterif -label_asm_281_shortcut - beq label_asm_287_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_33 - lda #5 - bne label_asm_294_else - lda #1 - bra label_asm_293_afterif -label_asm_294_else - lda #0 -label_asm_293_afterif - beq label_asm_292_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<505 - bne label_asm_296_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>505 - bne label_asm_296_else - lda #1 - bra label_asm_295_afterif -label_asm_296_else - lda #0 -label_asm_295_afterif -label_asm_292_shortcut - beq label_asm_298_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_34 - lda #4 - bne label_asm_304_else - lda #1 - bra label_asm_303_afterif -label_asm_304_else - lda #0 -label_asm_303_afterif - beq label_asm_302_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<108 - bne label_asm_306_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>108 - bne label_asm_306_else - lda #1 - bra label_asm_305_afterif -label_asm_306_else - lda #0 -label_asm_305_afterif -label_asm_302_shortcut - beq label_asm_308_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_35 - lda #5 - bne label_asm_314_else - lda #1 - bra label_asm_313_afterif -label_asm_314_else - lda #0 -label_asm_313_afterif - beq label_asm_312_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<66 - bne label_asm_316_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>66 - bne label_asm_316_else - lda #1 - bra label_asm_315_afterif -label_asm_316_else - lda #0 -label_asm_315_afterif -label_asm_312_shortcut - beq label_asm_318_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_36 - lda #11 - bne label_asm_323_else - lda #1 - bra label_asm_322_afterif -label_asm_323_else - lda #0 -label_asm_322_afterif - beq label_asm_321_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<165 - bne label_asm_325_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>165 - bne label_asm_325_else - lda #1 - bra label_asm_324_afterif -label_asm_325_else - lda #0 -label_asm_324_afterif -label_asm_321_shortcut - beq label_asm_327_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_37 - lda #11 - bne label_asm_332_else - lda #1 - bra label_asm_331_afterif -label_asm_332_else - lda #0 -label_asm_331_afterif - beq label_asm_330_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<165 - bne label_asm_334_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>165 - bne label_asm_334_else - lda #1 - bra label_asm_333_afterif -label_asm_334_else - lda #0 -label_asm_333_afterif -label_asm_330_shortcut - beq label_asm_336_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_38 - lda #4 - bne label_asm_341_else - lda #1 - bra label_asm_340_afterif -label_asm_341_else - lda #0 -label_asm_340_afterif - beq label_asm_339_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<58 - bne label_asm_343_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>58 - bne label_asm_343_else - lda #1 - bra label_asm_342_afterif -label_asm_343_else - lda #0 -label_asm_342_afterif -label_asm_339_shortcut - beq label_asm_345_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_39 - lda #5 - bne label_asm_350_else - lda #1 - bra label_asm_349_afterif -label_asm_350_else - lda #0 -label_asm_349_afterif - beq label_asm_348_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<80 - bne label_asm_352_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>80 - bne label_asm_352_else - lda #1 - bra label_asm_351_afterif -label_asm_352_else - lda #0 -label_asm_351_afterif -label_asm_348_shortcut - beq label_asm_354_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_40 - lda #5 - bne label_asm_359_else - lda #1 - bra label_asm_358_afterif -label_asm_359_else - lda #0 -label_asm_358_afterif - beq label_asm_357_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<90 - bne label_asm_361_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>90 - bne label_asm_361_else - lda #1 - bra label_asm_360_afterif -label_asm_361_else - lda #0 -label_asm_360_afterif -label_asm_357_shortcut - beq label_asm_363_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_41 - lda #6 - bne label_asm_368_else - lda #1 - bra label_asm_367_afterif -label_asm_368_else - lda #0 -label_asm_367_afterif - beq label_asm_366_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<99 - bne label_asm_370_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>99 - bne label_asm_370_else - lda #1 - bra label_asm_369_afterif -label_asm_370_else - lda #0 -label_asm_369_afterif -label_asm_366_shortcut - beq label_asm_372_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_42 - lda #7 - bne label_asm_379_else - lda #1 - bra label_asm_378_afterif -label_asm_379_else - lda #0 -label_asm_378_afterif - beq label_asm_377_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<686 - bne label_asm_381_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>686 - bne label_asm_381_else - lda #1 - bra label_asm_380_afterif -label_asm_381_else - lda #0 -label_asm_380_afterif -label_asm_377_shortcut - beq label_asm_383_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_43 - lda #7 - bne label_asm_390_else - lda #1 - bra label_asm_389_afterif -label_asm_390_else - lda #0 -label_asm_389_afterif - beq label_asm_388_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<686 - bne label_asm_392_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>686 - bne label_asm_392_else - lda #1 - bra label_asm_391_afterif -label_asm_392_else - lda #0 -label_asm_391_afterif -label_asm_388_shortcut - beq label_asm_394_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_44 - lda #4 - bne label_asm_401_else - lda #1 - bra label_asm_400_afterif -label_asm_401_else - lda #0 -label_asm_400_afterif - beq label_asm_399_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<398 - bne label_asm_403_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>398 - bne label_asm_403_else - lda #1 - bra label_asm_402_afterif -label_asm_403_else - lda #0 -label_asm_402_afterif -label_asm_399_shortcut - beq label_asm_405_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_45 - lda #4 - bne label_asm_412_else - lda #1 - bra label_asm_411_afterif -label_asm_412_else - lda #0 -label_asm_411_afterif - beq label_asm_410_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<402 - bne label_asm_414_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>402 - bne label_asm_414_else - lda #1 - bra label_asm_413_afterif -label_asm_414_else - lda #0 -label_asm_413_afterif -label_asm_410_shortcut - beq label_asm_416_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_46 - lda #5 - bne label_asm_423_else - lda #1 - bra label_asm_422_afterif -label_asm_423_else - lda #0 -label_asm_422_afterif - beq label_asm_421_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<505 - bne label_asm_425_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>505 - bne label_asm_425_else - lda #1 - bra label_asm_424_afterif -label_asm_425_else - lda #0 -label_asm_424_afterif -label_asm_421_shortcut - beq label_asm_427_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_47 - lda #5 - bne label_asm_434_else - lda #1 - bra label_asm_433_afterif -label_asm_434_else - lda #0 -label_asm_433_afterif - beq label_asm_432_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<505 - bne label_asm_436_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>505 - bne label_asm_436_else - lda #1 - bra label_asm_435_afterif -label_asm_436_else - lda #0 -label_asm_435_afterif -label_asm_432_shortcut - beq label_asm_438_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_48 - lda #prog8_interned_strings.string_2 - sta label_asm_439_for_loop+1 - sty label_asm_439_for_loop+2 -label_asm_439_for_loop lda $ffff ; modified - beq label_asm_440_for_end - sta p8v_uw - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - inc label_asm_439_for_loop+1 - bne label_asm_439_for_loop - inc label_asm_439_for_loop+2 - bne label_asm_439_for_loop -label_asm_440_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<5 - bne label_asm_443_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>5 - bne label_asm_443_else - lda #1 - bra label_asm_442_afterif -label_asm_443_else - lda #0 -label_asm_442_afterif - beq label_asm_441_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<372 - bne label_asm_445_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>372 - bne label_asm_445_else - lda #1 - bra label_asm_444_afterif -label_asm_445_else - lda #0 -label_asm_444_afterif -label_asm_441_shortcut - beq label_asm_447_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_49 - lda #4 - bne label_asm_453_else - lda #1 - bra label_asm_452_afterif -label_asm_453_else - lda #0 -label_asm_452_afterif - beq label_asm_451_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<5998 - bne label_asm_455_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>5998 - bne label_asm_455_else - lda #1 - bra label_asm_454_afterif -label_asm_455_else - lda #0 -label_asm_454_afterif -label_asm_451_shortcut - beq label_asm_457_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_50 - lda #4 - bne label_asm_463_else - lda #1 - bra label_asm_462_afterif -label_asm_463_else - lda #0 -label_asm_462_afterif - beq label_asm_461_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<10663 - bne label_asm_465_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>10663 - bne label_asm_465_else - lda #1 - bra label_asm_464_afterif -label_asm_465_else - lda #0 -label_asm_464_afterif -label_asm_461_shortcut - beq label_asm_467_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_51 - lda #1000 - sta p8v_uw - sty p8v_uw+1 -label_asm_468_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - cmp #<1100 - bne + - lda p8v_uw+1 - cmp #>1100 - beq label_asm_469_for_end -+ inc p8v_uw - bne label_asm_468_for_loop - inc p8v_uw+1 - bra label_asm_468_for_loop -label_asm_469_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<101 - bne label_asm_472_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>101 - bne label_asm_472_else - lda #1 - bra label_asm_471_afterif -label_asm_472_else - lda #0 -label_asm_471_afterif - beq label_asm_470_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<40514 - bne label_asm_474_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>40514 - bne label_asm_474_else - lda #1 - bra label_asm_473_afterif -label_asm_474_else - lda #0 -label_asm_473_afterif -label_asm_470_shortcut - beq label_asm_476_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_52 - lda #2000 - sta p8v_uw - sty p8v_uw+1 -label_asm_477_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - cmp #<1500 - bne + - lda p8v_uw+1 - cmp #>1500 - beq label_asm_478_for_end -+ lda p8v_uw - bne + - dec p8v_uw+1 -+ dec p8v_uw - bra label_asm_477_for_loop -label_asm_478_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<501 - bne label_asm_481_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>501 - bne label_asm_481_else - lda #1 - bra label_asm_480_afterif -label_asm_481_else - lda #0 -label_asm_480_afterif - beq label_asm_479_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<24782 - bne label_asm_483_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>24782 - bne label_asm_483_else - lda #1 - bra label_asm_482_afterif -label_asm_483_else - lda #0 -label_asm_482_afterif -label_asm_479_shortcut - beq label_asm_485_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_53 - lda #1000 - sta p8v_uw - sty p8v_uw+1 -label_asm_486_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - cmp #<1999 - bne + - lda p8v_uw+1 - cmp #>1999 - bne + - beq label_asm_487_for_end -+ lda p8v_uw - clc - adc #<333 - sta p8v_uw - lda p8v_uw+1 - adc #>333 - sta p8v_uw+1 - bra label_asm_486_for_loop -label_asm_487_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<4 - bne label_asm_490_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>4 - bne label_asm_490_else - lda #1 - bra label_asm_489_afterif -label_asm_490_else - lda #0 -label_asm_489_afterif - beq label_asm_488_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<5998 - bne label_asm_492_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>5998 - bne label_asm_492_else - lda #1 - bra label_asm_491_afterif -label_asm_492_else - lda #0 -label_asm_491_afterif -label_asm_488_shortcut - beq label_asm_494_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_54 - lda #1000 - sta p8v_uw - sty p8v_uw+1 -label_asm_495_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - cmp #<2332 - bne + - lda p8v_uw+1 - cmp #>2332 - bne + - beq label_asm_496_for_end -+ lda p8v_uw - clc - adc #<333 - sta p8v_uw - lda p8v_uw+1 - adc #>333 - sta p8v_uw+1 - bra label_asm_495_for_loop -label_asm_496_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<5 - bne label_asm_499_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>5 - bne label_asm_499_else - lda #1 - bra label_asm_498_afterif -label_asm_499_else - lda #0 -label_asm_498_afterif - beq label_asm_497_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<8330 - bne label_asm_501_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>8330 - bne label_asm_501_else - lda #1 - bra label_asm_500_afterif -label_asm_501_else - lda #0 -label_asm_500_afterif -label_asm_497_shortcut - beq label_asm_503_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_55 - lda #17000 - sta p8v_uw - sty p8v_uw+1 -label_asm_504_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - cmp #<14669 - bne + - lda p8v_uw+1 - cmp #>14669 - bne + - beq label_asm_505_for_end -+ lda p8v_uw - clc - adc #<-333 - sta p8v_uw - lda p8v_uw+1 - adc #>-333 - sta p8v_uw+1 - bra label_asm_504_for_loop -label_asm_505_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<8 - bne label_asm_508_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>8 - bne label_asm_508_else - lda #1 - bra label_asm_507_afterif -label_asm_508_else - lda #0 -label_asm_507_afterif - beq label_asm_506_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<61140 - bne label_asm_510_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>61140 - bne label_asm_510_else - lda #1 - bra label_asm_509_afterif -label_asm_510_else - lda #0 -label_asm_509_afterif -label_asm_506_shortcut - beq label_asm_512_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_56 - lda #17000 - sta p8v_uw - sty p8v_uw+1 -label_asm_513_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - cmp #<14336 - bne + - lda p8v_uw+1 - cmp #>14336 - bne + - beq label_asm_514_for_end -+ lda p8v_uw - clc - adc #<-333 - sta p8v_uw - lda p8v_uw+1 - adc #>-333 - sta p8v_uw+1 - bra label_asm_513_for_loop -label_asm_514_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<9 - bne label_asm_517_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>9 - bne label_asm_517_else - lda #1 - bra label_asm_516_afterif -label_asm_517_else - lda #0 -label_asm_516_afterif - beq label_asm_515_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<9940 - bne label_asm_519_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>9940 - bne label_asm_519_else - lda #1 - bra label_asm_518_afterif -label_asm_519_else - lda #0 -label_asm_518_afterif -label_asm_515_shortcut - beq label_asm_521_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_enduw1 - sty p8v_enduw1+1 - - ldy #>prog8_interned_strings.string_57 - lda #$4074 - sta p8v_uw - sty p8v_uw+1 - - ldy p8v_enduw1+1 - lda p8v_enduw1 - cpy p8v_uw+1 - bcc label_asm_523_for_end - bne + - cmp p8v_uw - bcc label_asm_523_for_end -+ - sty label_asm_524_for_modified+1 - sta label_asm_525_for_modifiedb+1 -label_asm_522_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw+1 -label_asm_524_for_modified cmp #0 ; modified - bne + - lda p8v_uw -label_asm_525_for_modifiedb cmp #0 ; modified - beq label_asm_523_for_end -+ inc p8v_uw - bne label_asm_522_for_loop - inc p8v_uw+1 - bra label_asm_522_for_loop -label_asm_523_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<501 - bne label_asm_528_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>501 - bne label_asm_528_else - lda #1 - bra label_asm_527_afterif -label_asm_528_else - lda #0 -label_asm_527_afterif - beq label_asm_526_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<3142 - bne label_asm_530_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>3142 - bne label_asm_530_else - lda #1 - bra label_asm_529_afterif -label_asm_530_else - lda #0 -label_asm_529_afterif -label_asm_526_shortcut - beq label_asm_532_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_58 - lda #$4074 - lda #<$4074 - cpy p8v_uw+1 - beq + - bcc ++ - bcs label_asm_534_for_end -+ cmp p8v_uw - bcc + - beq + - bne label_asm_534_for_end -+ - sty label_asm_535_for_modified+1 - sta label_asm_536_for_modifiedb+1 -label_asm_533_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw+1 -label_asm_535_for_modified cmp #0 ; modified - bne + - lda p8v_uw -label_asm_536_for_modifiedb cmp #0 ; modified - beq label_asm_534_for_end -+ lda p8v_uw - bne + - dec p8v_uw+1 -+ dec p8v_uw - bra label_asm_533_for_loop -label_asm_534_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<501 - bne label_asm_539_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>501 - bne label_asm_539_else - lda #1 - bra label_asm_538_afterif -label_asm_539_else - lda #0 -label_asm_538_afterif - beq label_asm_537_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<3142 - bne label_asm_541_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>3142 - bne label_asm_541_else - lda #1 - bra label_asm_540_afterif -label_asm_541_else - lda #0 -label_asm_540_afterif -label_asm_537_shortcut - beq label_asm_543_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_enduw1 - sty p8v_enduw1+1 - - ldy #>prog8_interned_strings.string_59 - lda #$38a4 - sta p8v_uw - sty p8v_uw+1 - - ldy p8v_enduw1+1 - lda p8v_enduw1 - cpy p8v_uw+1 - bcc label_asm_545_for_end - bne + - cmp p8v_uw - bcc label_asm_545_for_end -+ - sty label_asm_546_for_modified+1 - sta label_asm_547_for_modifiedb+1 -label_asm_544_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - clc - adc #<333 - sta p8v_uw - lda p8v_uw+1 - adc #>333 - sta p8v_uw+1 -label_asm_546_for_modified cmp #0 ; modified - bcc label_asm_544_for_loop - bne label_asm_545_for_end -label_asm_547_for_modifiedb lda #0 ; modified - cmp p8v_uw - bcc label_asm_545_for_end - bcs label_asm_544_for_loop -label_asm_545_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<8 - bne label_asm_550_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>8 - bne label_asm_550_else - lda #1 - bra label_asm_549_afterif -label_asm_550_else - lda #0 -label_asm_549_afterif - beq label_asm_548_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<59788 - bne label_asm_552_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>59788 - bne label_asm_552_else - lda #1 - bra label_asm_551_afterif -label_asm_552_else - lda #0 -label_asm_551_afterif -label_asm_548_shortcut - beq label_asm_554_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_enduw1 - sty p8v_enduw1+1 - - ldy #>prog8_interned_strings.string_60 - lda #$38a4 - lda #<$38a4 - cpy p8v_uw+1 - beq + - bcc ++ - bcs label_asm_556_for_end -+ cmp p8v_uw - bcc + - beq + - bne label_asm_556_for_end -+ - sty label_asm_557_for_modified+1 - sta label_asm_558_for_modifiedb+1 -label_asm_555_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - sec - sbc #<333 - sta p8v_uw - tax - lda p8v_uw+1 - sbc #>333 - sta p8v_uw+1 - txa -label_asm_558_for_modifiedb cmp #0 ; modified - lda p8v_uw+1 -label_asm_557_for_modified sbc #0 ; modified - bvc + - eor #$80 -+ bpl label_asm_555_for_loop -label_asm_556_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<8 - bne label_asm_561_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>8 - bne label_asm_561_else - lda #1 - bra label_asm_560_afterif -label_asm_561_else - lda #0 -label_asm_560_afterif - beq label_asm_559_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<61140 - bne label_asm_563_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>61140 - bne label_asm_563_else - lda #1 - bra label_asm_562_afterif -label_asm_563_else - lda #0 -label_asm_562_afterif -label_asm_559_shortcut - beq label_asm_565_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$430c - sta p8v_enduw1 - sty p8v_enduw1+1 - - ldy #>prog8_interned_strings.string_61 - lda #$38a4 - sta p8v_uw - sty p8v_uw+1 - - ldy p8v_enduw1+1 - lda p8v_enduw1 - cpy p8v_uw+1 - bcc label_asm_567_for_end - bne + - cmp p8v_uw - bcc label_asm_567_for_end -+ - sty label_asm_568_for_modified+1 - sta label_asm_569_for_modifiedb+1 -label_asm_566_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - clc - adc #<333 - sta p8v_uw - lda p8v_uw+1 - adc #>333 - sta p8v_uw+1 -label_asm_568_for_modified cmp #0 ; modified - bcc label_asm_566_for_loop - bne label_asm_567_for_end -label_asm_569_for_modifiedb lda #0 ; modified - cmp p8v_uw - bcc label_asm_567_for_end - bcs label_asm_566_for_loop -label_asm_567_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<9 - bne label_asm_572_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>9 - bne label_asm_572_else - lda #1 - bra label_asm_571_afterif -label_asm_572_else - lda #0 -label_asm_571_afterif - beq label_asm_570_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<11416 - bne label_asm_574_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>11416 - bne label_asm_574_else - lda #1 - bra label_asm_573_afterif -label_asm_574_else - lda #0 -label_asm_573_afterif -label_asm_570_shortcut - beq label_asm_576_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_enduw1 - sty p8v_enduw1+1 - - ldy #>prog8_interned_strings.string_62 - lda #$3800 - lda #<$3800 - cpy p8v_uw+1 - beq + - bcc ++ - bcs label_asm_578_for_end -+ cmp p8v_uw - bcc + - beq + - bne label_asm_578_for_end -+ - sty label_asm_579_for_modified+1 - sta label_asm_580_for_modifiedb+1 -label_asm_577_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_totaluw - clc - adc p8v_uw - sta p8v_totaluw - lda p8v_totaluw+1 - adc p8v_uw+1 - sta p8v_totaluw+1 - lda p8v_uw - sec - sbc #<333 - sta p8v_uw - tax - lda p8v_uw+1 - sbc #>333 - sta p8v_uw+1 - txa -label_asm_580_for_modifiedb cmp #0 ; modified - lda p8v_uw+1 -label_asm_579_for_modified sbc #0 ; modified - bvc + - eor #$80 -+ bpl label_asm_577_for_loop -label_asm_578_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<9 - bne label_asm_583_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>9 - bne label_asm_583_else - lda #1 - bra label_asm_582_afterif -label_asm_583_else - lda #0 -label_asm_582_afterif - beq label_asm_581_shortcut - lda p8b_main.p8s_start.p8v_totaluw - cmp #<9940 - bne label_asm_585_else - lda p8b_main.p8s_start.p8v_totaluw+1 - cmp #>9940 - bne label_asm_585_else - lda #1 - bra label_asm_584_afterif -label_asm_585_else - lda #0 -label_asm_584_afterif -label_asm_581_shortcut - beq label_asm_587_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_63 - lda #4 - bne label_asm_593_else - lda #1 - bra label_asm_592_afterif -label_asm_593_else - lda #0 -label_asm_592_afterif - beq label_asm_591_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<5998 - bne label_asm_595_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>5998 - bne label_asm_595_else - lda #1 - bra label_asm_594_afterif -label_asm_595_else - lda #0 -label_asm_594_afterif -label_asm_591_shortcut - beq label_asm_597_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_64 - lda #4 - bne label_asm_603_else - lda #1 - bra label_asm_602_afterif -label_asm_603_else - lda #0 -label_asm_602_afterif - beq label_asm_601_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<222 - bne label_asm_605_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>222 - bne label_asm_605_else - lda #1 - bra label_asm_604_afterif -label_asm_605_else - lda #0 -label_asm_604_afterif -label_asm_601_shortcut - beq label_asm_607_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_65 - lda #-100 - sta p8v_ww - sty p8v_ww+1 -label_asm_608_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - cmp #<1000 - bne + - lda p8v_ww+1 - cmp #>1000 - beq label_asm_609_for_end -+ inc p8v_ww - bne label_asm_608_for_loop - inc p8v_ww+1 - bra label_asm_608_for_loop -label_asm_609_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<1101 - bne label_asm_612_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>1101 - bne label_asm_612_else - lda #1 - bra label_asm_611_afterif -label_asm_612_else - lda #0 -label_asm_611_afterif - beq label_asm_610_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<-28838 - bne label_asm_614_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>-28838 - bne label_asm_614_else - lda #1 - bra label_asm_613_afterif -label_asm_614_else - lda #0 -label_asm_613_afterif -label_asm_610_shortcut - beq label_asm_616_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_66 - lda #1000 - sta p8v_ww - sty p8v_ww+1 -label_asm_617_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - cmp #<-500 - bne + - lda p8v_ww+1 - cmp #>-500 - beq label_asm_618_for_end -+ lda p8v_ww - bne + - dec p8v_ww+1 -+ dec p8v_ww - bra label_asm_617_for_loop -label_asm_618_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<1501 - bne label_asm_621_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>1501 - bne label_asm_621_else - lda #1 - bra label_asm_620_afterif -label_asm_621_else - lda #0 -label_asm_620_afterif - beq label_asm_619_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<-17966 - bne label_asm_623_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>-17966 - bne label_asm_623_else - lda #1 - bra label_asm_622_afterif -label_asm_623_else - lda #0 -label_asm_622_afterif -label_asm_619_shortcut - beq label_asm_625_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_67 - lda #-1000 - sta p8v_ww - sty p8v_ww+1 -label_asm_626_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - cmp #<1997 - bne + - lda p8v_ww+1 - cmp #>1997 - bne + - beq label_asm_627_for_end -+ lda p8v_ww - clc - adc #<333 - sta p8v_ww - lda p8v_ww+1 - adc #>333 - sta p8v_ww+1 - bra label_asm_626_for_loop -label_asm_627_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<10 - bne label_asm_630_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>10 - bne label_asm_630_else - lda #1 - bra label_asm_629_afterif -label_asm_630_else - lda #0 -label_asm_629_afterif - beq label_asm_628_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<4985 - bne label_asm_632_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>4985 - bne label_asm_632_else - lda #1 - bra label_asm_631_afterif -label_asm_632_else - lda #0 -label_asm_631_afterif -label_asm_628_shortcut - beq label_asm_634_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_68 - lda #-1000 - sta p8v_ww - sty p8v_ww+1 -label_asm_635_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - cmp #<2330 - bne + - lda p8v_ww+1 - cmp #>2330 - bne + - beq label_asm_636_for_end -+ lda p8v_ww - clc - adc #<333 - sta p8v_ww - lda p8v_ww+1 - adc #>333 - sta p8v_ww+1 - bra label_asm_635_for_loop -label_asm_636_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<11 - bne label_asm_639_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>11 - bne label_asm_639_else - lda #1 - bra label_asm_638_afterif -label_asm_639_else - lda #0 -label_asm_638_afterif - beq label_asm_637_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<7315 - bne label_asm_641_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>7315 - bne label_asm_641_else - lda #1 - bra label_asm_640_afterif -label_asm_641_else - lda #0 -label_asm_640_afterif -label_asm_637_shortcut - beq label_asm_643_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_69 - lda #2000 - sta p8v_ww - sty p8v_ww+1 -label_asm_644_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - cmp #<-2329 - bne + - lda p8v_ww+1 - cmp #>-2329 - bne + - beq label_asm_645_for_end -+ lda p8v_ww - clc - adc #<-333 - sta p8v_ww - lda p8v_ww+1 - adc #>-333 - sta p8v_ww+1 - bra label_asm_644_for_loop -label_asm_645_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<14 - bne label_asm_648_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>14 - bne label_asm_648_else - lda #1 - bra label_asm_647_afterif -label_asm_648_else - lda #0 -label_asm_647_afterif - beq label_asm_646_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<-2303 - bne label_asm_650_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>-2303 - bne label_asm_650_else - lda #1 - bra label_asm_649_afterif -label_asm_650_else - lda #0 -label_asm_649_afterif -label_asm_646_shortcut - beq label_asm_652_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_70 - lda #2000 - sta p8v_ww - sty p8v_ww+1 -label_asm_653_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - cmp #<-2662 - bne + - lda p8v_ww+1 - cmp #>-2662 - bne + - beq label_asm_654_for_end -+ lda p8v_ww - clc - adc #<-333 - sta p8v_ww - lda p8v_ww+1 - adc #>-333 - sta p8v_ww+1 - bra label_asm_653_for_loop -label_asm_654_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<15 - bne label_asm_657_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>15 - bne label_asm_657_else - lda #1 - bra label_asm_656_afterif -label_asm_657_else - lda #0 -label_asm_656_afterif - beq label_asm_655_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<-4965 - bne label_asm_659_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>-4965 - bne label_asm_659_else - lda #1 - bra label_asm_658_afterif -label_asm_659_else - lda #0 -label_asm_658_afterif -label_asm_655_shortcut - beq label_asm_661_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_endw1 - sty p8v_endw1+1 - - ldy #>prog8_interned_strings.string_71 - lda #$4074 - sta p8v_ww - sty p8v_ww+1 - - ldy p8v_endw1+1 - lda p8v_endw1 - sta P8ZP_SCRATCH_REG - cmp p8v_ww - tya - sbc p8v_ww+1 - bvc + - eor #$80 -+ bmi label_asm_663_for_end - lda P8ZP_SCRATCH_REG - sty label_asm_664_for_modified+1 - sta label_asm_665_for_modifiedb+1 -label_asm_662_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww+1 -label_asm_664_for_modified cmp #0 ; modified - bne + - lda p8v_ww -label_asm_665_for_modifiedb cmp #0 ; modified - beq label_asm_663_for_end -+ inc p8v_ww - bne label_asm_662_for_loop - inc p8v_ww+1 - bra label_asm_662_for_loop -label_asm_663_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<501 - bne label_asm_668_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>501 - bne label_asm_668_else - lda #1 - bra label_asm_667_afterif -label_asm_668_else - lda #0 -label_asm_667_afterif - beq label_asm_666_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<3142 - bne label_asm_670_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>3142 - bne label_asm_670_else - lda #1 - bra label_asm_669_afterif -label_asm_670_else - lda #0 -label_asm_669_afterif -label_asm_666_shortcut - beq label_asm_672_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_72 - lda #$4074 - lda #<$4074 - sta P8ZP_SCRATCH_W2 ; to - sty P8ZP_SCRATCH_W2+1 ; to - lda p8v_ww - cmp P8ZP_SCRATCH_W2 - lda p8v_ww+1 - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi label_asm_674_for_end - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sty label_asm_675_for_modified+1 - sta label_asm_676_for_modifiedb+1 -label_asm_673_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww+1 -label_asm_675_for_modified cmp #0 ; modified - bne + - lda p8v_ww -label_asm_676_for_modifiedb cmp #0 ; modified - beq label_asm_674_for_end -+ lda p8v_ww - bne + - dec p8v_ww+1 -+ dec p8v_ww - bra label_asm_673_for_loop -label_asm_674_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<501 - bne label_asm_679_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>501 - bne label_asm_679_else - lda #1 - bra label_asm_678_afterif -label_asm_679_else - lda #0 -label_asm_678_afterif - beq label_asm_677_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<3142 - bne label_asm_681_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>3142 - bne label_asm_681_else - lda #1 - bra label_asm_680_afterif -label_asm_681_else - lda #0 -label_asm_680_afterif -label_asm_677_shortcut - beq label_asm_683_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_endw1 - sty p8v_endw1+1 - - ldy #>prog8_interned_strings.string_73 - lda #$38a4 - sta p8v_ww - sty p8v_ww+1 - - ldy p8v_endw1+1 - lda p8v_endw1 - sta P8ZP_SCRATCH_REG - cmp p8v_ww - tya - sbc p8v_ww+1 - bvc + - eor #$80 -+ bmi label_asm_685_for_end - lda P8ZP_SCRATCH_REG - sty label_asm_686_for_modified+1 - sta label_asm_687_for_modifiedb+1 -label_asm_684_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - clc - adc #<333 - sta p8v_ww - lda p8v_ww+1 - adc #>333 - sta p8v_ww+1 -label_asm_687_for_modifiedb lda #0 ; modified - cmp p8v_ww -label_asm_686_for_modified lda #0 ; modified - sbc p8v_ww+1 - bvc + - eor #$80 -+ bpl label_asm_684_for_loop -label_asm_685_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<8 - bne label_asm_690_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>8 - bne label_asm_690_else - lda #1 - bra label_asm_689_afterif -label_asm_690_else - lda #0 -label_asm_689_afterif - beq label_asm_688_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<-5748 - bne label_asm_692_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>-5748 - bne label_asm_692_else - lda #1 - bra label_asm_691_afterif -label_asm_692_else - lda #0 -label_asm_691_afterif -label_asm_688_shortcut - beq label_asm_694_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_endw1 - sty p8v_endw1+1 - - ldy #>prog8_interned_strings.string_74 - lda #$38a4 - lda #<$38a4 - sta P8ZP_SCRATCH_W2 ; to - sty P8ZP_SCRATCH_W2+1 ; to - lda p8v_ww - cmp P8ZP_SCRATCH_W2 - lda p8v_ww+1 - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi label_asm_696_for_end - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sty label_asm_697_for_modified+1 - sta label_asm_698_for_modifiedb+1 -label_asm_695_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - sec - sbc #<333 - sta p8v_ww - tax - lda p8v_ww+1 - sbc #>333 - sta p8v_ww+1 - txa -label_asm_698_for_modifiedb cmp #0 ; modified - lda p8v_ww+1 -label_asm_697_for_modified sbc #0 ; modified - bvc + - eor #$80 -+ bpl label_asm_695_for_loop -label_asm_696_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<8 - bne label_asm_701_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>8 - bne label_asm_701_else - lda #1 - bra label_asm_700_afterif -label_asm_701_else - lda #0 -label_asm_700_afterif - beq label_asm_699_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<-4396 - bne label_asm_703_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>-4396 - bne label_asm_703_else - lda #1 - bra label_asm_702_afterif -label_asm_703_else - lda #0 -label_asm_702_afterif -label_asm_699_shortcut - beq label_asm_705_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$430c - sta p8v_endw1 - sty p8v_endw1+1 - - ldy #>prog8_interned_strings.string_75 - lda #$38a4 - sta p8v_ww - sty p8v_ww+1 - - ldy p8v_endw1+1 - lda p8v_endw1 - sta P8ZP_SCRATCH_REG - cmp p8v_ww - tya - sbc p8v_ww+1 - bvc + - eor #$80 -+ bmi label_asm_707_for_end - lda P8ZP_SCRATCH_REG - sty label_asm_708_for_modified+1 - sta label_asm_709_for_modifiedb+1 -label_asm_706_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - clc - adc #<333 - sta p8v_ww - lda p8v_ww+1 - adc #>333 - sta p8v_ww+1 -label_asm_709_for_modifiedb lda #0 ; modified - cmp p8v_ww -label_asm_708_for_modified lda #0 ; modified - sbc p8v_ww+1 - bvc + - eor #$80 -+ bpl label_asm_706_for_loop -label_asm_707_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<9 - bne label_asm_712_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>9 - bne label_asm_712_else - lda #1 - bra label_asm_711_afterif -label_asm_712_else - lda #0 -label_asm_711_afterif - beq label_asm_710_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<11416 - bne label_asm_714_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>11416 - bne label_asm_714_else - lda #1 - bra label_asm_713_afterif -label_asm_714_else - lda #0 -label_asm_713_afterif -label_asm_710_shortcut - beq label_asm_716_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$4268 - sta p8v_endw1 - sty p8v_endw1+1 - - ldy #>prog8_interned_strings.string_76 - lda #$3800 - lda #<$3800 - sta P8ZP_SCRATCH_W2 ; to - sty P8ZP_SCRATCH_W2+1 ; to - lda p8v_ww - cmp P8ZP_SCRATCH_W2 - lda p8v_ww+1 - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi label_asm_718_for_end - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sty label_asm_719_for_modified+1 - sta label_asm_720_for_modifiedb+1 -label_asm_717_for_loop - inc p8v_count - bne + - inc p8v_count+1 -+ - lda p8v_total - clc - adc p8v_ww - sta p8v_total - lda p8v_total+1 - adc p8v_ww+1 - sta p8v_total+1 - lda p8v_ww - sec - sbc #<333 - sta p8v_ww - tax - lda p8v_ww+1 - sbc #>333 - sta p8v_ww+1 - txa -label_asm_720_for_modifiedb cmp #0 ; modified - lda p8v_ww+1 -label_asm_719_for_modified sbc #0 ; modified - bvc + - eor #$80 -+ bpl label_asm_717_for_loop -label_asm_718_for_end - lda p8b_main.p8s_start.p8v_count - cmp #<9 - bne label_asm_723_else - lda p8b_main.p8s_start.p8v_count+1 - cmp #>9 - bne label_asm_723_else - lda #1 - bra label_asm_722_afterif -label_asm_723_else - lda #0 -label_asm_722_afterif - beq label_asm_721_shortcut - lda p8b_main.p8s_start.p8v_total - cmp #<9940 - bne label_asm_725_else - lda p8b_main.p8s_start.p8v_total+1 - cmp #>9940 - bne label_asm_725_else - lda #1 - bra label_asm_724_afterif -label_asm_725_else - lda #0 -label_asm_724_afterif -label_asm_721_shortcut - beq label_asm_727_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_77 - lda #p8b_main.p8s_wait_input.p8v_input - lda #VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - - - -test .proc - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/testrepeat.asm b/compiler/test/arithmetic/testrepeat.asm deleted file mode 100644 index 1fd3def27..000000000 --- a/compiler/test/arithmetic/testrepeat.asm +++ /dev/null @@ -1,5299 +0,0 @@ -; w65c02 assembly code for 'testrepeat' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:58 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -p8v_amount = 34 ; zp UWORD - p8c_hundred = $64 - p8c_maximum = $ffff - p8c_one = 1 - p8c_thousand = $03e8 - p8c_two55 = $ff - p8c_two56 = $0100 - p8c_two57 = $0101 - p8c_zero = 0 -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - stz p8v_amount - stz p8v_amount+1 - ldy #>prog8_interned_strings.string_1 - lda #257 - lda #<257 - beq + - iny -+ sta label_asm_10_counter - sty label_asm_10_counter+1 -label_asm_9_repeat - inc p8v_amount - bne + - inc p8v_amount+1 -+ - dec label_asm_10_counter - bne label_asm_9_repeat - dec label_asm_10_counter+1 - bne label_asm_9_repeat - ldy p8v_amount+1 - lda p8v_amount - jsr txt.print_uw - lda #13 - jsr txt.chrout - stz p8v_amount - stz p8v_amount+1 - ldy #>1000 - lda #<1000 - beq + - iny -+ sta label_asm_10_counter - sty label_asm_10_counter+1 -label_asm_12_repeat - inc p8v_amount - bne + - inc p8v_amount+1 -+ - dec label_asm_10_counter - bne label_asm_12_repeat - dec label_asm_10_counter+1 - bne label_asm_12_repeat - ldy p8v_amount+1 - lda p8v_amount - jsr txt.print_uw - lda #13 - jsr txt.chrout - stz p8v_amount - stz p8v_amount+1 - ldy #>65535 - lda #<65535 - beq + - iny -+ sta label_asm_10_counter - sty label_asm_10_counter+1 -label_asm_14_repeat - inc p8v_amount - bne + - inc p8v_amount+1 -+ - dec label_asm_10_counter - bne label_asm_14_repeat - dec label_asm_10_counter+1 - bne label_asm_14_repeat - ldy p8v_amount+1 - lda p8v_amount - jsr txt.print_uw - lda #13 - jmp txt.chrout -; variables - .section BSS -label_asm_3_counter = 36 -label_asm_10_counter = 37 - .send BSS - - .pend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"expected:\n 0, 1, 100, 255, 256, 257, 1000, 65535\n\n" - .byte $45, $58, $50, $45, $43, $54, $45, $44, $3a, $0d, $20, $30, $2c, $20, $31, $2c - .byte $20, $31, $30, $30, $2c, $20, $32, $35, $35, $2c, $20, $32, $35, $36, $2c, $20 - .byte $32, $35, $37, $2c, $20, $31, $30, $30, $30, $2c, $20, $36, $35, $35, $33, $35 - .byte $0d, $0d, $00 - - .pend - -; ---- block: 'txt' ---- -txt .proc - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - -column .proc - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - -get_column .proc - sec - jmp cbm.PLOT - .pend - -row .proc - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - -get_row .proc - sec - jmp cbm.PLOT - .pend - -fill_screen .proc - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/arithmetic/wordbyte.asm b/compiler/test/arithmetic/wordbyte.asm deleted file mode 100644 index 13e63b1bd..000000000 --- a/compiler/test/arithmetic/wordbyte.asm +++ /dev/null @@ -1,6308 +0,0 @@ -; w65c02 assembly code for 'wordbyte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:13:58 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - - - -p8s_start .proc -p8v_wsum = 34 ; zp WORD -p8v_uwsum = 36 ; zp UWORD -p8v_ub = 38 ; zp UBYTE -p8v_bb = 39 ; zp BYTE -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - lda #25 - sta label_asm_3_counter -label_asm_2_repeat - lda #13 - jsr txt.chrout - dec label_asm_3_counter - bne label_asm_2_repeat - stz p8v_ub - stz p8v_bb - stz p8v_uwsum - stz p8v_uwsum+1 - stz p8v_wsum - stz p8v_wsum+1 - lda #<$c350 - ldy #>$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda #$32 - sta p8v_ub - lda p8v_uwsum - clc - adc p8v_ub - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda #$fa - sta p8v_ub - lda p8v_uwsum - clc - adc p8v_ub - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<50300 - bne label_asm_5_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>50300 - bne label_asm_5_else - ldy #>prog8_interned_strings.string_1 - lda #prog8_interned_strings.string_2 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda #$64 - sta p8v_bb - ldy #0 - lda p8v_bb - bpl + - dey ; sign extend -+ clc - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda #-$32 - sta p8v_bb - ldy #0 - lda p8v_bb - bpl + - dey ; sign extend -+ clc - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda p8b_main.p8s_start.p8v_wsum - cmp #<-29950 - bne label_asm_7_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-29950 - bne label_asm_7_else - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda #$32 - sta p8v_ub - lda p8v_uwsum - sec - sbc p8v_ub - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda #$fa - sta p8v_ub - lda p8v_uwsum - sec - sbc p8v_ub - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49700 - bne label_asm_9_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49700 - bne label_asm_9_else - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda #$64 - sta p8v_bb - ldy #255 - lda p8v_bb - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda #-$32 - sta p8v_bb - ldy #255 - lda p8v_bb - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda p8b_main.p8s_start.p8v_wsum - cmp #<-30050 - bne label_asm_11_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-30050 - bne label_asm_11_else - ldy #>prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda #$32 - sta p8v_bb - ldy #0 - lda p8v_bb - bpl + - dey ; sign extend -+ clc - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda #-$64 - sta p8v_bb - ldy #0 - lda p8v_bb - bpl + - dey ; sign extend -+ clc - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49950 - bne label_asm_13_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49950 - bne label_asm_13_else - ldy #>prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda #$32 - sta p8v_bb - ldy #255 - lda p8v_bb - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda #$64 - sta p8v_bb - ldy #255 - lda p8v_bb - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49850 - bne label_asm_15_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49850 - bne label_asm_15_else - ldy #>prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_12 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda #$32 - sta p8v_ub - lda p8v_wsum - clc - adc p8v_ub - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda #$fa - sta p8v_ub - lda p8v_wsum - clc - adc p8v_ub - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-29700 - bne label_asm_17_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-29700 - bne label_asm_17_else - ldy #>prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda #$32 - sta p8v_ub - lda p8v_wsum - sec - sbc p8v_ub - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda #$fa - sta p8v_ub - lda p8v_wsum - sec - sbc p8v_ub - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-30300 - bne label_asm_19_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-30300 - bne label_asm_19_else - ldy #>prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - stz p8v_ub - lda p8v_ub - clc - adc #$32 - clc - adc p8v_uwsum - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda p8v_ub - clc - adc #$fa - clc - adc p8v_uwsum - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<50300 - bne label_asm_21_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>50300 - bne label_asm_21_else - ldy #>prog8_interned_strings.string_17 - lda #prog8_interned_strings.string_18 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda p8v_bb - clc - adc #$64 - ldy #0 - cmp #0 - bpl + - dey ; sign extend -+ clc - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda p8v_bb - sec - sbc #$32 - ldy #0 - cmp #0 - bpl + - dey ; sign extend -+ clc - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda p8b_main.p8s_start.p8v_wsum - cmp #<-29950 - bne label_asm_23_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-29950 - bne label_asm_23_else - ldy #>prog8_interned_strings.string_19 - lda #prog8_interned_strings.string_20 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda p8v_ub - clc - adc #$32 - sta P8ZP_SCRATCH_B1 - lda p8v_uwsum - sec - sbc P8ZP_SCRATCH_B1 - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8v_ub - clc - adc #$fa - sta P8ZP_SCRATCH_B1 - lda p8v_uwsum - sec - sbc P8ZP_SCRATCH_B1 - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49700 - bne label_asm_25_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49700 - bne label_asm_25_else - ldy #>prog8_interned_strings.string_21 - lda #prog8_interned_strings.string_22 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda p8v_bb - clc - adc #$64 - sta P8ZP_SCRATCH_B1 - ldy #255 - lda P8ZP_SCRATCH_B1 - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda p8v_bb - sec - sbc #$32 - sta P8ZP_SCRATCH_B1 - ldy #255 - lda P8ZP_SCRATCH_B1 - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_wsum - sta p8v_wsum - tya - adc p8v_wsum+1 - sta p8v_wsum+1 - lda p8b_main.p8s_start.p8v_wsum - cmp #<-30050 - bne label_asm_27_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-30050 - bne label_asm_27_else - ldy #>prog8_interned_strings.string_23 - lda #prog8_interned_strings.string_24 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda p8v_bb - clc - adc #$32 - ldy #0 - cmp #0 - bpl + - dey ; sign extend -+ clc - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda p8v_bb - sec - sbc #$64 - ldy #0 - cmp #0 - bpl + - dey ; sign extend -+ clc - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49950 - bne label_asm_29_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49950 - bne label_asm_29_else - ldy #>prog8_interned_strings.string_25 - lda #prog8_interned_strings.string_26 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - lda p8v_bb - clc - adc #$32 - sta P8ZP_SCRATCH_B1 - ldy #255 - lda P8ZP_SCRATCH_B1 - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda p8v_bb - clc - adc #$64 - sta P8ZP_SCRATCH_B1 - ldy #255 - lda P8ZP_SCRATCH_B1 - bpl + - iny ; sign extend -+ eor #255 - sec - adc p8v_uwsum - sta p8v_uwsum - tya - adc p8v_uwsum+1 - sta p8v_uwsum+1 - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49850 - bne label_asm_31_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49850 - bne label_asm_31_else - ldy #>prog8_interned_strings.string_27 - lda #prog8_interned_strings.string_28 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda p8v_ub - clc - adc #$32 - clc - adc p8v_wsum - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8v_ub - clc - adc #$fa - clc - adc p8v_wsum - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-29700 - bne label_asm_33_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-29700 - bne label_asm_33_else - ldy #>prog8_interned_strings.string_29 - lda #prog8_interned_strings.string_30 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - lda p8v_ub - clc - adc #$32 - sta P8ZP_SCRATCH_B1 - lda p8v_wsum - sec - sbc P8ZP_SCRATCH_B1 - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8v_ub - clc - adc #$fa - sta P8ZP_SCRATCH_B1 - lda p8v_wsum - sec - sbc P8ZP_SCRATCH_B1 - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-30300 - bne label_asm_35_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-30300 - bne label_asm_35_else - ldy #>prog8_interned_strings.string_31 - lda #prog8_interned_strings.string_32 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - clc - adc #50 - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda p8v_uwsum - clc - adc #250 - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<50300 - bne label_asm_37_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>50300 - bne label_asm_37_else - ldy #>prog8_interned_strings.string_33 - lda #prog8_interned_strings.string_34 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - clc - adc #100 - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8v_wsum - sec - sbc #50 - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-29950 - bne label_asm_39_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-29950 - bne label_asm_39_else - ldy #>prog8_interned_strings.string_35 - lda #prog8_interned_strings.string_36 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - sec - sbc #50 - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8v_uwsum - sec - sbc #250 - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49700 - bne label_asm_41_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49700 - bne label_asm_41_else - ldy #>prog8_interned_strings.string_37 - lda #prog8_interned_strings.string_38 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - sec - sbc #100 - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8v_wsum - clc - adc #50 - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-30050 - bne label_asm_43_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-30050 - bne label_asm_43_else - ldy #>prog8_interned_strings.string_39 - lda #prog8_interned_strings.string_40 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - clc - adc #50 - sta p8v_uwsum - bcc + - inc p8v_uwsum+1 -+ - lda p8v_uwsum - clc - adc #<65436 - sta p8v_uwsum - lda p8v_uwsum+1 - adc #>65436 - sta p8v_uwsum+1 - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49950 - bne label_asm_45_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49950 - bne label_asm_45_else - ldy #>prog8_interned_strings.string_41 - lda #prog8_interned_strings.string_42 - lda #$c350 - sta p8v_uwsum - sty p8v_uwsum+1 - - sec - sbc #50 - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8v_uwsum - sec - sbc #100 - sta p8v_uwsum - bcs + - dec p8v_uwsum+1 -+ - lda p8b_main.p8s_start.p8v_uwsum - cmp #<49850 - bne label_asm_47_else - lda p8b_main.p8s_start.p8v_uwsum+1 - cmp #>49850 - bne label_asm_47_else - ldy #>prog8_interned_strings.string_43 - lda #prog8_interned_strings.string_44 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - clc - adc #50 - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8v_wsum - clc - adc #250 - sta p8v_wsum - bcc + - inc p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-29700 - bne label_asm_49_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-29700 - bne label_asm_49_else - ldy #>prog8_interned_strings.string_45 - lda #prog8_interned_strings.string_46 - lda #-$7530 - sta p8v_wsum - sty p8v_wsum+1 - - sec - sbc #50 - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8v_wsum - sec - sbc #250 - sta p8v_wsum - bcs + - dec p8v_wsum+1 -+ - lda p8b_main.p8s_start.p8v_wsum - cmp #<-30300 - bne label_asm_51_else - lda p8b_main.p8s_start.p8v_wsum+1 - cmp #>-30300 - bne label_asm_51_else - ldy #>prog8_interned_strings.string_47 - lda #prog8_interned_strings.string_48 - lda #VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - -clear_screenchars .proc - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -clear_screencolors .proc - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - -scroll_left .proc - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_right .proc - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_up .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - -scroll_down .proc - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - - -print .proc - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_ub0 .proc - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - -print_ub .proc - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - -print_b .proc - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - -print_ubhex .proc - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - -print_ubbin .proc - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - -print_uwbin .proc - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - -print_uwhex .proc - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - -print_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - -print_uw .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - -print_w .proc - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - -input_chars .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - -setchr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getchr .proc - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -setclr .proc - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - -getclr .proc - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - -plot .proc - clc - jmp cbm.PLOT - .pend - -width .proc - jsr cbm.SCREEN - txa - rts - .pend - -height .proc - jsr cbm.SCREEN - tya - rts - .pend - -waitkey .proc -- jsr cbm.GETIN - beq - - rts - .pend - -petscii2scr .proc - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - -petscii2scr_str .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -STOP2 .proc - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -RDTIM16 .proc - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set_screen_mode .proc - clc - jmp screen_mode - .pend - -get_screen_mode .proc - sec - jmp screen_mode - .pend - -kbdbuf_clear .proc -- jsr cbm.GETIN - bne - - rts - .pend - -mouse_config2 .proc - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - -mouse_pos .proc - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - -numbanks .proc - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - -vpeek .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - -vaddr .proc - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - -vaddr_clone .proc - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - -vaddr_autoincr .proc - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - -vaddr_autodecr .proc - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - -vpoke .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - -vpoke_or .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_and .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_xor .proc - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - -vpoke_mask .proc - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - -save_virtual_registers .proc - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - -restore_virtual_registers .proc - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - -save_vera_context .proc - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - -restore_vera_context .proc - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - -set_chrin_keyhandler .proc - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - -get_chrin_keyhandler .proc - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - -enable_irq_handlers .proc - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - -set_vsync_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_line_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_sprcol_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - -set_aflow_irq_handler .proc - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - -cpu_is_65816 .proc - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - -get_program_args .proc - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - target = $10 - - - -init_system .proc - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - -init_system_phase2 .proc - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - -cleanup_at_exit .proc - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - -set_irq .proc - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - -restore_irq .proc - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - -set_rasterirq .proc - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - -set_rasterline .proc - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - -reset_system .proc - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - -wait .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - -internal_stringcopy .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - -memcopy .proc - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - -memset .proc - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - -memsetw .proc - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - -save_prog8_internals .proc - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - -restore_prog8_internals .proc - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - -exit .proc - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit2 .proc - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - -exit3 .proc - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - .pend - -; ---- block: 'conv' ---- -conv .proc - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - -str_ub0 .proc - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - -str_ub .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - -str_b .proc - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - -str_ubhex .proc - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - -str_ubbin .proc - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwbin .proc - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - -str_uwhex .proc - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - -str_uw0 .proc - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - -str_uw .proc - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - -str_w .proc - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - -any2uword .proc - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - -str2uword .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - -str2word .proc -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - -hex2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - -bin2uword .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -ubyte2decimal .proc - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - -uword2decimal .proc -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - -byte2decimal .proc - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - -ubyte2hex .proc - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - -uword2hex .proc - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - - -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - -sin8u .proc - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8u .proc - tay - lda sin8u._sinecos8u+64,y - rts - .pend - -sin8 .proc - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - -cos8 .proc - tay - lda sin8._sinecos8+64,y - rts - .pend - -sinr8u .proc - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8u .proc - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - -sinr8 .proc - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - -cosr8 .proc - tay - lda sinr8._sinecosR8+45,y - rts - .pend - -rnd .proc - jmp math.randbyte - .pend - -rndw .proc - jmp math.randword - .pend - -rndseed .proc - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - -log2 .proc - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - -log2w .proc - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - -mul16_last_upper .proc - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - -direction_qd .proc -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - -atan2 .proc -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - -diff .proc - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - -diffw .proc - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - - -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/more_compares.asm b/compiler/test/comparisons/more_compares.asm deleted file mode 100644 index 5f53169af..000000000 --- a/compiler/test/comparisons/more_compares.asm +++ /dev/null @@ -1,12686 +0,0 @@ -; w65c02 assembly code for 'more_compares' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:40 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: more_compares.p8:6 main { - - - ; source: more_compares.p8:7 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - ; source: more_compares.p8:8 test_string() - jsr p8b_main.p8s_test_string - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:10 test_compare_variable() - jsr p8b_main.p8s_test_compare_variable - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:12 test_compare_literal() - jmp p8b_main.p8s_test_compare_literal - ; source: more_compares.p8:7 sub start() { -; variables - .section BSS - .send BSS - - .pend - ; source: more_compares.p8:15 sub test_string() { - -p8s_test_string .proc -; statements - ; source: more_compares.p8:16 str name="john" - ; source: more_compares.p8:18 if (string.compare(name, "aaa")==0) or (string.compare(name, "john")==0) or (string.compare(name, "bbb")==0) { - lda #p8b_main.p8s_test_string.p8v_name - sta cx16.r0 - sty cx16.r0+1 - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8s_test_string.p8v_name - sta cx16.r0 - sty cx16.r0+1 - ldy #>prog8_interned_strings.string_2 - lda #p8b_main.p8s_test_string.p8v_name - sta cx16.r0 - sty cx16.r0+1 - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #p8b_main.p8s_test_string.p8v_name - sta cx16.r0 - sty cx16.r0+1 - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8s_test_string.p8v_name - sta cx16.r0 - sty cx16.r0+1 - ldy #>prog8_interned_strings.string_5 - lda #p8b_main.p8s_test_string.p8v_name - sta cx16.r0 - sty cx16.r0+1 - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #>p8v_name - lda #prog8_interned_strings.string_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #>p8v_name - lda #prog8_interned_strings.string_3 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #>p8v_name - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #>p8v_name - lda #prog8_interned_strings.string_5 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #>p8v_name - lda #prog8_interned_strings.string_3 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #>p8v_name - lda #prog8_interned_strings.string_8 - lda #-$4e20 - sta p8v_w - sty p8v_w+1 - - ; source: more_compares.p8:36 uword @shared uw = 2000 - lda #<$07d0 - ldy #>$07d0 - sta p8v_uw - sty p8v_uw+1 - - ; source: more_compares.p8:37 float @shared f = -100 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f - jsr floats.copy_float - ; source: more_compares.p8:39 txt.print("all 1: ") - ldy #>prog8_interned_strings.string_9 - lda # -101 as ubyte) - lda p8v_b - cmp #-100 - bmi label_asm_22_else - lda #1 - bra label_asm_21_afterif -label_asm_22_else - lda #0 -label_asm_21_afterif - jsr txt.print_ub - ; source: more_compares.p8:45 txt.print_ub(b >= -100 as ubyte) - lda p8v_b - cmp #-100 - bmi label_asm_24_else - lda #1 - bra label_asm_23_afterif -label_asm_24_else - lda #0 -label_asm_23_afterif - jsr txt.print_ub - ; source: more_compares.p8:46 txt.print_ub(ub ==20 as ubyte) - lda p8v_ub - cmp #20 - bne label_asm_26_else - lda #1 - bra label_asm_25_afterif -label_asm_26_else - lda #0 -label_asm_25_afterif - jsr txt.print_ub - ; source: more_compares.p8:47 txt.print_ub(ub !=19 as ubyte) - lda p8v_ub - cmp #19 - beq label_asm_28_else - lda #1 - bra label_asm_27_afterif -label_asm_28_else - lda #0 -label_asm_27_afterif - jsr txt.print_ub - ; source: more_compares.p8:48 txt.print_ub(ub <21 as ubyte) - lda p8v_ub - cmp #21 - rol a - and #1 - eor #1 - jsr txt.print_ub - ; source: more_compares.p8:49 txt.print_ub(ub <=20 as ubyte) - lda p8v_ub - cmp #21 - rol a - and #1 - eor #1 - jsr txt.print_ub - ; source: more_compares.p8:50 txt.print_ub(ub>19 as ubyte) - lda p8v_ub - cmp #20 - rol a - and #1 - jsr txt.print_ub - ; source: more_compares.p8:51 txt.print_ub(ub>=20 as ubyte) - lda p8v_ub - cmp #20 - rol a - and #1 - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:53 txt.print_ub(w == -20000 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20000 - bne label_asm_30_else - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20000 - bne label_asm_30_else - lda #1 - bra label_asm_29_afterif -label_asm_30_else - lda #0 -label_asm_29_afterif - jsr txt.print_ub - ; source: more_compares.p8:54 txt.print_ub(w != -19999 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-19999 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-19999 - beq label_asm_32_else -+ - lda #1 - bra label_asm_31_afterif -label_asm_32_else - lda #0 -label_asm_31_afterif - jsr txt.print_ub - ; source: more_compares.p8:55 txt.print_ub(w < -19999 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e1f - tya - sbc #>-$4e1f - bvs + - eor #128 -+ bmi label_asm_34_else - lda #1 - bra label_asm_33_afterif -label_asm_34_else - lda #0 -label_asm_33_afterif - jsr txt.print_ub - ; source: more_compares.p8:56 txt.print_ub(w <= -20000 as ubyte) - ldy #>-$4e20 - lda #<-$4e20 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_36_else - lda #1 - bra label_asm_35_afterif -label_asm_36_else - lda #0 -label_asm_35_afterif - jsr txt.print_ub - ; source: more_compares.p8:57 txt.print_ub(w > -20001 as ubyte) - ldy #>-$4e21 - lda #<-$4e21 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_38_else - lda #1 - bra label_asm_37_afterif -label_asm_38_else - lda #0 -label_asm_37_afterif - jsr txt.print_ub - ; source: more_compares.p8:58 txt.print_ub(w >= -20000 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e20 - tya - sbc #>-$4e20 - bvc + - eor #128 -+ bmi label_asm_40_else - lda #1 - bra label_asm_39_afterif -label_asm_40_else - lda #0 -label_asm_39_afterif - jsr txt.print_ub - ; source: more_compares.p8:59 txt.print_ub(uw == 2000 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2000 - bne label_asm_42_else - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2000 - bne label_asm_42_else - lda #1 - bra label_asm_41_afterif -label_asm_42_else - lda #0 -label_asm_41_afterif - jsr txt.print_ub - ; source: more_compares.p8:60 txt.print_ub(uw != 2001 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2001 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2001 - beq label_asm_44_else -+ - lda #1 - bra label_asm_43_afterif -label_asm_44_else - lda #0 -label_asm_43_afterif - jsr txt.print_ub - ; source: more_compares.p8:61 txt.print_ub(uw < 2001 as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d1 - tya - sbc #>$07d1 - bcs label_asm_46_else - lda #1 - bra label_asm_45_afterif -label_asm_46_else - lda #0 -label_asm_45_afterif - jsr txt.print_ub - ; source: more_compares.p8:62 txt.print_ub(uw <= 2000 as ubyte) - ldy #>$07d0 - lda #<$07d0 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_48_else - lda #1 - bra label_asm_47_afterif -label_asm_48_else - lda #0 -label_asm_47_afterif - jsr txt.print_ub - ; source: more_compares.p8:63 txt.print_ub(uw > 1999 as ubyte) - ldy #>$07cf - lda #<$07cf - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_50_else - lda #1 - bra label_asm_49_afterif -label_asm_50_else - lda #0 -label_asm_49_afterif - jsr txt.print_ub - ; source: more_compares.p8:64 txt.print_ub(uw >= 2000 as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d0 - tya - sbc #>$07d0 - bcc label_asm_52_else - lda #1 - bra label_asm_51_afterif -label_asm_52_else - lda #0 -label_asm_51_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:66 txt.print_ub(f == -100.0 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_54_else - lda #1 - bra label_asm_53_afterif -label_asm_54_else - lda #0 -label_asm_53_afterif - jsr txt.print_ub - ; source: more_compares.p8:67 txt.print_ub(f != -99.0 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_1 - jsr floats.vars_equal_f - bne label_asm_56_else - lda #1 - bra label_asm_55_afterif -label_asm_56_else - lda #0 -label_asm_55_afterif - jsr txt.print_ub - ; source: more_compares.p8:68 txt.print_ub(f < -99.0 as ubyte) - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_58_else - lda #1 - bra label_asm_57_afterif -label_asm_58_else - lda #0 -label_asm_57_afterif - jsr txt.print_ub - ; source: more_compares.p8:69 txt.print_ub(f <= -100.0 as ubyte) - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_60_else - lda #1 - bra label_asm_59_afterif -label_asm_60_else - lda #0 -label_asm_59_afterif - jsr txt.print_ub - ; source: more_compares.p8:70 txt.print_ub(f > -101.0 as ubyte) - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_62_else - lda #1 - bra label_asm_61_afterif -label_asm_62_else - lda #0 -label_asm_61_afterif - jsr txt.print_ub - ; source: more_compares.p8:71 txt.print_ub(f >= -100.0 as ubyte) - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_64_else - lda #1 - bra label_asm_63_afterif -label_asm_64_else - lda #0 -label_asm_63_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:74 txt.print("all 0: ") - ldy #>prog8_interned_strings.string_10 - lda # -100 as ubyte) - lda p8v_b - cmp #-99 - bmi label_asm_74_else - lda #1 - bra label_asm_73_afterif -label_asm_74_else - lda #0 -label_asm_73_afterif - jsr txt.print_ub - ; source: more_compares.p8:80 txt.print_ub(b >= -99 as ubyte) - lda p8v_b - cmp #-99 - bmi label_asm_76_else - lda #1 - bra label_asm_75_afterif -label_asm_76_else - lda #0 -label_asm_75_afterif - jsr txt.print_ub - ; source: more_compares.p8:81 txt.print_ub(ub ==21 as ubyte) - lda p8v_ub - cmp #21 - bne label_asm_78_else - lda #1 - bra label_asm_77_afterif -label_asm_78_else - lda #0 -label_asm_77_afterif - jsr txt.print_ub - ; source: more_compares.p8:82 txt.print_ub(ub !=20 as ubyte) - lda p8v_ub - cmp #20 - beq label_asm_80_else - lda #1 - bra label_asm_79_afterif -label_asm_80_else - lda #0 -label_asm_79_afterif - jsr txt.print_ub - ; source: more_compares.p8:83 txt.print_ub(ub <20 as ubyte) - lda p8v_ub - cmp #20 - rol a - and #1 - eor #1 - jsr txt.print_ub - ; source: more_compares.p8:84 txt.print_ub(ub <=19 as ubyte) - lda p8v_ub - cmp #20 - rol a - and #1 - eor #1 - jsr txt.print_ub - ; source: more_compares.p8:85 txt.print_ub(ub>20 as ubyte) - lda p8v_ub - cmp #21 - rol a - and #1 - jsr txt.print_ub - ; source: more_compares.p8:86 txt.print_ub(ub>=21 as ubyte) - lda p8v_ub - cmp #21 - rol a - and #1 - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:88 txt.print_ub(w == -20001 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20001 - bne label_asm_82_else - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20001 - bne label_asm_82_else - lda #1 - bra label_asm_81_afterif -label_asm_82_else - lda #0 -label_asm_81_afterif - jsr txt.print_ub - ; source: more_compares.p8:89 txt.print_ub(w != -20000 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20000 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20000 - beq label_asm_84_else -+ - lda #1 - bra label_asm_83_afterif -label_asm_84_else - lda #0 -label_asm_83_afterif - jsr txt.print_ub - ; source: more_compares.p8:90 txt.print_ub(w < -20000 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e20 - tya - sbc #>-$4e20 - bvs + - eor #128 -+ bmi label_asm_86_else - lda #1 - bra label_asm_85_afterif -label_asm_86_else - lda #0 -label_asm_85_afterif - jsr txt.print_ub - ; source: more_compares.p8:91 txt.print_ub(w <= -20001 as ubyte) - ldy #>-$4e21 - lda #<-$4e21 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_88_else - lda #1 - bra label_asm_87_afterif -label_asm_88_else - lda #0 -label_asm_87_afterif - jsr txt.print_ub - ; source: more_compares.p8:92 txt.print_ub(w > -20000 as ubyte) - ldy #>-$4e20 - lda #<-$4e20 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_90_else - lda #1 - bra label_asm_89_afterif -label_asm_90_else - lda #0 -label_asm_89_afterif - jsr txt.print_ub - ; source: more_compares.p8:93 txt.print_ub(w >= -19999 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e1f - tya - sbc #>-$4e1f - bvc + - eor #128 -+ bmi label_asm_92_else - lda #1 - bra label_asm_91_afterif -label_asm_92_else - lda #0 -label_asm_91_afterif - jsr txt.print_ub - ; source: more_compares.p8:94 txt.print_ub(uw == 1999 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<1999 - bne label_asm_94_else - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>1999 - bne label_asm_94_else - lda #1 - bra label_asm_93_afterif -label_asm_94_else - lda #0 -label_asm_93_afterif - jsr txt.print_ub - ; source: more_compares.p8:95 txt.print_ub(uw != 2000 as ubyte) - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2000 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2000 - beq label_asm_96_else -+ - lda #1 - bra label_asm_95_afterif -label_asm_96_else - lda #0 -label_asm_95_afterif - jsr txt.print_ub - ; source: more_compares.p8:96 txt.print_ub(uw < 2000 as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d0 - tya - sbc #>$07d0 - bcs label_asm_98_else - lda #1 - bra label_asm_97_afterif -label_asm_98_else - lda #0 -label_asm_97_afterif - jsr txt.print_ub - ; source: more_compares.p8:97 txt.print_ub(uw <= 1999 as ubyte) - ldy #>$07cf - lda #<$07cf - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_100_else - lda #1 - bra label_asm_99_afterif -label_asm_100_else - lda #0 -label_asm_99_afterif - jsr txt.print_ub - ; source: more_compares.p8:98 txt.print_ub(uw > 2000 as ubyte) - ldy #>$07d0 - lda #<$07d0 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_102_else - lda #1 - bra label_asm_101_afterif -label_asm_102_else - lda #0 -label_asm_101_afterif - jsr txt.print_ub - ; source: more_compares.p8:99 txt.print_ub(uw >= 2001 as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d1 - tya - sbc #>$07d1 - bcc label_asm_104_else - lda #1 - bra label_asm_103_afterif -label_asm_104_else - lda #0 -label_asm_103_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:101 txt.print_ub(f == -99.0 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_1 - jsr floats.vars_equal_f - beq label_asm_106_else - lda #1 - bra label_asm_105_afterif -label_asm_106_else - lda #0 -label_asm_105_afterif - jsr txt.print_ub - ; source: more_compares.p8:102 txt.print_ub(f != -100.0 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_108_else - lda #1 - bra label_asm_107_afterif -label_asm_108_else - lda #0 -label_asm_107_afterif - jsr txt.print_ub - ; source: more_compares.p8:103 txt.print_ub(f < -100.0 as ubyte) - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_110_else - lda #1 - bra label_asm_109_afterif -label_asm_110_else - lda #0 -label_asm_109_afterif - jsr txt.print_ub - ; source: more_compares.p8:104 txt.print_ub(f <= -101.0 as ubyte) - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_112_else - lda #1 - bra label_asm_111_afterif -label_asm_112_else - lda #0 -label_asm_111_afterif - jsr txt.print_ub - ; source: more_compares.p8:105 txt.print_ub(f > -100.0 as ubyte) - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_114_else - lda #1 - bra label_asm_113_afterif -label_asm_114_else - lda #0 -label_asm_113_afterif - jsr txt.print_ub - ; source: more_compares.p8:106 txt.print_ub(f >= -99.0 as ubyte) - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_116_else - lda #1 - bra label_asm_115_afterif -label_asm_116_else - lda #0 -label_asm_115_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:109 txt.print("all .: ") - ldy #>prog8_interned_strings.string_11 - lda # -101 txt.chrout('.') - lda p8v_b - cmp #-100 - bmi label_asm_121_afterif - lda #$2e - jsr txt.chrout -label_asm_121_afterif - ; source: more_compares.p8:115 if b >= -100 txt.chrout('.') - lda p8v_b - cmp #-100 - bmi label_asm_122_afterif - lda #$2e - jsr txt.chrout -label_asm_122_afterif - ; source: more_compares.p8:116 if ub ==20 txt.chrout('.') - lda p8v_ub - cmp #20 - bne label_asm_123_afterif - lda #$2e - jsr txt.chrout -label_asm_123_afterif - ; source: more_compares.p8:117 if ub !=19 txt.chrout('.') - lda p8v_ub - cmp #19 - beq label_asm_124_afterif - lda #$2e - jsr txt.chrout -label_asm_124_afterif - ; source: more_compares.p8:118 if ub <21 txt.chrout('.') - lda p8v_ub - cmp #21 - bcs label_asm_125_afterif - lda #$2e - jsr txt.chrout -label_asm_125_afterif - ; source: more_compares.p8:119 if ub <=20 txt.chrout('.') - lda p8v_ub - cmp #21 - bcs label_asm_126_afterif - lda #$2e - jsr txt.chrout -label_asm_126_afterif - ; source: more_compares.p8:120 if ub>19 txt.chrout('.') - lda p8v_ub - cmp #20 - bcc label_asm_127_afterif - lda #$2e - jsr txt.chrout -label_asm_127_afterif - ; source: more_compares.p8:121 if ub>=20 txt.chrout('.') - lda p8v_ub - cmp #20 - bcc label_asm_128_afterif - lda #$2e - jsr txt.chrout -label_asm_128_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:123 if w == -20000 txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20000 - bne label_asm_129_afterif - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20000 - bne label_asm_129_afterif - lda #$2e - jsr txt.chrout -label_asm_129_afterif - ; source: more_compares.p8:124 if w != -19999 txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-19999 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-19999 - beq label_asm_130_afterif -+ - lda #$2e - jsr txt.chrout -label_asm_130_afterif - ; source: more_compares.p8:125 if w < -19999 txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e1f - tya - sbc #>-$4e1f - bvs + - eor #128 -+ bmi label_asm_131_afterif - lda #$2e - jsr txt.chrout -label_asm_131_afterif - ; source: more_compares.p8:126 if w <= -20000 txt.chrout('.') - ldy #>-$4e20 - lda #<-$4e20 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_132_afterif - lda #$2e - jsr txt.chrout -label_asm_132_afterif - ; source: more_compares.p8:127 if w > -20001 txt.chrout('.') - ldy #>-$4e21 - lda #<-$4e21 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_133_afterif - lda #$2e - jsr txt.chrout -label_asm_133_afterif - ; source: more_compares.p8:128 if w >= -20000 txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e20 - tya - sbc #>-$4e20 - bvc + - eor #128 -+ bmi label_asm_134_afterif - lda #$2e - jsr txt.chrout -label_asm_134_afterif - ; source: more_compares.p8:129 if uw == 2000 txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2000 - bne label_asm_135_afterif - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2000 - bne label_asm_135_afterif - lda #$2e - jsr txt.chrout -label_asm_135_afterif - ; source: more_compares.p8:130 if uw != 2001 txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2001 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2001 - beq label_asm_136_afterif -+ - lda #$2e - jsr txt.chrout -label_asm_136_afterif - ; source: more_compares.p8:131 if uw < 2001 txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d1 - tya - sbc #>$07d1 - bcs label_asm_137_afterif - lda #$2e - jsr txt.chrout -label_asm_137_afterif - ; source: more_compares.p8:132 if uw <= 2000 txt.chrout('.') - ldy #>$07d0 - lda #<$07d0 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_138_afterif - lda #$2e - jsr txt.chrout -label_asm_138_afterif - ; source: more_compares.p8:133 if uw > 1999 txt.chrout('.') - ldy #>$07cf - lda #<$07cf - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_139_afterif - lda #$2e - jsr txt.chrout -label_asm_139_afterif - ; source: more_compares.p8:134 if uw >= 2000 txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d0 - tya - sbc #>$07d0 - bcc label_asm_140_afterif - lda #$2e - jsr txt.chrout -label_asm_140_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:136 if f == -100.0 txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_141_afterif - lda #$2e - jsr txt.chrout -label_asm_141_afterif - ; source: more_compares.p8:137 if f != -99.0 txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_1 - jsr floats.vars_equal_f - bne label_asm_142_afterif - lda #$2e - jsr txt.chrout -label_asm_142_afterif - ; source: more_compares.p8:138 if f < -99.0 txt.chrout('.') - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_143_afterif - lda #$2e - jsr txt.chrout -label_asm_143_afterif - ; source: more_compares.p8:139 if f <= -100.0 txt.chrout('.') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_144_afterif - lda #$2e - jsr txt.chrout -label_asm_144_afterif - ; source: more_compares.p8:140 if f > -101.0 txt.chrout('.') - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_145_afterif - lda #$2e - jsr txt.chrout -label_asm_145_afterif - ; source: more_compares.p8:141 if f >= -100.0 txt.chrout('.') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_146_afterif - lda #$2e - jsr txt.chrout -label_asm_146_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:144 txt.print(" no !: ") - ldy #>prog8_interned_strings.string_12 - lda # -100 txt.chrout('!') - lda p8v_b - cmp #-99 - bmi label_asm_151_afterif - lda #$21 - jsr txt.chrout -label_asm_151_afterif - ; source: more_compares.p8:150 if b >= -99 txt.chrout('!') - lda p8v_b - cmp #-99 - bmi label_asm_152_afterif - lda #$21 - jsr txt.chrout -label_asm_152_afterif - ; source: more_compares.p8:151 if ub ==21 txt.chrout('!') - lda p8v_ub - cmp #21 - bne label_asm_153_afterif - lda #$21 - jsr txt.chrout -label_asm_153_afterif - ; source: more_compares.p8:152 if ub !=20 txt.chrout('!') - lda p8v_ub - cmp #20 - beq label_asm_154_afterif - lda #$21 - jsr txt.chrout -label_asm_154_afterif - ; source: more_compares.p8:153 if ub <20 txt.chrout('!') - lda p8v_ub - cmp #20 - bcs label_asm_155_afterif - lda #$21 - jsr txt.chrout -label_asm_155_afterif - ; source: more_compares.p8:154 if ub <=19 txt.chrout('!') - lda p8v_ub - cmp #20 - bcs label_asm_156_afterif - lda #$21 - jsr txt.chrout -label_asm_156_afterif - ; source: more_compares.p8:155 if ub>20 txt.chrout('!') - lda p8v_ub - cmp #21 - bcc label_asm_157_afterif - lda #$21 - jsr txt.chrout -label_asm_157_afterif - ; source: more_compares.p8:156 if ub>=21 txt.chrout('!') - lda p8v_ub - cmp #21 - bcc label_asm_158_afterif - lda #$21 - jsr txt.chrout -label_asm_158_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:158 if w == -20001 txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20001 - bne label_asm_159_afterif - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20001 - bne label_asm_159_afterif - lda #$21 - jsr txt.chrout -label_asm_159_afterif - ; source: more_compares.p8:159 if w != -20000 txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20000 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20000 - beq label_asm_160_afterif -+ - lda #$21 - jsr txt.chrout -label_asm_160_afterif - ; source: more_compares.p8:160 if w < -20000 txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e20 - tya - sbc #>-$4e20 - bvs + - eor #128 -+ bmi label_asm_161_afterif - lda #$21 - jsr txt.chrout -label_asm_161_afterif - ; source: more_compares.p8:161 if w <= -20001 txt.chrout('!') - ldy #>-$4e21 - lda #<-$4e21 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_162_afterif - lda #$21 - jsr txt.chrout -label_asm_162_afterif - ; source: more_compares.p8:162 if w > -20000 txt.chrout('!') - ldy #>-$4e20 - lda #<-$4e20 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_163_afterif - lda #$21 - jsr txt.chrout -label_asm_163_afterif - ; source: more_compares.p8:163 if w >= -19999 txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e1f - tya - sbc #>-$4e1f - bvc + - eor #128 -+ bmi label_asm_164_afterif - lda #$21 - jsr txt.chrout -label_asm_164_afterif - ; source: more_compares.p8:164 if uw == 1999 txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<1999 - bne label_asm_165_afterif - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>1999 - bne label_asm_165_afterif - lda #$21 - jsr txt.chrout -label_asm_165_afterif - ; source: more_compares.p8:165 if uw != 2000 txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2000 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2000 - beq label_asm_166_afterif -+ - lda #$21 - jsr txt.chrout -label_asm_166_afterif - ; source: more_compares.p8:166 if uw < 2000 txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d0 - tya - sbc #>$07d0 - bcs label_asm_167_afterif - lda #$21 - jsr txt.chrout -label_asm_167_afterif - ; source: more_compares.p8:167 if uw <= 1999 txt.chrout('!') - ldy #>$07cf - lda #<$07cf - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_168_afterif - lda #$21 - jsr txt.chrout -label_asm_168_afterif - ; source: more_compares.p8:168 if uw > 2000 txt.chrout('!') - ldy #>$07d0 - lda #<$07d0 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_169_afterif - lda #$21 - jsr txt.chrout -label_asm_169_afterif - ; source: more_compares.p8:169 if uw >= 2001 txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d1 - tya - sbc #>$07d1 - bcc label_asm_170_afterif - lda #$21 - jsr txt.chrout -label_asm_170_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:171 if f == -99.0 txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_1 - jsr floats.vars_equal_f - beq label_asm_171_afterif - lda #$21 - jsr txt.chrout -label_asm_171_afterif - ; source: more_compares.p8:172 if f != -100.0 txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_172_afterif - lda #$21 - jsr txt.chrout -label_asm_172_afterif - ; source: more_compares.p8:173 if f < -100.0 txt.chrout('!') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_173_afterif - lda #$21 - jsr txt.chrout -label_asm_173_afterif - ; source: more_compares.p8:174 if f <= -101.0 txt.chrout('!') - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_174_afterif - lda #$21 - jsr txt.chrout -label_asm_174_afterif - ; source: more_compares.p8:175 if f > -100.0 txt.chrout('!') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_175_afterif - lda #$21 - jsr txt.chrout -label_asm_175_afterif - ; source: more_compares.p8:176 if f >= -99.0 txt.chrout('!') - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_176_afterif - lda #$21 - jsr txt.chrout -label_asm_176_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:179 txt.print("all .: ") - ldy #>prog8_interned_strings.string_11 - lda # -101 txt.chrout('.') else txt.chrout('!') - lda p8v_b - cmp #-100 - bmi label_asm_186_else - lda #$2e - jsr txt.chrout - bra label_asm_185_afterif -label_asm_186_else - lda #$21 - jsr txt.chrout -label_asm_185_afterif - ; source: more_compares.p8:185 if b >= -100 txt.chrout('.') else txt.chrout('!') - lda p8v_b - cmp #-100 - bmi label_asm_188_else - lda #$2e - jsr txt.chrout - bra label_asm_187_afterif -label_asm_188_else - lda #$21 - jsr txt.chrout -label_asm_187_afterif - ; source: more_compares.p8:186 if ub ==20 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp #20 - bne label_asm_190_else - lda #$2e - jsr txt.chrout - bra label_asm_189_afterif -label_asm_190_else - lda #$21 - jsr txt.chrout -label_asm_189_afterif - ; source: more_compares.p8:187 if ub !=19 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp #19 - beq label_asm_192_else - lda #$2e - jsr txt.chrout - bra label_asm_191_afterif -label_asm_192_else - lda #$21 - jsr txt.chrout -label_asm_191_afterif - ; source: more_compares.p8:188 if ub <21 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp #21 - bcs label_asm_194_else - lda #$2e - jsr txt.chrout - bra label_asm_193_afterif -label_asm_194_else - lda #$21 - jsr txt.chrout -label_asm_193_afterif - ; source: more_compares.p8:189 if ub <=20 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp #21 - bcs label_asm_196_else - lda #$2e - jsr txt.chrout - bra label_asm_195_afterif -label_asm_196_else - lda #$21 - jsr txt.chrout -label_asm_195_afterif - ; source: more_compares.p8:190 if ub>19 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp #20 - bcc label_asm_198_else - lda #$2e - jsr txt.chrout - bra label_asm_197_afterif -label_asm_198_else - lda #$21 - jsr txt.chrout -label_asm_197_afterif - ; source: more_compares.p8:191 if ub>=20 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp #20 - bcc label_asm_200_else - lda #$2e - jsr txt.chrout - bra label_asm_199_afterif -label_asm_200_else - lda #$21 - jsr txt.chrout -label_asm_199_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:193 if w == -20000 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20000 - bne label_asm_202_else - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20000 - bne label_asm_202_else - lda #$2e - jsr txt.chrout - bra label_asm_201_afterif -label_asm_202_else - lda #$21 - jsr txt.chrout -label_asm_201_afterif - ; source: more_compares.p8:194 if w != -19999 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-19999 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-19999 - beq label_asm_204_else -+ - lda #$2e - jsr txt.chrout - bra label_asm_203_afterif -label_asm_204_else - lda #$21 - jsr txt.chrout -label_asm_203_afterif - ; source: more_compares.p8:195 if w < -19999 txt.chrout('.') else txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e1f - tya - sbc #>-$4e1f - bvs + - eor #128 -+ bmi label_asm_206_else - lda #$2e - jsr txt.chrout - bra label_asm_205_afterif -label_asm_206_else - lda #$21 - jsr txt.chrout -label_asm_205_afterif - ; source: more_compares.p8:196 if w <= -20000 txt.chrout('.') else txt.chrout('!') - ldy #>-$4e20 - lda #<-$4e20 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_208_else - lda #$2e - jsr txt.chrout - bra label_asm_207_afterif -label_asm_208_else - lda #$21 - jsr txt.chrout -label_asm_207_afterif - ; source: more_compares.p8:197 if w > -20001 txt.chrout('.') else txt.chrout('!') - ldy #>-$4e21 - lda #<-$4e21 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_210_else - lda #$2e - jsr txt.chrout - bra label_asm_209_afterif -label_asm_210_else - lda #$21 - jsr txt.chrout -label_asm_209_afterif - ; source: more_compares.p8:198 if w >= -20000 txt.chrout('.') else txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e20 - tya - sbc #>-$4e20 - bvc + - eor #128 -+ bmi label_asm_212_else - lda #$2e - jsr txt.chrout - bra label_asm_211_afterif -label_asm_212_else - lda #$21 - jsr txt.chrout -label_asm_211_afterif - ; source: more_compares.p8:199 if uw == 2000 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2000 - bne label_asm_214_else - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2000 - bne label_asm_214_else - lda #$2e - jsr txt.chrout - bra label_asm_213_afterif -label_asm_214_else - lda #$21 - jsr txt.chrout -label_asm_213_afterif - ; source: more_compares.p8:200 if uw != 2001 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2001 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2001 - beq label_asm_216_else -+ - lda #$2e - jsr txt.chrout - bra label_asm_215_afterif -label_asm_216_else - lda #$21 - jsr txt.chrout -label_asm_215_afterif - ; source: more_compares.p8:201 if uw < 2001 txt.chrout('.') else txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d1 - tya - sbc #>$07d1 - bcs label_asm_218_else - lda #$2e - jsr txt.chrout - bra label_asm_217_afterif -label_asm_218_else - lda #$21 - jsr txt.chrout -label_asm_217_afterif - ; source: more_compares.p8:202 if uw <= 2000 txt.chrout('.') else txt.chrout('!') - ldy #>$07d0 - lda #<$07d0 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_220_else - lda #$2e - jsr txt.chrout - bra label_asm_219_afterif -label_asm_220_else - lda #$21 - jsr txt.chrout -label_asm_219_afterif - ; source: more_compares.p8:203 if uw > 1999 txt.chrout('.') else txt.chrout('!') - ldy #>$07cf - lda #<$07cf - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_222_else - lda #$2e - jsr txt.chrout - bra label_asm_221_afterif -label_asm_222_else - lda #$21 - jsr txt.chrout -label_asm_221_afterif - ; source: more_compares.p8:204 if uw >= 2000 txt.chrout('.') else txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d0 - tya - sbc #>$07d0 - bcc label_asm_224_else - lda #$2e - jsr txt.chrout - bra label_asm_223_afterif -label_asm_224_else - lda #$21 - jsr txt.chrout -label_asm_223_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:206 if f == -100.0 txt.chrout('.') else txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_226_else - lda #$2e - jsr txt.chrout - bra label_asm_225_afterif -label_asm_226_else - lda #$21 - jsr txt.chrout -label_asm_225_afterif - ; source: more_compares.p8:207 if f != -99.0 txt.chrout('.') else txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_1 - jsr floats.vars_equal_f - bne label_asm_228_else - lda #$2e - jsr txt.chrout - bra label_asm_227_afterif -label_asm_228_else - lda #$21 - jsr txt.chrout -label_asm_227_afterif - ; source: more_compares.p8:208 if f < -99.0 txt.chrout('.') else txt.chrout('!') - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_230_else - lda #$2e - jsr txt.chrout - bra label_asm_229_afterif -label_asm_230_else - lda #$21 - jsr txt.chrout -label_asm_229_afterif - ; source: more_compares.p8:209 if f <= -100.0 txt.chrout('.') else txt.chrout('!') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_232_else - lda #$2e - jsr txt.chrout - bra label_asm_231_afterif -label_asm_232_else - lda #$21 - jsr txt.chrout -label_asm_231_afterif - ; source: more_compares.p8:210 if f > -101.0 txt.chrout('.') else txt.chrout('!') - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_234_else - lda #$2e - jsr txt.chrout - bra label_asm_233_afterif -label_asm_234_else - lda #$21 - jsr txt.chrout -label_asm_233_afterif - ; source: more_compares.p8:211 if f >= -100.0 txt.chrout('.') else txt.chrout('!') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_236_else - lda #$2e - jsr txt.chrout - bra label_asm_235_afterif -label_asm_236_else - lda #$21 - jsr txt.chrout -label_asm_235_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:214 txt.print("all .: ") - ldy #>prog8_interned_strings.string_11 - lda # -100 txt.chrout('!') else txt.chrout('.') - lda p8v_b - cmp #-99 - bmi label_asm_246_else - lda #$21 - jsr txt.chrout - bra label_asm_245_afterif -label_asm_246_else - lda #$2e - jsr txt.chrout -label_asm_245_afterif - ; source: more_compares.p8:220 if b >= -99 txt.chrout('!') else txt.chrout('.') - lda p8v_b - cmp #-99 - bmi label_asm_248_else - lda #$21 - jsr txt.chrout - bra label_asm_247_afterif -label_asm_248_else - lda #$2e - jsr txt.chrout -label_asm_247_afterif - ; source: more_compares.p8:221 if ub ==21 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp #21 - bne label_asm_250_else - lda #$21 - jsr txt.chrout - bra label_asm_249_afterif -label_asm_250_else - lda #$2e - jsr txt.chrout -label_asm_249_afterif - ; source: more_compares.p8:222 if ub !=20 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp #20 - beq label_asm_252_else - lda #$21 - jsr txt.chrout - bra label_asm_251_afterif -label_asm_252_else - lda #$2e - jsr txt.chrout -label_asm_251_afterif - ; source: more_compares.p8:223 if ub <20 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp #20 - bcs label_asm_254_else - lda #$21 - jsr txt.chrout - bra label_asm_253_afterif -label_asm_254_else - lda #$2e - jsr txt.chrout -label_asm_253_afterif - ; source: more_compares.p8:224 if ub <=19 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp #20 - bcs label_asm_256_else - lda #$21 - jsr txt.chrout - bra label_asm_255_afterif -label_asm_256_else - lda #$2e - jsr txt.chrout -label_asm_255_afterif - ; source: more_compares.p8:225 if ub>20 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp #21 - bcc label_asm_258_else - lda #$21 - jsr txt.chrout - bra label_asm_257_afterif -label_asm_258_else - lda #$2e - jsr txt.chrout -label_asm_257_afterif - ; source: more_compares.p8:226 if ub>=21 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp #21 - bcc label_asm_260_else - lda #$21 - jsr txt.chrout - bra label_asm_259_afterif -label_asm_260_else - lda #$2e - jsr txt.chrout -label_asm_259_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:228 if w == -20001 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20001 - bne label_asm_262_else - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20001 - bne label_asm_262_else - lda #$21 - jsr txt.chrout - bra label_asm_261_afterif -label_asm_262_else - lda #$2e - jsr txt.chrout -label_asm_261_afterif - ; source: more_compares.p8:229 if w != -20000 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_w - cmp #<-20000 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_w+1 - cmp #>-20000 - beq label_asm_264_else -+ - lda #$21 - jsr txt.chrout - bra label_asm_263_afterif -label_asm_264_else - lda #$2e - jsr txt.chrout -label_asm_263_afterif - ; source: more_compares.p8:230 if w < -20000 txt.chrout('!') else txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e20 - tya - sbc #>-$4e20 - bvs + - eor #128 -+ bmi label_asm_266_else - lda #$21 - jsr txt.chrout - bra label_asm_265_afterif -label_asm_266_else - lda #$2e - jsr txt.chrout -label_asm_265_afterif - ; source: more_compares.p8:231 if w <= -20001 txt.chrout('!') else txt.chrout('.') - ldy #>-$4e21 - lda #<-$4e21 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_268_else - lda #$21 - jsr txt.chrout - bra label_asm_267_afterif -label_asm_268_else - lda #$2e - jsr txt.chrout -label_asm_267_afterif - ; source: more_compares.p8:232 if w > -20000 txt.chrout('!') else txt.chrout('.') - ldy #>-$4e20 - lda #<-$4e20 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_270_else - lda #$21 - jsr txt.chrout - bra label_asm_269_afterif -label_asm_270_else - lda #$2e - jsr txt.chrout -label_asm_269_afterif - ; source: more_compares.p8:233 if w >= -19999 txt.chrout('!') else txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp #<-$4e1f - tya - sbc #>-$4e1f - bvc + - eor #128 -+ bmi label_asm_272_else - lda #$21 - jsr txt.chrout - bra label_asm_271_afterif -label_asm_272_else - lda #$2e - jsr txt.chrout -label_asm_271_afterif - ; source: more_compares.p8:234 if uw == 1999 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<1999 - bne label_asm_274_else - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>1999 - bne label_asm_274_else - lda #$21 - jsr txt.chrout - bra label_asm_273_afterif -label_asm_274_else - lda #$2e - jsr txt.chrout -label_asm_273_afterif - ; source: more_compares.p8:235 if uw != 2000 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_literal.p8v_uw - cmp #<2000 - bne + - lda p8b_main.p8s_test_compare_literal.p8v_uw+1 - cmp #>2000 - beq label_asm_276_else -+ - lda #$21 - jsr txt.chrout - bra label_asm_275_afterif -label_asm_276_else - lda #$2e - jsr txt.chrout -label_asm_275_afterif - ; source: more_compares.p8:236 if uw < 2000 txt.chrout('!') else txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d0 - tya - sbc #>$07d0 - bcs label_asm_278_else - lda #$21 - jsr txt.chrout - bra label_asm_277_afterif -label_asm_278_else - lda #$2e - jsr txt.chrout -label_asm_277_afterif - ; source: more_compares.p8:237 if uw <= 1999 txt.chrout('!') else txt.chrout('.') - ldy #>$07cf - lda #<$07cf - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_280_else - lda #$21 - jsr txt.chrout - bra label_asm_279_afterif -label_asm_280_else - lda #$2e - jsr txt.chrout -label_asm_279_afterif - ; source: more_compares.p8:238 if uw > 2000 txt.chrout('!') else txt.chrout('.') - ldy #>$07d0 - lda #<$07d0 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_282_else - lda #$21 - jsr txt.chrout - bra label_asm_281_afterif -label_asm_282_else - lda #$2e - jsr txt.chrout -label_asm_281_afterif - ; source: more_compares.p8:239 if uw >= 2001 txt.chrout('!') else txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp #<$07d1 - tya - sbc #>$07d1 - bcc label_asm_284_else - lda #$21 - jsr txt.chrout - bra label_asm_283_afterif -label_asm_284_else - lda #$2e - jsr txt.chrout -label_asm_283_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:241 if f == -99.0 txt.chrout('!') else txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_1 - jsr floats.vars_equal_f - beq label_asm_286_else - lda #$21 - jsr txt.chrout - bra label_asm_285_afterif -label_asm_286_else - lda #$2e - jsr txt.chrout -label_asm_285_afterif - ; source: more_compares.p8:242 if f != -100.0 txt.chrout('!') else txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_288_else - lda #$21 - jsr txt.chrout - bra label_asm_287_afterif -label_asm_288_else - lda #$2e - jsr txt.chrout -label_asm_287_afterif - ; source: more_compares.p8:243 if f < -100.0 txt.chrout('!') else txt.chrout('.') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_290_else - lda #$21 - jsr txt.chrout - bra label_asm_289_afterif -label_asm_290_else - lda #$2e - jsr txt.chrout -label_asm_289_afterif - ; source: more_compares.p8:244 if f <= -101.0 txt.chrout('!') else txt.chrout('.') - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_292_else - lda #$21 - jsr txt.chrout - bra label_asm_291_afterif -label_asm_292_else - lda #$2e - jsr txt.chrout -label_asm_291_afterif - ; source: more_compares.p8:245 if f > -100.0 txt.chrout('!') else txt.chrout('.') - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_294_else - lda #$21 - jsr txt.chrout - bra label_asm_293_afterif -label_asm_294_else - lda #$2e - jsr txt.chrout -label_asm_293_afterif - ; source: more_compares.p8:246 if f >= -99.0 txt.chrout('!') else txt.chrout('.') - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_296_else - lda #$21 - jsr txt.chrout - bra label_asm_295_afterif -label_asm_296_else - lda #$2e - jsr txt.chrout -label_asm_295_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:250 b = -100 - lda #-$64 - sta p8v_b - ; source: more_compares.p8:251 while b <= -20 -p8l_label_1_whileloop - lda p8v_b - cmp #-19 - bpl p8l_label_2_afterwhile - ; source: more_compares.p8:252 b++ - inc p8v_b - ; source: more_compares.p8:251 while b <= -20 - bra p8l_label_1_whileloop -p8l_label_2_afterwhile - ; source: more_compares.p8:253 txt.print_b(b) - lda p8v_b - jsr txt.print_b - ; source: more_compares.p8:254 txt.print(" -19\n") - ldy #>prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #-$4e20 - sta p8v_w - sty p8v_w+1 - - ; source: more_compares.p8:273 while w <= -8000 { -p8l_label_9_whileloop - ldy #>-$1f40 - lda #<-$1f40 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi p8l_label_10_afterwhile - ; source: more_compares.p8:274 w++ - inc p8v_w - bne + - inc p8v_w+1 -+ - ; source: more_compares.p8:273 while w <= -8000 { - bra p8l_label_9_whileloop -p8l_label_10_afterwhile - ; source: more_compares.p8:276 txt.print_w(w) - ldy p8v_w+1 - lda p8v_w - jsr txt.print_w - ; source: more_compares.p8:277 txt.print(" -7999\n") - ldy #>prog8_interned_strings.string_17 - lda #-$4e20 - sta p8v_w - sty p8v_w+1 - - ; source: more_compares.p8:279 while w < -8000 { -p8l_label_11_whileloop - ldy p8v_w+1 - lda p8v_w - cmp #<-$1f40 - tya - sbc #>-$1f40 - bvs + - eor #128 -+ bmi p8l_label_12_afterwhile - ; source: more_compares.p8:280 w++ - inc p8v_w - bne + - inc p8v_w+1 -+ - ; source: more_compares.p8:279 while w < -8000 { - bra p8l_label_11_whileloop -p8l_label_12_afterwhile - ; source: more_compares.p8:282 txt.print_w(w) - ldy p8v_w+1 - lda p8v_w - jsr txt.print_w - ; source: more_compares.p8:283 txt.print(" -8000\n") - ldy #>prog8_interned_strings.string_18 - lda #$07d0 - sta p8v_uw - sty p8v_uw+1 - - ; source: more_compares.p8:286 while uw <= 8000 { -p8l_label_13_whileloop - ldy #>$1f40 - lda #<$1f40 - cpy p8v_uw+1 - bcc p8l_label_14_afterwhile - bne + - cmp p8v_uw - bcc p8l_label_14_afterwhile -+ - ; source: more_compares.p8:287 uw++ - inc p8v_uw - bne + - inc p8v_uw+1 -+ - ; source: more_compares.p8:286 while uw <= 8000 { - bra p8l_label_13_whileloop -p8l_label_14_afterwhile - ; source: more_compares.p8:289 txt.print_uw(uw) - ldy p8v_uw+1 - lda p8v_uw - jsr txt.print_uw - ; source: more_compares.p8:290 txt.print(" 8001\n") - ldy #>prog8_interned_strings.string_19 - lda #$07d0 - sta p8v_uw - sty p8v_uw+1 - - ; source: more_compares.p8:292 while uw < 8000 { -p8l_label_15_whileloop - ldy p8v_uw+1 - lda p8v_uw - cmp #<$1f40 - tya - sbc #>$1f40 - bcs p8l_label_16_afterwhile - ; source: more_compares.p8:293 uw++ - inc p8v_uw - bne + - inc p8v_uw+1 -+ - ; source: more_compares.p8:292 while uw < 8000 { - bra p8l_label_15_whileloop -p8l_label_16_afterwhile - ; source: more_compares.p8:295 txt.print_uw(uw) - ldy p8v_uw+1 - lda p8v_uw - jsr txt.print_uw - ; source: more_compares.p8:296 txt.print(" 8000\n") - ldy #>prog8_interned_strings.string_20 - lda #p8v_f - jsr floats.MOVFM - jsr floats.print - ; source: more_compares.p8:300 while f<2.2 { -p8l_label_17_whileloop - lda #prog8_float_const_3 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq p8l_label_18_afterwhile - ; source: more_compares.p8:301 f+=0.1 - lda #p8v_f - jsr floats.MOVFM - lda #prog8_float_const_4 - jsr floats.FADD - - ldx #p8v_f - jsr floats.MOVMF - - ; source: more_compares.p8:302 floats.print(f) - lda #p8v_f - jsr floats.MOVFM - jsr floats.print - ; source: more_compares.p8:300 while f<2.2 { - bra p8l_label_17_whileloop -p8l_label_18_afterwhile - ; source: more_compares.p8:304 floats.print(f) - lda #p8v_f - jsr floats.MOVFM - jsr floats.print - ; source: more_compares.p8:305 txt.print(" 2.2\n") - ldy #>prog8_interned_strings.string_21 - lda #-$4e20 - sta p8v_w - sty p8v_w+1 - - ; source: more_compares.p8:312 uword @shared uw = 2000 - lda #<$07d0 - ldy #>$07d0 - sta p8v_uw - sty p8v_uw+1 - - ; source: more_compares.p8:313 float @shared f = -100 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f - jsr floats.copy_float - ; source: more_compares.p8:315 byte @shared minus_100 = -100 - lda #-$64 - sta p8v_minus_100 - ; source: more_compares.p8:316 byte @shared minus_99 = -99 - lda #-$63 - sta p8v_minus_99 - ; source: more_compares.p8:317 byte @shared minus_20 = -20 - lda #-$14 - sta p8v_minus_20 - ; source: more_compares.p8:318 byte @shared minus_101 = -101 - lda #-$65 - sta p8v_minus_101 - ; source: more_compares.p8:319 ubyte @shared nineteen = 19 - lda #$13 - sta p8v_nineteen - ; source: more_compares.p8:320 ubyte @shared twenty = 20 - lda #$14 - sta p8v_twenty - ; source: more_compares.p8:321 ubyte @shared twenty1 = 21 - lda #$15 - sta p8v_twenty1 - ; source: more_compares.p8:322 ubyte @shared twohundred = 200 - lda #$c8 - sta p8v_twohundred - ; source: more_compares.p8:323 float @shared f_minus_100 = -100.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.copy_float - ; source: more_compares.p8:324 float @shared f_minus_101 = -101.0 - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_101 - jsr floats.copy_float - ; source: more_compares.p8:325 float @shared f_minus_99 = -99.0 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.copy_float - ; source: more_compares.p8:326 float @shared twodottwo = 2.2 - lda #prog8_float_const_3 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_twodottwo - jsr floats.copy_float - ; source: more_compares.p8:327 word @shared minus8000 = -8000 - lda #<-$1f40 - ldy #>-$1f40 - sta p8v_minus8000 - sty p8v_minus8000+1 - - ; source: more_compares.p8:328 word @shared eightthousand = 8000 - lda #<$1f40 - ldy #>$1f40 - sta p8v_eightthousand - sty p8v_eightthousand+1 - - ; source: more_compares.p8:329 word @shared w_min_20000 = -20000 - lda #<-$4e20 - ldy #>-$4e20 - sta p8v_w_min_20000 - sty p8v_w_min_20000+1 - - ; source: more_compares.p8:330 word @shared w_min_19999 = -19999 - lda #<-$4e1f - ldy #>-$4e1f - sta p8v_w_min_19999 - sty p8v_w_min_19999+1 - - ; source: more_compares.p8:331 word @shared w_min_20001 = -20001 - lda #<-$4e21 - ldy #>-$4e21 - sta p8v_w_min_20001 - sty p8v_w_min_20001+1 - - ; source: more_compares.p8:332 uword @shared twothousand = 2000 - lda #<$07d0 - ldy #>$07d0 - sta p8v_twothousand - sty p8v_twothousand+1 - - ; source: more_compares.p8:333 uword @shared twothousand1 = 2001 - lda #<$07d1 - ldy #>$07d1 - sta p8v_twothousand1 - sty p8v_twothousand1+1 - - ; source: more_compares.p8:334 uword @shared nineteen99 = 1999 - lda #<$07cf - ldy #>$07cf - sta p8v_nineteen99 - sty p8v_nineteen99+1 - - ; source: more_compares.p8:337 txt.print("all 1: ") - ldy #>prog8_interned_strings.string_9 - lda # minus_101 as ubyte) - lda p8v_minus_101 - sec - sbc p8v_b - bpl label_asm_306_else - lda #1 - bra label_asm_305_afterif -label_asm_306_else - lda #0 -label_asm_305_afterif - jsr txt.print_ub - ; source: more_compares.p8:343 txt.print_ub(b >= minus_100 as ubyte) - lda p8v_b - cmp p8v_minus_100 - bmi label_asm_308_else - lda #1 - bra label_asm_307_afterif -label_asm_308_else - lda #0 -label_asm_307_afterif - jsr txt.print_ub - ; source: more_compares.p8:344 txt.print_ub(ub ==twenty as ubyte) - lda p8v_ub - cmp p8v_twenty - bne label_asm_310_else - lda #1 - bra label_asm_309_afterif -label_asm_310_else - lda #0 -label_asm_309_afterif - jsr txt.print_ub - ; source: more_compares.p8:345 txt.print_ub(ub !=nineteen as ubyte) - lda p8v_ub - cmp p8v_nineteen - beq label_asm_312_else - lda #1 - bra label_asm_311_afterif -label_asm_312_else - lda #0 -label_asm_311_afterif - jsr txt.print_ub - ; source: more_compares.p8:346 txt.print_ub(ub nineteen as ubyte) - lda p8v_nineteen - cmp p8v_ub - bcs label_asm_316_else - lda #1 - bra label_asm_315_afterif -label_asm_316_else - lda #0 -label_asm_315_afterif - jsr txt.print_ub - ; source: more_compares.p8:349 txt.print_ub(ub>=twenty as ubyte) - lda p8v_ub - cmp p8b_main.p8s_test_compare_variable.p8v_twenty - rol a - and #1 - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:351 txt.print_ub(w == w_min_20000 as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000 - bne label_asm_318_else - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000+1 - bne label_asm_318_else - lda #1 - bra label_asm_317_afterif -label_asm_318_else - lda #0 -label_asm_317_afterif - jsr txt.print_ub - ; source: more_compares.p8:352 txt.print_ub(w != w_min_19999 as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_19999 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_19999+1 - beq label_asm_320_else -+ - lda #1 - bra label_asm_319_afterif -label_asm_320_else - lda #0 -label_asm_319_afterif - jsr txt.print_ub - ; source: more_compares.p8:353 txt.print_ub(w < w_min_19999 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_19999 - tya - sbc p8v_w_min_19999+1 - bvs + - eor #128 -+ bmi label_asm_322_else - lda #1 - bra label_asm_321_afterif -label_asm_322_else - lda #0 -label_asm_321_afterif - jsr txt.print_ub - ; source: more_compares.p8:354 txt.print_ub(w <= w_min_20000 as ubyte) - ldy p8v_w_min_20000+1 - lda p8v_w_min_20000 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_324_else - lda #1 - bra label_asm_323_afterif -label_asm_324_else - lda #0 -label_asm_323_afterif - jsr txt.print_ub - ; source: more_compares.p8:355 txt.print_ub(w > w_min_20001 as ubyte) - ldy p8v_w_min_20001+1 - lda p8v_w_min_20001 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_326_else - lda #1 - bra label_asm_325_afterif -label_asm_326_else - lda #0 -label_asm_325_afterif - jsr txt.print_ub - ; source: more_compares.p8:356 txt.print_ub(w >= w_min_20000 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_20000 - tya - sbc p8v_w_min_20000+1 - bvc + - eor #128 -+ bmi label_asm_328_else - lda #1 - bra label_asm_327_afterif -label_asm_328_else - lda #0 -label_asm_327_afterif - jsr txt.print_ub - ; source: more_compares.p8:357 txt.print_ub(uw == twothousand as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand - bne label_asm_330_else - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand+1 - bne label_asm_330_else - lda #1 - bra label_asm_329_afterif -label_asm_330_else - lda #0 -label_asm_329_afterif - jsr txt.print_ub - ; source: more_compares.p8:358 txt.print_ub(uw != twothousand1 as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand1 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand1+1 - beq label_asm_332_else -+ - lda #1 - bra label_asm_331_afterif -label_asm_332_else - lda #0 -label_asm_331_afterif - jsr txt.print_ub - ; source: more_compares.p8:359 txt.print_ub(uw < twothousand1 as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand1 - tya - sbc p8v_twothousand1+1 - bcs label_asm_334_else - lda #1 - bra label_asm_333_afterif -label_asm_334_else - lda #0 -label_asm_333_afterif - jsr txt.print_ub - ; source: more_compares.p8:360 txt.print_ub(uw <= twothousand as ubyte) - ldy p8v_twothousand+1 - lda p8v_twothousand - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_336_else - lda #1 - bra label_asm_335_afterif -label_asm_336_else - lda #0 -label_asm_335_afterif - jsr txt.print_ub - ; source: more_compares.p8:361 txt.print_ub(uw > nineteen99 as ubyte) - ldy p8v_nineteen99+1 - lda p8v_nineteen99 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_338_else - lda #1 - bra label_asm_337_afterif -label_asm_338_else - lda #0 -label_asm_337_afterif - jsr txt.print_ub - ; source: more_compares.p8:362 txt.print_ub(uw >= twothousand as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand - tya - sbc p8v_twothousand+1 - bcc label_asm_340_else - lda #1 - bra label_asm_339_afterif -label_asm_340_else - lda #0 -label_asm_339_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:364 txt.print_ub(f == f_minus_100 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.vars_equal_f - beq label_asm_342_else - lda #1 - bra label_asm_341_afterif -label_asm_342_else - lda #0 -label_asm_341_afterif - jsr txt.print_ub - ; source: more_compares.p8:365 txt.print_ub(f != f_minus_99 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.vars_equal_f - bne label_asm_344_else - lda #1 - bra label_asm_343_afterif -label_asm_344_else - lda #0 -label_asm_343_afterif - jsr txt.print_ub - ; source: more_compares.p8:366 txt.print_ub(f < f_minus_99 as ubyte) - lda #p8v_f_minus_99 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_346_else - lda #1 - bra label_asm_345_afterif -label_asm_346_else - lda #0 -label_asm_345_afterif - jsr txt.print_ub - ; source: more_compares.p8:367 txt.print_ub(f <= f_minus_100 as ubyte) - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_348_else - lda #1 - bra label_asm_347_afterif -label_asm_348_else - lda #0 -label_asm_347_afterif - jsr txt.print_ub - ; source: more_compares.p8:368 txt.print_ub(f > f_minus_101 as ubyte) - lda #p8v_f_minus_101 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_350_else - lda #1 - bra label_asm_349_afterif -label_asm_350_else - lda #0 -label_asm_349_afterif - jsr txt.print_ub - ; source: more_compares.p8:369 txt.print_ub(f >= f_minus_100 as ubyte) - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_352_else - lda #1 - bra label_asm_351_afterif -label_asm_352_else - lda #0 -label_asm_351_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:372 txt.print("all 0: ") - ldy #>prog8_interned_strings.string_10 - lda # minus_100 as ubyte) - lda p8v_minus_100 - sec - sbc p8v_b - bpl label_asm_362_else - lda #1 - bra label_asm_361_afterif -label_asm_362_else - lda #0 -label_asm_361_afterif - jsr txt.print_ub - ; source: more_compares.p8:378 txt.print_ub(b >= minus_99 as ubyte) - lda p8v_b - cmp p8v_minus_99 - bmi label_asm_364_else - lda #1 - bra label_asm_363_afterif -label_asm_364_else - lda #0 -label_asm_363_afterif - jsr txt.print_ub - ; source: more_compares.p8:379 txt.print_ub(ub ==twenty1 as ubyte) - lda p8v_ub - cmp p8v_twenty1 - bne label_asm_366_else - lda #1 - bra label_asm_365_afterif -label_asm_366_else - lda #0 -label_asm_365_afterif - jsr txt.print_ub - ; source: more_compares.p8:380 txt.print_ub(ub !=twenty as ubyte) - lda p8v_ub - cmp p8v_twenty - beq label_asm_368_else - lda #1 - bra label_asm_367_afterif -label_asm_368_else - lda #0 -label_asm_367_afterif - jsr txt.print_ub - ; source: more_compares.p8:381 txt.print_ub(ub twenty as ubyte) - lda p8v_twenty - cmp p8v_ub - bcs label_asm_372_else - lda #1 - bra label_asm_371_afterif -label_asm_372_else - lda #0 -label_asm_371_afterif - jsr txt.print_ub - ; source: more_compares.p8:384 txt.print_ub(ub>=twenty1 as ubyte) - lda p8v_ub - cmp p8b_main.p8s_test_compare_variable.p8v_twenty1 - rol a - and #1 - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:386 txt.print_ub(w == w_min_20001 as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20001 - bne label_asm_374_else - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20001+1 - bne label_asm_374_else - lda #1 - bra label_asm_373_afterif -label_asm_374_else - lda #0 -label_asm_373_afterif - jsr txt.print_ub - ; source: more_compares.p8:387 txt.print_ub(w != w_min_20000 as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000+1 - beq label_asm_376_else -+ - lda #1 - bra label_asm_375_afterif -label_asm_376_else - lda #0 -label_asm_375_afterif - jsr txt.print_ub - ; source: more_compares.p8:388 txt.print_ub(w < w_min_20000 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_20000 - tya - sbc p8v_w_min_20000+1 - bvs + - eor #128 -+ bmi label_asm_378_else - lda #1 - bra label_asm_377_afterif -label_asm_378_else - lda #0 -label_asm_377_afterif - jsr txt.print_ub - ; source: more_compares.p8:389 txt.print_ub(w <= w_min_20001 as ubyte) - ldy p8v_w_min_20001+1 - lda p8v_w_min_20001 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_380_else - lda #1 - bra label_asm_379_afterif -label_asm_380_else - lda #0 -label_asm_379_afterif - jsr txt.print_ub - ; source: more_compares.p8:390 txt.print_ub(w > w_min_20000 as ubyte) - ldy p8v_w_min_20000+1 - lda p8v_w_min_20000 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_382_else - lda #1 - bra label_asm_381_afterif -label_asm_382_else - lda #0 -label_asm_381_afterif - jsr txt.print_ub - ; source: more_compares.p8:391 txt.print_ub(w >= w_min_19999 as ubyte) - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_19999 - tya - sbc p8v_w_min_19999+1 - bvc + - eor #128 -+ bmi label_asm_384_else - lda #1 - bra label_asm_383_afterif -label_asm_384_else - lda #0 -label_asm_383_afterif - jsr txt.print_ub - ; source: more_compares.p8:392 txt.print_ub(uw == nineteen99 as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_nineteen99 - bne label_asm_386_else - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_nineteen99+1 - bne label_asm_386_else - lda #1 - bra label_asm_385_afterif -label_asm_386_else - lda #0 -label_asm_385_afterif - jsr txt.print_ub - ; source: more_compares.p8:393 txt.print_ub(uw != twothousand as ubyte) - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand - bne + - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand+1 - beq label_asm_388_else -+ - lda #1 - bra label_asm_387_afterif -label_asm_388_else - lda #0 -label_asm_387_afterif - jsr txt.print_ub - ; source: more_compares.p8:394 txt.print_ub(uw < twothousand as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand - tya - sbc p8v_twothousand+1 - bcs label_asm_390_else - lda #1 - bra label_asm_389_afterif -label_asm_390_else - lda #0 -label_asm_389_afterif - jsr txt.print_ub - ; source: more_compares.p8:395 txt.print_ub(uw <= nineteen99 as ubyte) - ldy p8v_nineteen99+1 - lda p8v_nineteen99 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_392_else - lda #1 - bra label_asm_391_afterif -label_asm_392_else - lda #0 -label_asm_391_afterif - jsr txt.print_ub - ; source: more_compares.p8:396 txt.print_ub(uw > twothousand as ubyte) - ldy p8v_twothousand+1 - lda p8v_twothousand - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_394_else - lda #1 - bra label_asm_393_afterif -label_asm_394_else - lda #0 -label_asm_393_afterif - jsr txt.print_ub - ; source: more_compares.p8:397 txt.print_ub(uw >= twothousand1 as ubyte) - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand1 - tya - sbc p8v_twothousand1+1 - bcc label_asm_396_else - lda #1 - bra label_asm_395_afterif -label_asm_396_else - lda #0 -label_asm_395_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:399 txt.print_ub(f == f_minus_99 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.vars_equal_f - beq label_asm_398_else - lda #1 - bra label_asm_397_afterif -label_asm_398_else - lda #0 -label_asm_397_afterif - jsr txt.print_ub - ; source: more_compares.p8:400 txt.print_ub(f != f_minus_100 as ubyte) - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.vars_equal_f - bne label_asm_400_else - lda #1 - bra label_asm_399_afterif -label_asm_400_else - lda #0 -label_asm_399_afterif - jsr txt.print_ub - ; source: more_compares.p8:401 txt.print_ub(f < f_minus_100 as ubyte) - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_402_else - lda #1 - bra label_asm_401_afterif -label_asm_402_else - lda #0 -label_asm_401_afterif - jsr txt.print_ub - ; source: more_compares.p8:402 txt.print_ub(f <= f_minus_101 as ubyte) - lda #p8v_f_minus_101 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_404_else - lda #1 - bra label_asm_403_afterif -label_asm_404_else - lda #0 -label_asm_403_afterif - jsr txt.print_ub - ; source: more_compares.p8:403 txt.print_ub(f > f_minus_100 as ubyte) - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_406_else - lda #1 - bra label_asm_405_afterif -label_asm_406_else - lda #0 -label_asm_405_afterif - jsr txt.print_ub - ; source: more_compares.p8:404 txt.print_ub(f >= f_minus_99 as ubyte) - lda #p8v_f_minus_99 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_408_else - lda #1 - bra label_asm_407_afterif -label_asm_408_else - lda #0 -label_asm_407_afterif - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:407 txt.print("all .: ") - ldy #>prog8_interned_strings.string_11 - lda # minus_101 txt.chrout('.') - lda p8v_minus_101 - sec - sbc p8v_b - bpl label_asm_413_afterif - lda #$2e - jsr txt.chrout -label_asm_413_afterif - ; source: more_compares.p8:413 if b >= minus_100 txt.chrout('.') - lda p8v_b - cmp p8v_minus_100 - bmi label_asm_414_afterif - lda #$2e - jsr txt.chrout -label_asm_414_afterif - ; source: more_compares.p8:414 if ub == twenty txt.chrout('.') - lda p8v_ub - cmp p8v_twenty - bne label_asm_415_afterif - lda #$2e - jsr txt.chrout -label_asm_415_afterif - ; source: more_compares.p8:415 if ub != nineteen txt.chrout('.') - lda p8v_ub - cmp p8v_nineteen - beq label_asm_416_afterif - lda #$2e - jsr txt.chrout -label_asm_416_afterif - ; source: more_compares.p8:416 if ub < twenty1 txt.chrout('.') - lda p8v_ub - cmp p8v_twenty1 - bcs label_asm_417_afterif - lda #$2e - jsr txt.chrout -label_asm_417_afterif - ; source: more_compares.p8:417 if ub <= twenty txt.chrout('.') - lda p8v_twenty - cmp p8v_ub - bcc label_asm_418_afterif - lda #$2e - jsr txt.chrout -label_asm_418_afterif - ; source: more_compares.p8:418 if ub> nineteen txt.chrout('.') - lda p8v_nineteen - cmp p8v_ub - bcs label_asm_419_afterif - lda #$2e - jsr txt.chrout -label_asm_419_afterif - ; source: more_compares.p8:419 if ub>= twenty txt.chrout('.') - lda p8v_ub - cmp p8v_twenty - bcc label_asm_420_afterif - lda #$2e - jsr txt.chrout -label_asm_420_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:421 if w == w_min_20000 txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000 - bne label_asm_421_afterif - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000+1 - bne label_asm_421_afterif - lda #$2e - jsr txt.chrout -label_asm_421_afterif - ; source: more_compares.p8:422 if w != w_min_19999 txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_19999 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_19999+1 - beq label_asm_422_afterif -+ - lda #$2e - jsr txt.chrout -label_asm_422_afterif - ; source: more_compares.p8:423 if w < w_min_19999 txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_19999 - tya - sbc p8v_w_min_19999+1 - bvs + - eor #128 -+ bmi label_asm_423_afterif - lda #$2e - jsr txt.chrout -label_asm_423_afterif - ; source: more_compares.p8:424 if w <= w_min_20000 txt.chrout('.') - ldy p8v_w_min_20000+1 - lda p8v_w_min_20000 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_424_afterif - lda #$2e - jsr txt.chrout -label_asm_424_afterif - ; source: more_compares.p8:425 if w > w_min_20001 txt.chrout('.') - ldy p8v_w_min_20001+1 - lda p8v_w_min_20001 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_425_afterif - lda #$2e - jsr txt.chrout -label_asm_425_afterif - ; source: more_compares.p8:426 if w >= w_min_20000 txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_20000 - tya - sbc p8v_w_min_20000+1 - bvc + - eor #128 -+ bmi label_asm_426_afterif - lda #$2e - jsr txt.chrout -label_asm_426_afterif - ; source: more_compares.p8:427 if uw == twothousand txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand - bne label_asm_427_afterif - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand+1 - bne label_asm_427_afterif - lda #$2e - jsr txt.chrout -label_asm_427_afterif - ; source: more_compares.p8:428 if uw != twothousand1 txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand1 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand1+1 - beq label_asm_428_afterif -+ - lda #$2e - jsr txt.chrout -label_asm_428_afterif - ; source: more_compares.p8:429 if uw < twothousand1 txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand1 - tya - sbc p8v_twothousand1+1 - bcs label_asm_429_afterif - lda #$2e - jsr txt.chrout -label_asm_429_afterif - ; source: more_compares.p8:430 if uw <= twothousand txt.chrout('.') - ldy p8v_twothousand+1 - lda p8v_twothousand - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_430_afterif - lda #$2e - jsr txt.chrout -label_asm_430_afterif - ; source: more_compares.p8:431 if uw > nineteen99 txt.chrout('.') - ldy p8v_nineteen99+1 - lda p8v_nineteen99 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_431_afterif - lda #$2e - jsr txt.chrout -label_asm_431_afterif - ; source: more_compares.p8:432 if uw >= twothousand txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand - tya - sbc p8v_twothousand+1 - bcc label_asm_432_afterif - lda #$2e - jsr txt.chrout -label_asm_432_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:434 if f == f_minus_100 txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.vars_equal_f - beq label_asm_433_afterif - lda #$2e - jsr txt.chrout -label_asm_433_afterif - ; source: more_compares.p8:435 if f != f_minus_99 txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.vars_equal_f - bne label_asm_434_afterif - lda #$2e - jsr txt.chrout -label_asm_434_afterif - ; source: more_compares.p8:436 if f < f_minus_99 txt.chrout('.') - lda #p8v_f_minus_99 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_435_afterif - lda #$2e - jsr txt.chrout -label_asm_435_afterif - ; source: more_compares.p8:437 if f <= f_minus_100 txt.chrout('.') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_436_afterif - lda #$2e - jsr txt.chrout -label_asm_436_afterif - ; source: more_compares.p8:438 if f > f_minus_101 txt.chrout('.') - lda #p8v_f_minus_101 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_437_afterif - lda #$2e - jsr txt.chrout -label_asm_437_afterif - ; source: more_compares.p8:439 if f >= f_minus_100 txt.chrout('.') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_438_afterif - lda #$2e - jsr txt.chrout -label_asm_438_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:442 txt.print(" no !: ") - ldy #>prog8_interned_strings.string_12 - lda # minus_100 txt.chrout('!') - lda p8v_minus_100 - sec - sbc p8v_b - bpl label_asm_443_afterif - lda #$21 - jsr txt.chrout -label_asm_443_afterif - ; source: more_compares.p8:448 if b >= minus_99 txt.chrout('!') - lda p8v_b - cmp p8v_minus_99 - bmi label_asm_444_afterif - lda #$21 - jsr txt.chrout -label_asm_444_afterif - ; source: more_compares.p8:449 if ub == twenty1 txt.chrout('!') - lda p8v_ub - cmp p8v_twenty1 - bne label_asm_445_afterif - lda #$21 - jsr txt.chrout -label_asm_445_afterif - ; source: more_compares.p8:450 if ub != twenty txt.chrout('!') - lda p8v_ub - cmp p8v_twenty - beq label_asm_446_afterif - lda #$21 - jsr txt.chrout -label_asm_446_afterif - ; source: more_compares.p8:451 if ub < twenty txt.chrout('!') - lda p8v_ub - cmp p8v_twenty - bcs label_asm_447_afterif - lda #$21 - jsr txt.chrout -label_asm_447_afterif - ; source: more_compares.p8:452 if ub <= nineteen txt.chrout('!') - lda p8v_nineteen - cmp p8v_ub - bcc label_asm_448_afterif - lda #$21 - jsr txt.chrout -label_asm_448_afterif - ; source: more_compares.p8:453 if ub> twenty txt.chrout('!') - lda p8v_twenty - cmp p8v_ub - bcs label_asm_449_afterif - lda #$21 - jsr txt.chrout -label_asm_449_afterif - ; source: more_compares.p8:454 if ub>= twenty1 txt.chrout('!') - lda p8v_ub - cmp p8v_twenty1 - bcc label_asm_450_afterif - lda #$21 - jsr txt.chrout -label_asm_450_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:456 if w == w_min_20001 txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20001 - bne label_asm_451_afterif - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20001+1 - bne label_asm_451_afterif - lda #$21 - jsr txt.chrout -label_asm_451_afterif - ; source: more_compares.p8:457 if w != w_min_20000 txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000+1 - beq label_asm_452_afterif -+ - lda #$21 - jsr txt.chrout -label_asm_452_afterif - ; source: more_compares.p8:458 if w < w_min_20000 txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_20000 - tya - sbc p8v_w_min_20000+1 - bvs + - eor #128 -+ bmi label_asm_453_afterif - lda #$21 - jsr txt.chrout -label_asm_453_afterif - ; source: more_compares.p8:459 if w <= w_min_20001 txt.chrout('!') - ldy p8v_w_min_20001+1 - lda p8v_w_min_20001 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_454_afterif - lda #$21 - jsr txt.chrout -label_asm_454_afterif - ; source: more_compares.p8:460 if w > w_min_20000 txt.chrout('!') - ldy p8v_w_min_20000+1 - lda p8v_w_min_20000 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_455_afterif - lda #$21 - jsr txt.chrout -label_asm_455_afterif - ; source: more_compares.p8:461 if w >= w_min_19999 txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_19999 - tya - sbc p8v_w_min_19999+1 - bvc + - eor #128 -+ bmi label_asm_456_afterif - lda #$21 - jsr txt.chrout -label_asm_456_afterif - ; source: more_compares.p8:462 if uw == nineteen99 txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_nineteen99 - bne label_asm_457_afterif - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_nineteen99+1 - bne label_asm_457_afterif - lda #$21 - jsr txt.chrout -label_asm_457_afterif - ; source: more_compares.p8:463 if uw != twothousand txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand - bne + - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand+1 - beq label_asm_458_afterif -+ - lda #$21 - jsr txt.chrout -label_asm_458_afterif - ; source: more_compares.p8:464 if uw < twothousand txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand - tya - sbc p8v_twothousand+1 - bcs label_asm_459_afterif - lda #$21 - jsr txt.chrout -label_asm_459_afterif - ; source: more_compares.p8:465 if uw <= nineteen99 txt.chrout('!') - ldy p8v_nineteen99+1 - lda p8v_nineteen99 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_460_afterif - lda #$21 - jsr txt.chrout -label_asm_460_afterif - ; source: more_compares.p8:466 if uw > twothousand txt.chrout('!') - ldy p8v_twothousand+1 - lda p8v_twothousand - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_461_afterif - lda #$21 - jsr txt.chrout -label_asm_461_afterif - ; source: more_compares.p8:467 if uw >= twothousand1 txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand1 - tya - sbc p8v_twothousand1+1 - bcc label_asm_462_afterif - lda #$21 - jsr txt.chrout -label_asm_462_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:469 if f == f_minus_99 txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.vars_equal_f - beq label_asm_463_afterif - lda #$21 - jsr txt.chrout -label_asm_463_afterif - ; source: more_compares.p8:470 if f != f_minus_100 txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.vars_equal_f - bne label_asm_464_afterif - lda #$21 - jsr txt.chrout -label_asm_464_afterif - ; source: more_compares.p8:471 if f < f_minus_100 txt.chrout('!') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_465_afterif - lda #$21 - jsr txt.chrout -label_asm_465_afterif - ; source: more_compares.p8:472 if f <= f_minus_101 txt.chrout('!') - lda #p8v_f_minus_101 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_466_afterif - lda #$21 - jsr txt.chrout -label_asm_466_afterif - ; source: more_compares.p8:473 if f > f_minus_100 txt.chrout('!') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_467_afterif - lda #$21 - jsr txt.chrout -label_asm_467_afterif - ; source: more_compares.p8:474 if f >= f_minus_99 txt.chrout('!') - lda #p8v_f_minus_99 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_468_afterif - lda #$21 - jsr txt.chrout -label_asm_468_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:477 txt.print("all .: ") - ldy #>prog8_interned_strings.string_11 - lda # minus_101 txt.chrout('.') else txt.chrout('!') - lda p8v_minus_101 - sec - sbc p8v_b - bpl label_asm_478_else - lda #$2e - jsr txt.chrout - bra label_asm_477_afterif -label_asm_478_else - lda #$21 - jsr txt.chrout -label_asm_477_afterif - ; source: more_compares.p8:483 if b >= minus_100 txt.chrout('.') else txt.chrout('!') - lda p8v_b - cmp p8v_minus_100 - bmi label_asm_480_else - lda #$2e - jsr txt.chrout - bra label_asm_479_afterif -label_asm_480_else - lda #$21 - jsr txt.chrout -label_asm_479_afterif - ; source: more_compares.p8:484 if ub == twenty txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp p8v_twenty - bne label_asm_482_else - lda #$2e - jsr txt.chrout - bra label_asm_481_afterif -label_asm_482_else - lda #$21 - jsr txt.chrout -label_asm_481_afterif - ; source: more_compares.p8:485 if ub != nineteen txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp p8v_nineteen - beq label_asm_484_else - lda #$2e - jsr txt.chrout - bra label_asm_483_afterif -label_asm_484_else - lda #$21 - jsr txt.chrout -label_asm_483_afterif - ; source: more_compares.p8:486 if ub < twenty1 txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp p8v_twenty1 - bcs label_asm_486_else - lda #$2e - jsr txt.chrout - bra label_asm_485_afterif -label_asm_486_else - lda #$21 - jsr txt.chrout -label_asm_485_afterif - ; source: more_compares.p8:487 if ub <= twenty txt.chrout('.') else txt.chrout('!') - lda p8v_twenty - cmp p8v_ub - bcc label_asm_488_else - lda #$2e - jsr txt.chrout - bra label_asm_487_afterif -label_asm_488_else - lda #$21 - jsr txt.chrout -label_asm_487_afterif - ; source: more_compares.p8:488 if ub> nineteen txt.chrout('.') else txt.chrout('!') - lda p8v_nineteen - cmp p8v_ub - bcs label_asm_490_else - lda #$2e - jsr txt.chrout - bra label_asm_489_afterif -label_asm_490_else - lda #$21 - jsr txt.chrout -label_asm_489_afterif - ; source: more_compares.p8:489 if ub>=twenty txt.chrout('.') else txt.chrout('!') - lda p8v_ub - cmp p8v_twenty - bcc label_asm_492_else - lda #$2e - jsr txt.chrout - bra label_asm_491_afterif -label_asm_492_else - lda #$21 - jsr txt.chrout -label_asm_491_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:491 if w == w_min_20000 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000 - bne label_asm_494_else - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000+1 - bne label_asm_494_else - lda #$2e - jsr txt.chrout - bra label_asm_493_afterif -label_asm_494_else - lda #$21 - jsr txt.chrout -label_asm_493_afterif - ; source: more_compares.p8:492 if w != w_min_19999 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_19999 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_19999+1 - beq label_asm_496_else -+ - lda #$2e - jsr txt.chrout - bra label_asm_495_afterif -label_asm_496_else - lda #$21 - jsr txt.chrout -label_asm_495_afterif - ; source: more_compares.p8:493 if w < w_min_19999 txt.chrout('.') else txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_19999 - tya - sbc p8v_w_min_19999+1 - bvs + - eor #128 -+ bmi label_asm_498_else - lda #$2e - jsr txt.chrout - bra label_asm_497_afterif -label_asm_498_else - lda #$21 - jsr txt.chrout -label_asm_497_afterif - ; source: more_compares.p8:494 if w <= w_min_20000 txt.chrout('.') else txt.chrout('!') - ldy p8v_w_min_20000+1 - lda p8v_w_min_20000 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_500_else - lda #$2e - jsr txt.chrout - bra label_asm_499_afterif -label_asm_500_else - lda #$21 - jsr txt.chrout -label_asm_499_afterif - ; source: more_compares.p8:495 if w > w_min_20001 txt.chrout('.') else txt.chrout('!') - ldy p8v_w_min_20001+1 - lda p8v_w_min_20001 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_502_else - lda #$2e - jsr txt.chrout - bra label_asm_501_afterif -label_asm_502_else - lda #$21 - jsr txt.chrout -label_asm_501_afterif - ; source: more_compares.p8:496 if w >= w_min_20000 txt.chrout('.') else txt.chrout('!') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_20000 - tya - sbc p8v_w_min_20000+1 - bvc + - eor #128 -+ bmi label_asm_504_else - lda #$2e - jsr txt.chrout - bra label_asm_503_afterif -label_asm_504_else - lda #$21 - jsr txt.chrout -label_asm_503_afterif - ; source: more_compares.p8:497 if uw == twothousand txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand - bne label_asm_506_else - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand+1 - bne label_asm_506_else - lda #$2e - jsr txt.chrout - bra label_asm_505_afterif -label_asm_506_else - lda #$21 - jsr txt.chrout -label_asm_505_afterif - ; source: more_compares.p8:498 if uw != twothousand1 txt.chrout('.') else txt.chrout('!') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand1 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand1+1 - beq label_asm_508_else -+ - lda #$2e - jsr txt.chrout - bra label_asm_507_afterif -label_asm_508_else - lda #$21 - jsr txt.chrout -label_asm_507_afterif - ; source: more_compares.p8:499 if uw < twothousand1 txt.chrout('.') else txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand1 - tya - sbc p8v_twothousand1+1 - bcs label_asm_510_else - lda #$2e - jsr txt.chrout - bra label_asm_509_afterif -label_asm_510_else - lda #$21 - jsr txt.chrout -label_asm_509_afterif - ; source: more_compares.p8:500 if uw <= twothousand txt.chrout('.') else txt.chrout('!') - ldy p8v_twothousand+1 - lda p8v_twothousand - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_512_else - lda #$2e - jsr txt.chrout - bra label_asm_511_afterif -label_asm_512_else - lda #$21 - jsr txt.chrout -label_asm_511_afterif - ; source: more_compares.p8:501 if uw > nineteen99 txt.chrout('.') else txt.chrout('!') - ldy p8v_nineteen99+1 - lda p8v_nineteen99 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_514_else - lda #$2e - jsr txt.chrout - bra label_asm_513_afterif -label_asm_514_else - lda #$21 - jsr txt.chrout -label_asm_513_afterif - ; source: more_compares.p8:502 if uw >= twothousand txt.chrout('.') else txt.chrout('!') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand - tya - sbc p8v_twothousand+1 - bcc label_asm_516_else - lda #$2e - jsr txt.chrout - bra label_asm_515_afterif -label_asm_516_else - lda #$21 - jsr txt.chrout -label_asm_515_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:504 if f == f_minus_100 txt.chrout('.') else txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.vars_equal_f - beq label_asm_518_else - lda #$2e - jsr txt.chrout - bra label_asm_517_afterif -label_asm_518_else - lda #$21 - jsr txt.chrout -label_asm_517_afterif - ; source: more_compares.p8:505 if f != f_minus_99 txt.chrout('.') else txt.chrout('!') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.vars_equal_f - bne label_asm_520_else - lda #$2e - jsr txt.chrout - bra label_asm_519_afterif -label_asm_520_else - lda #$21 - jsr txt.chrout -label_asm_519_afterif - ; source: more_compares.p8:506 if f < f_minus_99 txt.chrout('.') else txt.chrout('!') - lda #p8v_f_minus_99 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_522_else - lda #$2e - jsr txt.chrout - bra label_asm_521_afterif -label_asm_522_else - lda #$21 - jsr txt.chrout -label_asm_521_afterif - ; source: more_compares.p8:507 if f <= f_minus_100 txt.chrout('.') else txt.chrout('!') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_524_else - lda #$2e - jsr txt.chrout - bra label_asm_523_afterif -label_asm_524_else - lda #$21 - jsr txt.chrout -label_asm_523_afterif - ; source: more_compares.p8:508 if f > f_minus_101 txt.chrout('.') else txt.chrout('!') - lda #p8v_f_minus_101 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_526_else - lda #$2e - jsr txt.chrout - bra label_asm_525_afterif -label_asm_526_else - lda #$21 - jsr txt.chrout -label_asm_525_afterif - ; source: more_compares.p8:509 if f >= f_minus_100 txt.chrout('.') else txt.chrout('!') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_528_else - lda #$2e - jsr txt.chrout - bra label_asm_527_afterif -label_asm_528_else - lda #$21 - jsr txt.chrout -label_asm_527_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:512 txt.print("all .: ") - ldy #>prog8_interned_strings.string_11 - lda # minus_100 txt.chrout('!') else txt.chrout('.') - lda p8v_minus_100 - sec - sbc p8v_b - bpl label_asm_538_else - lda #$21 - jsr txt.chrout - bra label_asm_537_afterif -label_asm_538_else - lda #$2e - jsr txt.chrout -label_asm_537_afterif - ; source: more_compares.p8:518 if b >= minus_99 txt.chrout('!') else txt.chrout('.') - lda p8v_b - cmp p8v_minus_99 - bmi label_asm_540_else - lda #$21 - jsr txt.chrout - bra label_asm_539_afterif -label_asm_540_else - lda #$2e - jsr txt.chrout -label_asm_539_afterif - ; source: more_compares.p8:519 if ub == twenty1 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp p8v_twenty1 - bne label_asm_542_else - lda #$21 - jsr txt.chrout - bra label_asm_541_afterif -label_asm_542_else - lda #$2e - jsr txt.chrout -label_asm_541_afterif - ; source: more_compares.p8:520 if ub !=twenty txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp p8v_twenty - beq label_asm_544_else - lda #$21 - jsr txt.chrout - bra label_asm_543_afterif -label_asm_544_else - lda #$2e - jsr txt.chrout -label_asm_543_afterif - ; source: more_compares.p8:521 if ub twenty txt.chrout('!') else txt.chrout('.') - lda p8v_twenty - cmp p8v_ub - bcs label_asm_550_else - lda #$21 - jsr txt.chrout - bra label_asm_549_afterif -label_asm_550_else - lda #$2e - jsr txt.chrout -label_asm_549_afterif - ; source: more_compares.p8:524 if ub>= twenty1 txt.chrout('!') else txt.chrout('.') - lda p8v_ub - cmp p8v_twenty1 - bcc label_asm_552_else - lda #$21 - jsr txt.chrout - bra label_asm_551_afterif -label_asm_552_else - lda #$2e - jsr txt.chrout -label_asm_551_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:526 if w == w_min_20001 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20001 - bne label_asm_554_else - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20001+1 - bne label_asm_554_else - lda #$21 - jsr txt.chrout - bra label_asm_553_afterif -label_asm_554_else - lda #$2e - jsr txt.chrout -label_asm_553_afterif - ; source: more_compares.p8:527 if w != w_min_20000 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_w - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000 - bne + - lda p8b_main.p8s_test_compare_variable.p8v_w+1 - cmp p8b_main.p8s_test_compare_variable.p8v_w_min_20000+1 - beq label_asm_556_else -+ - lda #$21 - jsr txt.chrout - bra label_asm_555_afterif -label_asm_556_else - lda #$2e - jsr txt.chrout -label_asm_555_afterif - ; source: more_compares.p8:528 if w < w_min_20000 txt.chrout('!') else txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_20000 - tya - sbc p8v_w_min_20000+1 - bvs + - eor #128 -+ bmi label_asm_558_else - lda #$21 - jsr txt.chrout - bra label_asm_557_afterif -label_asm_558_else - lda #$2e - jsr txt.chrout -label_asm_557_afterif - ; source: more_compares.p8:529 if w <= w_min_20001 txt.chrout('!') else txt.chrout('.') - ldy p8v_w_min_20001+1 - lda p8v_w_min_20001 - cmp p8v_w - tya - sbc p8v_w+1 - bvc + - eor #128 -+ bmi label_asm_560_else - lda #$21 - jsr txt.chrout - bra label_asm_559_afterif -label_asm_560_else - lda #$2e - jsr txt.chrout -label_asm_559_afterif - ; source: more_compares.p8:530 if w > w_min_20000 txt.chrout('!') else txt.chrout('.') - ldy p8v_w_min_20000+1 - lda p8v_w_min_20000 - cmp p8v_w - tya - sbc p8v_w+1 - bvs + - eor #128 -+ bmi label_asm_562_else - lda #$21 - jsr txt.chrout - bra label_asm_561_afterif -label_asm_562_else - lda #$2e - jsr txt.chrout -label_asm_561_afterif - ; source: more_compares.p8:531 if w >= w_min_19999 txt.chrout('!') else txt.chrout('.') - ldy p8v_w+1 - lda p8v_w - cmp p8v_w_min_19999 - tya - sbc p8v_w_min_19999+1 - bvc + - eor #128 -+ bmi label_asm_564_else - lda #$21 - jsr txt.chrout - bra label_asm_563_afterif -label_asm_564_else - lda #$2e - jsr txt.chrout -label_asm_563_afterif - ; source: more_compares.p8:532 if uw == nineteen99 txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_nineteen99 - bne label_asm_566_else - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_nineteen99+1 - bne label_asm_566_else - lda #$21 - jsr txt.chrout - bra label_asm_565_afterif -label_asm_566_else - lda #$2e - jsr txt.chrout -label_asm_565_afterif - ; source: more_compares.p8:533 if uw != twothousand txt.chrout('!') else txt.chrout('.') - lda p8b_main.p8s_test_compare_variable.p8v_uw - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand - bne + - lda p8b_main.p8s_test_compare_variable.p8v_uw+1 - cmp p8b_main.p8s_test_compare_variable.p8v_twothousand+1 - beq label_asm_568_else -+ - lda #$21 - jsr txt.chrout - bra label_asm_567_afterif -label_asm_568_else - lda #$2e - jsr txt.chrout -label_asm_567_afterif - ; source: more_compares.p8:534 if uw < twothousand txt.chrout('!') else txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand - tya - sbc p8v_twothousand+1 - bcs label_asm_570_else - lda #$21 - jsr txt.chrout - bra label_asm_569_afterif -label_asm_570_else - lda #$2e - jsr txt.chrout -label_asm_569_afterif - ; source: more_compares.p8:535 if uw <= nineteen99 txt.chrout('!') else txt.chrout('.') - ldy p8v_nineteen99+1 - lda p8v_nineteen99 - cmp p8v_uw - tya - sbc p8v_uw+1 - bcc label_asm_572_else - lda #$21 - jsr txt.chrout - bra label_asm_571_afterif -label_asm_572_else - lda #$2e - jsr txt.chrout -label_asm_571_afterif - ; source: more_compares.p8:536 if uw > twothousand txt.chrout('!') else txt.chrout('.') - ldy p8v_twothousand+1 - lda p8v_twothousand - cmp p8v_uw - tya - sbc p8v_uw+1 - bcs label_asm_574_else - lda #$21 - jsr txt.chrout - bra label_asm_573_afterif -label_asm_574_else - lda #$2e - jsr txt.chrout -label_asm_573_afterif - ; source: more_compares.p8:537 if uw >= twothousand1 txt.chrout('!') else txt.chrout('.') - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_twothousand1 - tya - sbc p8v_twothousand1+1 - bcc label_asm_576_else - lda #$21 - jsr txt.chrout - bra label_asm_575_afterif -label_asm_576_else - lda #$2e - jsr txt.chrout -label_asm_575_afterif - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: more_compares.p8:539 if f == f_minus_99 txt.chrout('!') else txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_99 - jsr floats.vars_equal_f - beq label_asm_578_else - lda #$21 - jsr txt.chrout - bra label_asm_577_afterif -label_asm_578_else - lda #$2e - jsr txt.chrout -label_asm_577_afterif - ; source: more_compares.p8:540 if f != f_minus_100 txt.chrout('!') else txt.chrout('.') - lda #p8v_f - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f_minus_100 - jsr floats.vars_equal_f - bne label_asm_580_else - lda #$21 - jsr txt.chrout - bra label_asm_579_afterif -label_asm_580_else - lda #$2e - jsr txt.chrout -label_asm_579_afterif - ; source: more_compares.p8:541 if f < f_minus_100 txt.chrout('!') else txt.chrout('.') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq label_asm_582_else - lda #$21 - jsr txt.chrout - bra label_asm_581_afterif -label_asm_582_else - lda #$2e - jsr txt.chrout -label_asm_581_afterif - ; source: more_compares.p8:542 if f <= f_minus_101 txt.chrout('!') else txt.chrout('.') - lda #p8v_f_minus_101 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - beq label_asm_584_else - lda #$21 - jsr txt.chrout - bra label_asm_583_afterif -label_asm_584_else - lda #$2e - jsr txt.chrout -label_asm_583_afterif - ; source: more_compares.p8:543 if f > f_minus_100 txt.chrout('!') else txt.chrout('.') - lda #p8v_f_minus_100 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_lesseq_f - bne label_asm_586_else - lda #$21 - jsr txt.chrout - bra label_asm_585_afterif -label_asm_586_else - lda #$2e - jsr txt.chrout -label_asm_585_afterif - ; source: more_compares.p8:544 if f >= f_minus_99 txt.chrout('!') else txt.chrout('.') - lda #p8v_f_minus_99 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - bne label_asm_588_else - lda #$21 - jsr txt.chrout - bra label_asm_587_afterif -label_asm_588_else - lda #$2e - jsr txt.chrout -label_asm_587_afterif - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jsr txt.chrout - ; source: more_compares.p8:548 b = minus_100 - lda p8v_minus_100 - sta p8v_b - - ; source: more_compares.p8:549 while b <= minus_20 -p8l_label_19_whileloop - lda p8v_minus_20 - sec - sbc p8v_b - bmi p8l_label_20_afterwhile - ; source: more_compares.p8:550 b++ - inc p8v_b - ; source: more_compares.p8:549 while b <= minus_20 - bra p8l_label_19_whileloop -p8l_label_20_afterwhile - ; source: more_compares.p8:551 txt.print_b(b) - lda p8v_b - jsr txt.print_b - ; source: more_compares.p8:552 txt.print(" -19\n") - ldy #>prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #prog8_interned_strings.string_17 - lda #prog8_interned_strings.string_18 - lda #$07d0 - sta p8v_uw - sty p8v_uw+1 - - ; source: more_compares.p8:584 while uw <= eightthousand { -p8l_label_31_whileloop - lda p8v_uw - sta P8ZP_SCRATCH_W2 - lda p8v_uw+1 - sta P8ZP_SCRATCH_W2+1 - ldy p8v_eightthousand+1 - lda p8v_eightthousand - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_label_32_afterwhile - ; source: more_compares.p8:585 uw++ - inc p8v_uw - bne + - inc p8v_uw+1 -+ - ; source: more_compares.p8:584 while uw <= eightthousand { - bra p8l_label_31_whileloop -p8l_label_32_afterwhile - ; source: more_compares.p8:587 txt.print_uw(uw) - ldy p8v_uw+1 - lda p8v_uw - jsr txt.print_uw - ; source: more_compares.p8:588 txt.print(" 8001\n") - ldy #>prog8_interned_strings.string_19 - lda #$07d0 - sta p8v_uw - sty p8v_uw+1 - - ; source: more_compares.p8:590 while uw < eightthousand { -p8l_label_33_whileloop - ldy p8v_uw+1 - lda p8v_uw - cmp p8v_eightthousand - tya - sbc p8v_eightthousand+1 - bvs + - eor #128 -+ bmi p8l_label_34_afterwhile - ; source: more_compares.p8:591 uw++ - inc p8v_uw - bne + - inc p8v_uw+1 -+ - ; source: more_compares.p8:590 while uw < eightthousand { - bra p8l_label_33_whileloop -p8l_label_34_afterwhile - ; source: more_compares.p8:593 txt.print_uw(uw) - ldy p8v_uw+1 - lda p8v_uw - jsr txt.print_uw - ; source: more_compares.p8:594 txt.print(" 8000\n") - ldy #>prog8_interned_strings.string_20 - lda #p8v_f - jsr floats.MOVFM - jsr floats.print - ; source: more_compares.p8:598 while fp8v_twodottwo - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_f -jsr floats.vars_less_f - beq p8l_label_36_afterwhile - ; source: more_compares.p8:599 f+=0.1 - lda #p8v_f - jsr floats.MOVFM - lda #prog8_float_const_4 - jsr floats.FADD - - ldx #p8v_f - jsr floats.MOVMF - - ; source: more_compares.p8:600 floats.print(f) - lda #p8v_f - jsr floats.MOVFM - jsr floats.print - ; source: more_compares.p8:598 while fp8v_f - jsr floats.MOVFM - jsr floats.print - ; source: more_compares.p8:603 txt.print(" 2.2\n") - ldy #>prog8_interned_strings.string_21 - lda # ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'string' ---- -string .proc - ; source: library:/prog8lib/string.p8:5 string { - - - ; source: library:/prog8lib/shared_string_functions.p8:1 string { - ; source: library:/prog8lib/string.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/string.p8:8 asmsub length(uword string @AY) clobbers(A) -> ubyte @Y { - -length .proc - ; source: library:/prog8lib/string.p8:13 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/string.p8:25 asmsub left(uword source @AX, ubyte length @Y, uword target @R1) clobbers(A, Y) { - -left .proc - ; source: library:/prog8lib/string.p8:30 %asm {{ - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - sta P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_W1+1 - lda cx16.r1 - sta P8ZP_SCRATCH_W2 - lda cx16.r1+1 - sta P8ZP_SCRATCH_W2+1 - lda #0 - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop - rts -_loop dey - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop -+ rts - .pend - ; source: library:/prog8lib/string.p8:53 asmsub right(uword source @AY, ubyte length @X, uword target @R1) clobbers(A,Y) { - -right .proc - ; source: library:/prog8lib/string.p8:58 %asm {{ - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - stx P8ZP_SCRATCH_B1 - sta cx16.r0 - sty cx16.r0+1 - jsr string.length - tya - sec - sbc P8ZP_SCRATCH_B1 - clc - adc cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - adc #0 - sta P8ZP_SCRATCH_W1+1 - ldy cx16.r1 - sty P8ZP_SCRATCH_W2 - ldy cx16.r1+1 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop - rts -_loop dey - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - cpy #0 - bne _loop -+ rts - .pend - ; source: library:/prog8lib/string.p8:92 asmsub slice(uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) clobbers(A, Y) { - -slice .proc - ; source: library:/prog8lib/string.p8:98 %asm {{ - ; need to copy the the cx16 virtual registers to zeropage to be compatible with C64... - ; substr(source, target, start, length) - sta P8ZP_SCRATCH_B1 - lda cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - sta P8ZP_SCRATCH_W1+1 - lda cx16.r1 - sta P8ZP_SCRATCH_W2 - lda cx16.r1+1 - sta P8ZP_SCRATCH_W2+1 - - ; adjust src location - clc - lda P8ZP_SCRATCH_W1 - adc P8ZP_SCRATCH_B1 - sta P8ZP_SCRATCH_W1 - bcc + - inc P8ZP_SCRATCH_W1+1 -+ lda #0 - sta (P8ZP_SCRATCH_W2),y - beq _startloop -- lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y -_startloop dey - cpy #$ff - bne - - rts - .pend - ; source: library:/prog8lib/string.p8:130 asmsub find(uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc { - -find .proc - ; source: library:/prog8lib/string.p8:133 %asm {{ - ; need to copy the the cx16 virtual registers to zeropage to make this run on C64... - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - stx P8ZP_SCRATCH_B1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _notfound - cmp P8ZP_SCRATCH_B1 - beq _found - iny - bne - -_notfound lda #0 - clc - rts -_found tya - sec - rts - .pend - ; source: library:/prog8lib/string.p8:154 asmsub contains(uword string @AY, ubyte character @X) -> bool @Pc { - -contains .proc - ; source: library:/prog8lib/string.p8:156 %asm {{ - jmp find - .pend - ; source: library:/prog8lib/string.p8:161 asmsub copy(uword source @R0, uword target @AY) clobbers(A) -> ubyte @Y { - -copy .proc - ; source: library:/prog8lib/string.p8:166 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/string.p8:175 asmsub append(uword target @R0, uword suffix @R1) clobbers(Y) -> ubyte @A { - -append .proc - ; source: library:/prog8lib/string.p8:178 %asm {{ - lda cx16.r0 - ldy cx16.r0+1 - jsr length - sty P8ZP_SCRATCH_B1 - tya - clc - adc cx16.r0 - sta P8ZP_SCRATCH_W1 - lda cx16.r0+1 - adc #0 - sta P8ZP_SCRATCH_W1+1 - lda cx16.r1 - ldy cx16.r1+1 - jsr prog8_lib.strcpy - tya - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/string.p8:200 asmsub compare(uword string1 @R0, uword string2 @AY) clobbers(Y) -> byte @A { - -compare .proc - ; source: library:/prog8lib/string.p8:205 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcmp_mem - .pend - ; source: library:/prog8lib/string.p8:214 asmsub lower(uword st @AY) -> ubyte @Y { - -lower .proc - ; source: library:/prog8lib/string.p8:218 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _done - and #$7f - cmp #97 - bcc + - cmp #123 - bcs + - and #%11011111 -+ sta (P8ZP_SCRATCH_W1),y - iny - bne - -_done rts - .pend - ; source: library:/prog8lib/string.p8:237 asmsub upper(uword st @AY) -> ubyte @Y { - -upper .proc - ; source: library:/prog8lib/string.p8:239 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _done - cmp #65 - bcc + - cmp #91 - bcs + - ora #%00100000 -+ sta (P8ZP_SCRATCH_W1),y - iny - bne - -_done rts - .pend - ; source: library:/prog8lib/string.p8:257 asmsub lowerchar(ubyte character @A) -> ubyte @A { - -lowerchar .proc - ; source: library:/prog8lib/string.p8:258 %asm {{ - and #$7f - cmp #97 - bcc + - cmp #123 - bcs + - and #%11011111 -+ rts - .pend - ; source: library:/prog8lib/string.p8:269 asmsub upperchar(ubyte character @A) -> ubyte @A { - -upperchar .proc - ; source: library:/prog8lib/string.p8:270 %asm {{ - cmp #65 - bcc + - cmp #91 - bcs + - ora #%00100000 -+ rts - .pend - ; source: library:/prog8lib/string.p8:300 asmsub pattern_match(str string @AY, str pattern @R0) clobbers(Y) -> bool @A { - -pattern_match .proc - ; source: library:/prog8lib/string.p8:301 %asm {{ -; pattern matching of a string. -; Input: cx16.r0: A NUL-terminated, <255-length pattern -; AY: A NUL-terminated, <255-length string -; -; Output: A = 1 if the string matches the pattern, A = 0 if not. -; -; Notes: Clobbers A, X, Y. Each * in the pattern uses 4 bytes of stack. -; -; see http://6502.org/source/strings/patmatch.htm - -strptr = P8ZP_SCRATCH_W1 - - sta strptr - sty strptr+1 - lda cx16.r0 - sta modify_pattern1+1 - sta modify_pattern2+1 - lda cx16.r0+1 - sta modify_pattern1+2 - sta modify_pattern2+2 - jsr _match - lda #0 - rol a - rts - - -_match - ldx #$00 ; x is an index in the pattern - ldy #$ff ; y is an index in the string -modify_pattern1 -next lda $ffff,x ; look at next pattern character MODIFIED - cmp #'*' ; is it a star? - beq star ; yes, do the complicated stuff - iny ; no, let's look at the string - cmp #'?' ; is the pattern caracter a ques? - bne reg ; no, it's a regular character - lda (strptr),y ; yes, so it will match anything - beq fail ; except the end of string -reg cmp (strptr),y ; are both characters the same? - bne fail ; no, so no match - inx ; yes, keep checking - cmp #0 ; are we at end of string? - bne next ; not yet, loop -found rts ; success, return with c=1 - -star inx ; skip star in pattern -modify_pattern2 - cmp $ffff,x ; string of stars equals one star MODIFIED - beq star ; so skip them also -stloop txa ; we first try to match with * = "" - pha ; and grow it by 1 character every - tya ; time we loop - pha ; save x and y on stack - jsr next ; recursive call - pla ; restore x and y - tay - pla - tax - bcs found ; we found a match, return with c=1 - iny ; no match yet, try to grow * string - lda (strptr),y ; are we at the end of string? - bne stloop ; not yet, add a character -fail clc ; yes, no match found, return with c=0 - rts - .pend - ; source: library:/prog8lib/string.p8:370 asmsub hash(str string @R0) -> ubyte @A { - -hash .proc - ; source: library:/prog8lib/string.p8:374 %asm {{ - lda #179 - sta P8ZP_SCRATCH_REG - ldy #0 - clc -- lda (cx16.r0),y - beq + - rol P8ZP_SCRATCH_REG - eor P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_REG - iny - bne - -+ lda P8ZP_SCRATCH_REG - rts - .pend - ; source: library:/prog8lib/string.p8:391 asmsub isdigit(ubyte petsciichar @A) -> bool @Pc { - -isdigit .proc - ; source: library:/prog8lib/string.p8:392 %asm {{ - cmp #'0' - bcs + - rts -+ cmp #'9'+1 - bcc + - clc - rts -+ sec - rts - .pend - ; source: library:/prog8lib/string.p8:405 asmsub isupper(ubyte petsciichar @A) -> bool @Pc { - -isupper .proc - ; source: library:/prog8lib/string.p8:407 %asm {{ - cmp #97 - bcs + - rts -+ cmp #122+1 - bcc _yes - cmp #193 - bcs + - rts -+ cmp #218+1 - bcc _yes - clc - rts -_yes sec - rts - .pend - ; source: library:/prog8lib/string.p8:425 asmsub islower(ubyte petsciichar @A) -> bool @Pc { - -islower .proc - ; source: library:/prog8lib/string.p8:426 %asm {{ - cmp #'a' - bcs + - rts -+ cmp #'z'+1 - bcc + - clc - rts -+ sec - rts - .pend - ; source: library:/prog8lib/string.p8:439 asmsub isletter(ubyte petsciichar @A) -> bool @Pc { - -isletter .proc - ; source: library:/prog8lib/string.p8:440 %asm {{ - jsr islower - bcs + - jmp isupper -+ rts - .pend - ; source: library:/prog8lib/string.p8:448 asmsub isspace(ubyte petsciichar @A) -> bool @Pc { - -isspace .proc - ; source: library:/prog8lib/string.p8:449 %asm {{ - cmp #32 - beq + - cmp #13 - beq + - cmp #9 - beq + - cmp #10 - beq + - cmp #141 - beq + - cmp #160 - beq + - clc - rts -+ sec - rts - .pend - ; source: library:/prog8lib/string.p8:469 asmsub isprint(ubyte petsciichar @A) -> bool @Pc { - -isprint .proc - ; source: library:/prog8lib/string.p8:470 %asm {{ - cmp #160 - bcc + - rts -+ cmp #32 - bcs + - rts -+ cmp #128 - bcc + - clc - rts -+ sec - rts - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $87, $c8, $00, $00, $00 ; float -100.0 -prog8_float_const_1 .byte $87, $c6, $00, $00, $00 ; float -99.0 -prog8_float_const_2 .byte $87, $ca, $00, $00, $00 ; float -101.0 -prog8_float_const_3 .byte $82, $0c, $cc, $cc, $cc ; float 2.2 -prog8_float_const_4 .byte $7d, $4c, $cc, $cc, $cc ; float 0.1 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/optimized_compares.asm b/compiler/test/comparisons/optimized_compares.asm deleted file mode 100644 index c0835e991..000000000 --- a/compiler/test/comparisons/optimized_compares.asm +++ /dev/null @@ -1,7101 +0,0 @@ -; w65c02 assembly code for 'optimized_compares' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:41 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=BASICSAFE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system - jsr sys.init_system_phase2 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: optimized_compares.p8:4 main { - - - ; source: optimized_compares.p8:5 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif -+ - clv - clc -; statements - ; source: optimized_compares.p8:6 greater() - jsr p8b_main.p8s_greater - ; source: optimized_compares.p8:7 greater_signed() - jsr p8b_main.p8s_greater_signed - ; source: optimized_compares.p8:8 less() - jsr p8b_main.p8s_less - ; source: optimized_compares.p8:9 less_signed() - jsr p8b_main.p8s_less_signed - ; source: optimized_compares.p8:11 greatereq() - jsr p8b_main.p8s_greatereq - ; source: optimized_compares.p8:12 greatereq_signed() - jsr p8b_main.p8s_greatereq_signed - ; source: optimized_compares.p8:13 lesseq() - jsr p8b_main.p8s_lesseq - ; source: optimized_compares.p8:14 lesseq_signed() - jmp p8b_main.p8s_lesseq_signed - ; source: optimized_compares.p8:5 sub start() { -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:17 sub value(ubyte arg) -> ubyte { - -p8s_value .proc -p8v_arg = 34 ; zp UBYTE -; simple int arg(s) passed via register(s) - sta p8v_arg -; statements - ; source: optimized_compares.p8:18 cx16.r0++ - inc cx16.r0 - bne + - inc cx16.r0+1 -+ - ; source: optimized_compares.p8:19 return arg - lda p8v_arg - rts -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:22 sub svalue(byte arg) -> byte { - -p8s_svalue .proc -p8v_arg = 35 ; zp BYTE -; simple int arg(s) passed via register(s) - sta p8v_arg -; statements - ; source: optimized_compares.p8:23 cx16.r0++ - inc cx16.r0 - bne + - inc cx16.r0+1 -+ - ; source: optimized_compares.p8:24 return arg - lda p8v_arg - rts -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:27 sub greater () { - -p8s_greater .proc -p8v_xx = 68 ; zp BOOL -p8v_b3 = 69 ; zp UBYTE -p8v_b2 = 70 ; zp UBYTE -p8v_b1 = 71 ; zp UBYTE -; statements - ; source: optimized_compares.p8:28 ubyte @shared b1 = 10 - ; source: optimized_compares.p8:29 ubyte @shared b2 = 20 - ; source: optimized_compares.p8:30 ubyte @shared b3 = 10 - ; source: optimized_compares.p8:33 bool xx - ; source: optimized_compares.p8:28 ubyte @shared b1 = 10 - lda #10 - sta p8v_b1 - ; source: optimized_compares.p8:29 ubyte @shared b2 = 20 - lda #$14 - sta p8v_b2 - ; source: optimized_compares.p8:30 ubyte @shared b3 = 10 - lda #10 - sta p8v_b3 - ; source: optimized_compares.p8:32 txt.print(">(u): 101010: ") - ldy #>prog8_interned_strings.string_1 - lda #10 - lda p8v_b2 - cmp #11 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:35 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:38 xx = b2>20 - lda p8v_b2 - cmp #21 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:39 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:42 xx = b2>b1 - stz p8v_xx - lda p8v_b1 - cmp p8v_b2 - bcs label_asm_1_afterif - lda #1 - sta p8v_xx -label_asm_1_afterif - ; source: optimized_compares.p8:43 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:46 xx = b3>b1 - stz p8v_xx - lda p8v_b1 - cmp p8v_b3 - bcs label_asm_2_afterif - lda #1 - sta p8v_xx -label_asm_2_afterif - ; source: optimized_compares.p8:47 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:50 xx = b2>value(10) - stz p8v_xx - lda p8v_b2 - pha - lda #10 - jsr p8b_main.p8s_value - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_3_afterif - beq label_asm_3_afterif - lda #1 - sta p8v_xx -label_asm_3_afterif - ; source: optimized_compares.p8:51 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:53 xx = b3>value(20) - stz p8v_xx - lda p8v_b3 - pha - lda #$14 - jsr p8b_main.p8s_value - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_4_afterif - beq label_asm_4_afterif - lda #1 - sta p8v_xx -label_asm_4_afterif - ; source: optimized_compares.p8:54 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jmp txt.chrout - ; source: optimized_compares.p8:27 sub greater () { -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:60 sub greater_signed () { - -p8s_greater_signed .proc -p8v_xx = 64 ; zp BOOL -p8v_b3 = 65 ; zp BYTE -p8v_b2 = 66 ; zp BYTE -p8v_b1 = 67 ; zp BYTE -; statements - ; source: optimized_compares.p8:61 byte @shared b1 = -20 - ; source: optimized_compares.p8:62 byte @shared b2 = -10 - ; source: optimized_compares.p8:63 byte @shared b3 = -20 - ; source: optimized_compares.p8:66 bool xx - ; source: optimized_compares.p8:61 byte @shared b1 = -20 - lda #-$14 - sta p8v_b1 - ; source: optimized_compares.p8:62 byte @shared b2 = -10 - lda #-10 - sta p8v_b2 - ; source: optimized_compares.p8:63 byte @shared b3 = -20 - lda #-$14 - sta p8v_b3 - ; source: optimized_compares.p8:65 txt.print(">(s): 101010: ") - ldy #>prog8_interned_strings.string_2 - lda # -20 - stz p8v_xx - lda p8v_b2 - cmp #-19 - bmi label_asm_5_afterif - lda #1 - sta p8v_xx -label_asm_5_afterif - ; source: optimized_compares.p8:68 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:71 xx = b2 > -10 - stz p8v_xx - lda p8v_b2 - cmp #-9 - bmi label_asm_6_afterif - lda #1 - sta p8v_xx -label_asm_6_afterif - ; source: optimized_compares.p8:72 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:75 xx = b2>b1 - stz p8v_xx - lda p8v_b1 - sec - sbc p8v_b2 - bpl label_asm_7_afterif - lda #1 - sta p8v_xx -label_asm_7_afterif - ; source: optimized_compares.p8:76 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:79 xx = b3>b1 - stz p8v_xx - lda p8v_b1 - sec - sbc p8v_b3 - bpl label_asm_8_afterif - lda #1 - sta p8v_xx -label_asm_8_afterif - ; source: optimized_compares.p8:80 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:83 xx = b2>svalue(-20) - stz p8v_xx - lda #-$14 - jsr p8b_main.p8s_svalue - sec - sbc p8v_b2 - bpl label_asm_9_afterif - lda #1 - sta p8v_xx -label_asm_9_afterif - ; source: optimized_compares.p8:84 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:86 xx = b3>svalue(-10) - stz p8v_xx - lda #-10 - jsr p8b_main.p8s_svalue - sec - sbc p8v_b3 - bpl label_asm_10_afterif - lda #1 - sta p8v_xx -label_asm_10_afterif - ; source: optimized_compares.p8:87 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jmp txt.chrout - ; source: optimized_compares.p8:60 sub greater_signed () { -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:93 sub less () { - -p8s_less .proc -p8v_xx = 50 ; zp BOOL -p8v_b3 = 51 ; zp UBYTE -p8v_b2 = 52 ; zp UBYTE -p8v_b1 = 53 ; zp UBYTE -; statements - ; source: optimized_compares.p8:94 ubyte @shared b1 = 20 - ; source: optimized_compares.p8:95 ubyte @shared b2 = 10 - ; source: optimized_compares.p8:96 ubyte @shared b3 = 20 - ; source: optimized_compares.p8:99 bool xx - ; source: optimized_compares.p8:94 ubyte @shared b1 = 20 - lda #$14 - sta p8v_b1 - ; source: optimized_compares.p8:95 ubyte @shared b2 = 10 - lda #10 - sta p8v_b2 - ; source: optimized_compares.p8:96 ubyte @shared b3 = 20 - lda #$14 - sta p8v_b3 - ; source: optimized_compares.p8:98 txt.print("<(u): 101010: ") - ldy #>prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #=(u): 110110110: ") - ldy #>prog8_interned_strings.string_5 - lda #=19 - lda p8v_b2 - cmp #19 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:168 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:171 xx = b2>=20 - lda p8v_b2 - cmp #20 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:172 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:175 xx = b2>=21 - lda p8v_b2 - cmp #21 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:176 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:179 xx = b2>=b1 - lda p8v_b2 - cmp p8b_main.p8s_greatereq.p8v_b1 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:180 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:183 xx = b2>=b4 - lda p8v_b2 - cmp p8b_main.p8s_greatereq.p8v_b4 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:184 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:187 xx = b2>=b3 - lda p8v_b2 - cmp p8b_main.p8s_greatereq.p8v_b3 - rol a - and #1 - sta p8v_xx - ; source: optimized_compares.p8:188 txt.print_ub(xx as ubyte) - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:191 xx = b2>=value(19) - lda p8v_b2 - stz p8v_xx - lda p8v_b2 - pha - lda #$13 - jsr p8b_main.p8s_value - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_19_afterif - lda #1 - sta p8v_xx -label_asm_19_afterif - ; source: optimized_compares.p8:192 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:194 xx = b2>=value(20) - lda p8v_b2 - stz p8v_xx - lda p8v_b2 - pha - lda #$14 - jsr p8b_main.p8s_value - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_20_afterif - lda #1 - sta p8v_xx -label_asm_20_afterif - ; source: optimized_compares.p8:195 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:197 xx = b2>=value(21) - lda p8v_b2 - stz p8v_xx - lda p8v_b2 - pha - lda #$15 - jsr p8b_main.p8s_value - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_21_afterif - lda #1 - sta p8v_xx -label_asm_21_afterif - ; source: optimized_compares.p8:198 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jmp txt.chrout - ; source: optimized_compares.p8:159 sub greatereq () { -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:204 sub greatereq_signed () { - -p8s_greatereq_signed .proc -p8v_xx = 54 ; zp BOOL -p8v_b4 = 55 ; zp BYTE -p8v_b3 = 56 ; zp BYTE -p8v_b2 = 57 ; zp BYTE -p8v_b1 = 58 ; zp BYTE -; statements - ; source: optimized_compares.p8:205 byte @shared b1 = -19 - ; source: optimized_compares.p8:206 byte @shared b2 = -20 - ; source: optimized_compares.p8:207 byte @shared b3 = -21 - ; source: optimized_compares.p8:208 byte @shared b4 = -20 - ; source: optimized_compares.p8:211 bool xx - ; source: optimized_compares.p8:205 byte @shared b1 = -19 - lda #-$13 - sta p8v_b1 - ; source: optimized_compares.p8:206 byte @shared b2 = -20 - lda #-$14 - sta p8v_b2 - ; source: optimized_compares.p8:207 byte @shared b3 = -21 - lda #-$15 - sta p8v_b3 - ; source: optimized_compares.p8:208 byte @shared b4 = -20 - lda #-$14 - sta p8v_b4 - ; source: optimized_compares.p8:210 txt.print(">=(s): 011011011: ") - ldy #>prog8_interned_strings.string_6 - lda #= -19 - stz p8v_xx - lda p8v_b2 - cmp #-19 - bmi label_asm_22_afterif - lda #1 - sta p8v_xx -label_asm_22_afterif - ; source: optimized_compares.p8:213 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:216 xx = b2>= -20 - stz p8v_xx - lda p8v_b2 - cmp #-20 - bmi label_asm_23_afterif - lda #1 - sta p8v_xx -label_asm_23_afterif - ; source: optimized_compares.p8:217 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:220 xx = b2>= -21 - stz p8v_xx - lda p8v_b2 - cmp #-21 - bmi label_asm_24_afterif - lda #1 - sta p8v_xx -label_asm_24_afterif - ; source: optimized_compares.p8:221 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:224 xx = b2>=b1 - stz p8v_xx - lda p8v_b2 - cmp p8v_b1 - bmi label_asm_25_afterif - lda #1 - sta p8v_xx -label_asm_25_afterif - ; source: optimized_compares.p8:225 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:228 xx = b2>=b4 - stz p8v_xx - lda p8v_b2 - cmp p8v_b4 - bmi label_asm_26_afterif - lda #1 - sta p8v_xx -label_asm_26_afterif - ; source: optimized_compares.p8:229 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:232 xx = b2>=b3 - stz p8v_xx - lda p8v_b2 - cmp p8v_b3 - bmi label_asm_27_afterif - lda #1 - sta p8v_xx -label_asm_27_afterif - ; source: optimized_compares.p8:233 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:236 xx = b2>=svalue(-19) - stz p8v_xx - lda p8v_b2 - pha - lda #-$13 - jsr p8b_main.p8s_svalue - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_28_afterif - lda #1 - sta p8v_xx -label_asm_28_afterif - ; source: optimized_compares.p8:237 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:239 xx = b2>=svalue(-20) - stz p8v_xx - lda p8v_b2 - pha - lda #-$14 - jsr p8b_main.p8s_svalue - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_29_afterif - lda #1 - sta p8v_xx -label_asm_29_afterif - ; source: optimized_compares.p8:240 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: optimized_compares.p8:242 xx = b2>=svalue(-21) - stz p8v_xx - lda p8v_b2 - pha - lda #-$15 - jsr p8b_main.p8s_svalue - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_30_afterif - lda #1 - sta p8v_xx -label_asm_30_afterif - ; source: optimized_compares.p8:243 txt.print_ub(xx as ubyte) - lda p8v_xx - jsr txt.print_ub - ; source: library:/prog8lib/cx16/textio.p8:33 chrout(' ') - lda #$20 - jsr txt.chrout - ; source: library:/prog8lib/cx16/textio.p8:29 chrout('\n') - lda #13 - jmp txt.chrout - ; source: optimized_compares.p8:204 sub greatereq_signed () { -; variables - .section BSS - .send BSS - - .pend - ; source: optimized_compares.p8:249 sub lesseq () { - -p8s_lesseq .proc -p8v_xx = 41 ; zp BOOL -p8v_b4 = 42 ; zp UBYTE -p8v_b3 = 43 ; zp UBYTE -p8v_b2 = 44 ; zp UBYTE -p8v_b1 = 45 ; zp UBYTE -; statements - ; source: optimized_compares.p8:250 ubyte @shared b1 = 19 - ; source: optimized_compares.p8:251 ubyte @shared b2 = 20 - ; source: optimized_compares.p8:252 ubyte @shared b3 = 21 - ; source: optimized_compares.p8:253 ubyte @shared b4 = 20 - ; source: optimized_compares.p8:256 bool xx - ; source: optimized_compares.p8:250 ubyte @shared b1 = 19 - lda #$13 - sta p8v_b1 - ; source: optimized_compares.p8:251 ubyte @shared b2 = 20 - lda #$14 - sta p8v_b2 - ; source: optimized_compares.p8:252 ubyte @shared b3 = 21 - lda #$15 - sta p8v_b3 - ; source: optimized_compares.p8:253 ubyte @shared b4 = 20 - lda #$14 - sta p8v_b4 - ; source: optimized_compares.p8:255 txt.print("<=(u): 011011011: ") - ldy #>prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #(u): 101010: " - .byte $3e, $28, $55, $29, $3a, $20, $20, $31, $30, $31, $30, $31, $30, $3a, $20, $00 -string_2 ; PETSCII:">(s): 101010: " - .byte $3e, $28, $53, $29, $3a, $20, $20, $31, $30, $31, $30, $31, $30, $3a, $20, $00 -string_3 ; PETSCII:"<(u): 101010: " - .byte $3c, $28, $55, $29, $3a, $20, $20, $31, $30, $31, $30, $31, $30, $3a, $20, $00 -string_4 ; PETSCII:"<(s): 101010: " - .byte $3c, $28, $53, $29, $3a, $20, $20, $31, $30, $31, $30, $31, $30, $3a, $20, $00 -string_5 ; PETSCII:">=(u): 110110110: " - .byte $3e, $3d, $28, $55, $29, $3a, $20, $31, $31, $30, $31, $31, $30, $31, $31, $30 - .byte $3a, $20, $00 -string_6 ; PETSCII:">=(s): 011011011: " - .byte $3e, $3d, $28, $53, $29, $3a, $20, $30, $31, $31, $30, $31, $31, $30, $31, $31 - .byte $3a, $20, $00 -string_7 ; PETSCII:"<=(u): 011011011: " - .byte $3c, $3d, $28, $55, $29, $3a, $20, $30, $31, $31, $30, $31, $31, $30, $31, $31 - .byte $3a, $20, $00 -string_8 ; PETSCII:"<=(s): 110110110: " - .byte $3c, $3d, $28, $53, $29, $3a, $20, $31, $31, $30, $31, $31, $30, $31, $31, $30 - .byte $3a, $20, $00 - - ; source: optimized_compares.p8:32 txt.print(">(u): 101010: ") - ; source: optimized_compares.p8:65 txt.print(">(s): 101010: ") - ; source: optimized_compares.p8:98 txt.print("<(u): 101010: ") - ; source: optimized_compares.p8:131 txt.print("<(s): 101010: ") - ; source: optimized_compares.p8:165 txt.print(">=(u): 110110110: ") - ; source: optimized_compares.p8:210 txt.print(">=(s): 011011011: ") - ; source: optimized_compares.p8:255 txt.print("<=(u): 011011011: ") - ; source: optimized_compares.p8:300 txt.print("<=(s): 110110110: ") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_byte_equalities.asm b/compiler/test/comparisons/test_byte_equalities.asm deleted file mode 100644 index 197a22087..000000000 --- a/compiler/test/comparisons/test_byte_equalities.asm +++ /dev/null @@ -1,11535 +0,0 @@ -; w65c02 assembly code for 'test_byte_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:41 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_byte_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"byte" - .byte $42, $59, $54, $45, $00 - - ; source: test_byte_equalities.p8:9 ubyte success = 0 - ; source: test_byte_equalities.p8:10 str datatype = "byte" - ; source: test_byte_equalities.p8:11 uword @shared comparison - ; source: test_byte_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_byte_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:107 if x==0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:109 goto skip2 - bra p8l_skip2 - ; source: test_byte_equalities.p8:110 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:111 skip2: -p8l_skip2 - ; source: test_byte_equalities.p8:113 if x==0 - lda p8v_x - bne label_asm_3_afterif - ; source: test_byte_equalities.p8:114 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_byte_equalities.p8:117 if x==0 - lda p8v_x - bne label_asm_5_else - ; source: test_byte_equalities.p8:118 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_byte_equalities.p8:120 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_byte_equalities.p8:122 x = -100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:124 if x==0 - beq p8l_skip3 - ; source: test_byte_equalities.p8:126 success++ - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:127 skip3: -p8l_skip3 - ; source: test_byte_equalities.p8:129 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:130 if x==0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:132 success++ - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:133 skip4: -p8l_skip4 - ; source: test_byte_equalities.p8:135 success++ - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:136 if x==0 - lda p8v_x - bne label_asm_6_afterif - ; source: test_byte_equalities.p8:137 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_byte_equalities.p8:140 if x==0 - lda p8v_x - bne label_asm_8_else - ; source: test_byte_equalities.p8:141 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_byte_equalities.p8:143 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_byte_equalities.p8:145 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:94 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:149 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_byte_equalities.p8:150 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:151 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:153 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:155 if x!=0 - bne p8l_lbl1 - ; source: test_byte_equalities.p8:157 goto skip1 - bra p8l_skip1 - ; source: test_byte_equalities.p8:158 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:159 skip1: -p8l_skip1 - ; source: test_byte_equalities.p8:161 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:162 if x!=0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:164 goto skip2 - bra p8l_skip2 - ; source: test_byte_equalities.p8:165 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:166 skip2: -p8l_skip2 - ; source: test_byte_equalities.p8:168 if x!=0 - lda p8v_x - beq label_asm_9_afterif - ; source: test_byte_equalities.p8:169 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_byte_equalities.p8:172 if x!=0 - lda p8v_x - beq label_asm_11_else - ; source: test_byte_equalities.p8:173 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_byte_equalities.p8:175 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_byte_equalities.p8:177 x = 0 - stz p8v_x - ; source: test_byte_equalities.p8:179 if x!=0 - lda p8v_x - bne p8l_skip3 - ; source: test_byte_equalities.p8:181 success++ - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:182 skip3: -p8l_skip3 - ; source: test_byte_equalities.p8:184 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:185 if x!=0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:187 success++ - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:188 skip4: -p8l_skip4 - ; source: test_byte_equalities.p8:190 success++ - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:191 if x!=0 - lda p8v_x - beq label_asm_12_afterif - ; source: test_byte_equalities.p8:192 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_byte_equalities.p8:195 if x!=0 - lda p8v_x - beq label_asm_14_else - ; source: test_byte_equalities.p8:196 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_byte_equalities.p8:198 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_byte_equalities.p8:200 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:149 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:203 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_byte_equalities.p8:204 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:205 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:206 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:208 if x==-100 - cmp #-100 - beq p8l_lbl1a - ; source: test_byte_equalities.p8:210 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:211 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:212 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:214 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:215 if x==-100 - lda p8v_x - cmp #-100 - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:217 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:218 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:219 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:221 if x==-100 - lda p8v_x - cmp #-100 - bne label_asm_15_afterif - ; source: test_byte_equalities.p8:222 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_byte_equalities.p8:225 if x==-100 - lda p8v_x - cmp #-100 - bne label_asm_17_else - ; source: test_byte_equalities.p8:226 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_byte_equalities.p8:228 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_byte_equalities.p8:231 if x==100 - lda p8v_x - cmp #100 - beq p8l_lbl2a - ; source: test_byte_equalities.p8:233 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:234 lbl2a: fail_byte(1,-100) -p8l_lbl2a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:235 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:237 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:238 if x==100 - lda p8v_x - cmp #100 - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:240 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:241 lbl2b: fail_byte(2,-100) -p8l_lbl2b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:242 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:244 if x==100 - lda p8v_x - cmp #100 - bne label_asm_18_afterif - ; source: test_byte_equalities.p8:245 fail_byte(3,-100) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_18_afterif - ; source: test_byte_equalities.p8:248 if x==100 - lda p8v_x - cmp #100 - bne label_asm_20_else - ; source: test_byte_equalities.p8:249 fail_byte(4,-100) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_19_afterif -label_asm_20_else - ; source: test_byte_equalities.p8:251 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_byte_equalities.p8:253 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:255 if x==-100 - lda p8v_x - cmp #-100 - beq p8l_lbl3a - ; source: test_byte_equalities.p8:257 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:258 lbl3a: fail_byte(5,0) -p8l_lbl3a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:259 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:261 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:262 if x==-100 - lda p8v_x - cmp #-100 - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:264 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:265 lbl3b: fail_byte(6,0) -p8l_lbl3b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:266 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:268 if x==-100 - lda p8v_x - cmp #-100 - bne label_asm_21_afterif - ; source: test_byte_equalities.p8:269 fail_byte(7,0) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_21_afterif - ; source: test_byte_equalities.p8:272 if x==-100 - lda p8v_x - cmp #-100 - bne label_asm_23_else - ; source: test_byte_equalities.p8:273 fail_byte(8,0) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_22_afterif -label_asm_23_else - ; source: test_byte_equalities.p8:275 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_byte_equalities.p8:278 if x==100 - lda p8v_x - cmp #100 - beq p8l_lbl4a - ; source: test_byte_equalities.p8:280 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:281 lbl4a: fail_byte(9,0) -p8l_lbl4a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:282 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:284 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:285 if x==100 - lda p8v_x - cmp #100 - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:287 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:288 lbl4b: fail_byte(10,0) -p8l_lbl4b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:289 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:291 if x==100 - lda p8v_x - cmp #100 - bne label_asm_24_afterif - ; source: test_byte_equalities.p8:292 fail_byte(11,0) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_24_afterif - ; source: test_byte_equalities.p8:295 if x==100 - lda p8v_x - cmp #100 - bne label_asm_26_else - ; source: test_byte_equalities.p8:296 fail_byte(12,0) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_25_afterif -label_asm_26_else - ; source: test_byte_equalities.p8:298 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_byte_equalities.p8:300 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:302 if x==-100 - cmp #-100 - beq p8l_lbl5a - ; source: test_byte_equalities.p8:304 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:305 lbl5a: fail_byte(13,100) -p8l_lbl5a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:306 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:308 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:309 if x==-100 - lda p8v_x - cmp #-100 - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:311 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:312 lbl5b: fail_byte(14,100) -p8l_lbl5b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:313 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:315 if x==-100 - lda p8v_x - cmp #-100 - bne label_asm_27_afterif - ; source: test_byte_equalities.p8:316 fail_byte(15,100) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_27_afterif - ; source: test_byte_equalities.p8:319 if x==-100 - lda p8v_x - cmp #-100 - bne label_asm_29_else - ; source: test_byte_equalities.p8:320 fail_byte(16,100) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_28_afterif -label_asm_29_else - ; source: test_byte_equalities.p8:322 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_byte_equalities.p8:325 if x==100 - lda p8v_x - cmp #100 - beq p8l_lbl6a - ; source: test_byte_equalities.p8:327 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:328 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:329 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:331 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:332 if x==100 - lda p8v_x - cmp #100 - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:334 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:335 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:336 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:338 if x==100 - lda p8v_x - cmp #100 - bne label_asm_30_afterif - ; source: test_byte_equalities.p8:339 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_byte_equalities.p8:342 if x==100 - lda p8v_x - cmp #100 - bne label_asm_32_else - ; source: test_byte_equalities.p8:343 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_byte_equalities.p8:345 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_byte_equalities.p8:347 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:203 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:349 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_byte_equalities.p8:350 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:351 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:352 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:354 if x!=-100 - cmp #-100 - bne p8l_lbl1a - ; source: test_byte_equalities.p8:356 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:357 lbl1a: fail_byte(17,-100) -p8l_lbl1a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:358 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:360 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:361 if x!=-100 - lda p8v_x - cmp #-100 - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:363 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:364 lbl1b: fail_byte(18,-100) -p8l_lbl1b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:365 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:367 if x!=-100 - lda p8v_x - cmp #-100 - beq label_asm_33_afterif - ; source: test_byte_equalities.p8:368 fail_byte(19,-100) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_33_afterif - ; source: test_byte_equalities.p8:371 if x!=-100 - lda p8v_x - cmp #-100 - beq label_asm_35_else - ; source: test_byte_equalities.p8:372 fail_byte(20,-100) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_34_afterif -label_asm_35_else - ; source: test_byte_equalities.p8:374 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_byte_equalities.p8:377 if x!=100 - lda p8v_x - cmp #100 - bne p8l_lbl2a - ; source: test_byte_equalities.p8:379 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:380 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:381 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:383 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:384 if x!=100 - lda p8v_x - cmp #100 - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:386 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:387 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:388 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:390 if x!=100 - lda p8v_x - cmp #100 - beq label_asm_36_afterif - ; source: test_byte_equalities.p8:391 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_byte_equalities.p8:394 if x!=100 - lda p8v_x - cmp #100 - beq label_asm_38_else - ; source: test_byte_equalities.p8:395 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_byte_equalities.p8:397 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_byte_equalities.p8:399 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:401 if x!=-100 - lda p8v_x - cmp #-100 - bne p8l_lbl3a - ; source: test_byte_equalities.p8:403 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:404 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:405 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:407 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:408 if x!=-100 - lda p8v_x - cmp #-100 - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:410 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:411 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:412 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:414 if x!=-100 - lda p8v_x - cmp #-100 - beq label_asm_39_afterif - ; source: test_byte_equalities.p8:415 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_byte_equalities.p8:418 if x!=-100 - lda p8v_x - cmp #-100 - beq label_asm_41_else - ; source: test_byte_equalities.p8:419 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_byte_equalities.p8:421 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_byte_equalities.p8:424 if x!=100 - lda p8v_x - cmp #100 - bne p8l_lbl4a - ; source: test_byte_equalities.p8:426 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:427 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:428 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:430 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:431 if x!=100 - lda p8v_x - cmp #100 - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:433 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:434 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:435 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:437 if x!=100 - lda p8v_x - cmp #100 - beq label_asm_42_afterif - ; source: test_byte_equalities.p8:438 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_byte_equalities.p8:441 if x!=100 - lda p8v_x - cmp #100 - beq label_asm_44_else - ; source: test_byte_equalities.p8:442 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_byte_equalities.p8:444 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_byte_equalities.p8:446 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:448 if x!=-100 - cmp #-100 - bne p8l_lbl5a - ; source: test_byte_equalities.p8:450 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:451 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:452 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:454 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:455 if x!=-100 - lda p8v_x - cmp #-100 - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:457 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:458 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:459 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:461 if x!=-100 - lda p8v_x - cmp #-100 - beq label_asm_45_afterif - ; source: test_byte_equalities.p8:462 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_byte_equalities.p8:465 if x!=-100 - lda p8v_x - cmp #-100 - beq label_asm_47_else - ; source: test_byte_equalities.p8:466 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_byte_equalities.p8:468 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_byte_equalities.p8:471 if x!=100 - lda p8v_x - cmp #100 - bne p8l_lbl6a - ; source: test_byte_equalities.p8:473 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:474 lbl6a: fail_byte(21,100) -p8l_lbl6a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:475 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:477 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:478 if x!=100 - lda p8v_x - cmp #100 - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:480 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:481 lbl6b: fail_byte(22,100) -p8l_lbl6b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:482 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:484 if x!=100 - lda p8v_x - cmp #100 - beq label_asm_48_afterif - ; source: test_byte_equalities.p8:485 fail_byte(23,100) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_48_afterif - ; source: test_byte_equalities.p8:488 if x!=100 - lda p8v_x - cmp #100 - beq label_asm_50_else - ; source: test_byte_equalities.p8:489 fail_byte(24,100) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_49_afterif -label_asm_50_else - ; source: test_byte_equalities.p8:491 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_byte_equalities.p8:493 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:349 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:495 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_byte_equalities.p8:496 byte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_byte_equalities.p8:497 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:498 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:499 value=-100 - sta p8v_value - ; source: test_byte_equalities.p8:501 if x==value - cmp p8v_value - beq p8l_lbl1a - ; source: test_byte_equalities.p8:503 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:504 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:505 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:507 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:508 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:510 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:511 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:512 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:514 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_51_afterif - ; source: test_byte_equalities.p8:515 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_byte_equalities.p8:518 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_53_else - ; source: test_byte_equalities.p8:519 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_byte_equalities.p8:521 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_byte_equalities.p8:523 value=100 - lda #$64 - sta p8v_value - ; source: test_byte_equalities.p8:525 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl2a - ; source: test_byte_equalities.p8:527 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:528 lbl2a: fail_byte(25,-100) -p8l_lbl2a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:529 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:531 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:532 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:534 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:535 lbl2b: fail_byte(26,-100) -p8l_lbl2b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:536 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:538 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_54_afterif - ; source: test_byte_equalities.p8:539 fail_byte(27,-100) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_54_afterif - ; source: test_byte_equalities.p8:542 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_56_else - ; source: test_byte_equalities.p8:543 fail_byte(28,-100) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_55_afterif -label_asm_56_else - ; source: test_byte_equalities.p8:545 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_byte_equalities.p8:547 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:548 value=-100 - lda #-$64 - sta p8v_value - ; source: test_byte_equalities.p8:550 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl3a - ; source: test_byte_equalities.p8:552 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:553 lbl3a: fail_byte(29,0) -p8l_lbl3a - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:554 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:556 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:557 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:559 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:560 lbl3b: fail_byte(30,0) -p8l_lbl3b - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:561 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:563 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_57_afterif - ; source: test_byte_equalities.p8:564 fail_byte(31,0) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_57_afterif - ; source: test_byte_equalities.p8:567 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_59_else - ; source: test_byte_equalities.p8:568 fail_byte(32,0) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_58_afterif -label_asm_59_else - ; source: test_byte_equalities.p8:570 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_byte_equalities.p8:572 value=100 - lda #$64 - sta p8v_value - ; source: test_byte_equalities.p8:574 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl4a - ; source: test_byte_equalities.p8:576 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:577 lbl4a: fail_byte(33,0) -p8l_lbl4a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:578 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:580 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:581 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:583 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:584 lbl4b: fail_byte(34,0) -p8l_lbl4b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:585 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:587 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_60_afterif - ; source: test_byte_equalities.p8:588 fail_byte(35,0) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_60_afterif - ; source: test_byte_equalities.p8:591 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_62_else - ; source: test_byte_equalities.p8:592 fail_byte(36,0) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_61_afterif -label_asm_62_else - ; source: test_byte_equalities.p8:594 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_byte_equalities.p8:596 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:597 value=-100 - lda #-$64 - sta p8v_value - ; source: test_byte_equalities.p8:599 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl5a - ; source: test_byte_equalities.p8:601 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:602 lbl5a: fail_byte(37,100) -p8l_lbl5a - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:603 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:605 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:606 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:608 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:609 lbl5b: fail_byte(38,100) -p8l_lbl5b - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:610 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:612 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_63_afterif - ; source: test_byte_equalities.p8:613 fail_byte(39,100) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_63_afterif - ; source: test_byte_equalities.p8:616 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_65_else - ; source: test_byte_equalities.p8:617 fail_byte(40,100) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_64_afterif -label_asm_65_else - ; source: test_byte_equalities.p8:619 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_byte_equalities.p8:621 value=100 - lda #$64 - sta p8v_value - ; source: test_byte_equalities.p8:623 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl6a - ; source: test_byte_equalities.p8:625 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:626 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:627 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:629 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:630 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:632 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:633 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:634 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:636 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_66_afterif - ; source: test_byte_equalities.p8:637 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_byte_equalities.p8:640 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_68_else - ; source: test_byte_equalities.p8:641 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_byte_equalities.p8:643 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_byte_equalities.p8:645 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:495 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .char ? -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:647 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_byte_equalities.p8:648 byte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_byte_equalities.p8:649 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:650 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:651 value=-100 - sta p8v_value - ; source: test_byte_equalities.p8:653 if x!=value - cmp p8v_value - bne p8l_lbl1a - ; source: test_byte_equalities.p8:655 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:656 lbl1a: fail_byte(41,-100) -p8l_lbl1a - lda #<$29 - ldy #>$29 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:657 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:659 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:660 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:662 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:663 lbl1b: fail_byte(42,-100) -p8l_lbl1b - lda #<$2a - ldy #>$2a - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:664 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:666 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_69_afterif - ; source: test_byte_equalities.p8:667 fail_byte(43,-100) - lda #<$2b - ldy #>$2b - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_69_afterif - ; source: test_byte_equalities.p8:670 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_71_else - ; source: test_byte_equalities.p8:671 fail_byte(44,-100) - lda #<$2c - ldy #>$2c - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_70_afterif -label_asm_71_else - ; source: test_byte_equalities.p8:673 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_byte_equalities.p8:675 value=100 - lda #$64 - sta p8v_value - ; source: test_byte_equalities.p8:677 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl2a - ; source: test_byte_equalities.p8:679 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:680 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:681 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:683 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:684 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:686 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:687 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:688 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:690 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_72_afterif - ; source: test_byte_equalities.p8:691 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_byte_equalities.p8:694 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_74_else - ; source: test_byte_equalities.p8:695 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_byte_equalities.p8:697 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_byte_equalities.p8:699 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:700 value=-100 - lda #-$64 - sta p8v_value - ; source: test_byte_equalities.p8:702 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl3a - ; source: test_byte_equalities.p8:704 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:705 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:706 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:708 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:709 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:711 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:712 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:713 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:715 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_75_afterif - ; source: test_byte_equalities.p8:716 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_byte_equalities.p8:719 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_77_else - ; source: test_byte_equalities.p8:720 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_byte_equalities.p8:722 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_byte_equalities.p8:724 value=100 - lda #$64 - sta p8v_value - ; source: test_byte_equalities.p8:726 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl4a - ; source: test_byte_equalities.p8:728 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:729 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:730 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:732 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:733 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:735 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:736 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:737 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:739 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_78_afterif - ; source: test_byte_equalities.p8:740 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_byte_equalities.p8:743 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_80_else - ; source: test_byte_equalities.p8:744 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_byte_equalities.p8:746 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_byte_equalities.p8:748 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:749 value=-100 - lda #-$64 - sta p8v_value - ; source: test_byte_equalities.p8:751 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl5a - ; source: test_byte_equalities.p8:753 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:754 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:755 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:757 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:758 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:760 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:761 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:762 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:764 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_81_afterif - ; source: test_byte_equalities.p8:765 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_byte_equalities.p8:768 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_83_else - ; source: test_byte_equalities.p8:769 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_byte_equalities.p8:771 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_byte_equalities.p8:773 value=100 - lda #$64 - sta p8v_value - ; source: test_byte_equalities.p8:775 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl6a - ; source: test_byte_equalities.p8:777 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:778 lbl6a: fail_byte(45,100) -p8l_lbl6a - lda #<$2d - ldy #>$2d - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:779 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:781 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:782 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:784 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:785 lbl6b: fail_byte(46,100) -p8l_lbl6b - lda #<$2e - ldy #>$2e - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:786 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:788 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_84_afterif - ; source: test_byte_equalities.p8:789 fail_byte(47,100) - lda #<$2f - ldy #>$2f - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_84_afterif - ; source: test_byte_equalities.p8:792 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_86_else - ; source: test_byte_equalities.p8:793 fail_byte(48,100) - lda #<$30 - ldy #>$30 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_85_afterif -label_asm_86_else - ; source: test_byte_equalities.p8:795 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_byte_equalities.p8:797 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:647 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .char ? -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:799 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_byte_equalities.p8:800 byte @shared x - ; source: test_byte_equalities.p8:803 float @shared f4 = 1.0 - ; source: test_byte_equalities.p8:804 float @shared f5 = 1.0 - ; source: test_byte_equalities.p8:800 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:801 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_byte_equalities.p8:802 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_byte_equalities.p8:803 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_byte_equalities.p8:804 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_byte_equalities.p8:805 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:806 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:808 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq p8l_lbl1a - ; source: test_byte_equalities.p8:810 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:811 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:812 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:814 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:815 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:817 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:818 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:819 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:821 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_87_afterif - ; source: test_byte_equalities.p8:822 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_byte_equalities.p8:825 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_89_else - ; source: test_byte_equalities.p8:826 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_byte_equalities.p8:828 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_byte_equalities.p8:831 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq p8l_lbl2a - ; source: test_byte_equalities.p8:833 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:834 lbl2a: fail_byte(49,-100) -p8l_lbl2a - lda #<$31 - ldy #>$31 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:835 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:837 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:838 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:840 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:841 lbl2b: fail_byte(50,-100) -p8l_lbl2b - lda #<$32 - ldy #>$32 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:842 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:844 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_90_afterif - ; source: test_byte_equalities.p8:845 fail_byte(51,-100) - lda #<$33 - ldy #>$33 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_90_afterif - ; source: test_byte_equalities.p8:848 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_92_else - ; source: test_byte_equalities.p8:849 fail_byte(52,-100) - lda #<$34 - ldy #>$34 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_91_afterif -label_asm_92_else - ; source: test_byte_equalities.p8:851 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_byte_equalities.p8:853 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:855 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq p8l_lbl3a - ; source: test_byte_equalities.p8:857 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:858 lbl3a: fail_byte(53,0) -p8l_lbl3a - lda #<$35 - ldy #>$35 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:859 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:861 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:862 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:864 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:865 lbl3b: fail_byte(54,0) -p8l_lbl3b - lda #<$36 - ldy #>$36 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:866 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:868 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_93_afterif - ; source: test_byte_equalities.p8:869 fail_byte(55,0) - lda #<$37 - ldy #>$37 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_93_afterif - ; source: test_byte_equalities.p8:872 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_95_else - ; source: test_byte_equalities.p8:873 fail_byte(56,0) - lda #<$38 - ldy #>$38 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_94_afterif -label_asm_95_else - ; source: test_byte_equalities.p8:875 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_byte_equalities.p8:878 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq p8l_lbl4a - ; source: test_byte_equalities.p8:880 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:881 lbl4a: fail_byte(57,0) -p8l_lbl4a - lda #<$39 - ldy #>$39 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:882 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:884 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:885 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:887 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:888 lbl4b: fail_byte(58,0) -p8l_lbl4b - lda #<$3a - ldy #>$3a - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:889 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:891 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_96_afterif - ; source: test_byte_equalities.p8:892 fail_byte(59,0) - lda #<$3b - ldy #>$3b - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_96_afterif - ; source: test_byte_equalities.p8:895 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_98_else - ; source: test_byte_equalities.p8:896 fail_byte(60,0) - lda #<$3c - ldy #>$3c - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_97_afterif -label_asm_98_else - ; source: test_byte_equalities.p8:898 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_byte_equalities.p8:900 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:902 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq p8l_lbl5a - ; source: test_byte_equalities.p8:904 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:905 lbl5a: fail_byte(61,100) -p8l_lbl5a - lda #<$3d - ldy #>$3d - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:906 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:908 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:909 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:911 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:912 lbl5b: fail_byte(62,100) -p8l_lbl5b - lda #<$3e - ldy #>$3e - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:913 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:915 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_99_afterif - ; source: test_byte_equalities.p8:916 fail_byte(63,100) - lda #<$3f - ldy #>$3f - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_99_afterif - ; source: test_byte_equalities.p8:919 if x==cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_101_else - ; source: test_byte_equalities.p8:920 fail_byte(64,100) - lda #<$40 - ldy #>$40 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_100_afterif -label_asm_101_else - ; source: test_byte_equalities.p8:922 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_byte_equalities.p8:925 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq p8l_lbl6a - ; source: test_byte_equalities.p8:927 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:928 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:929 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:931 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:932 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:934 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:935 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:936 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:938 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_102_afterif - ; source: test_byte_equalities.p8:939 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_byte_equalities.p8:942 if x==cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne label_asm_104_else - ; source: test_byte_equalities.p8:943 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_byte_equalities.p8:945 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_byte_equalities.p8:947 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:799 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:949 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_byte_equalities.p8:950 byte @shared x - ; source: test_byte_equalities.p8:953 float @shared f4 = 1.0 - ; source: test_byte_equalities.p8:954 float @shared f5 = 1.0 - ; source: test_byte_equalities.p8:950 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:951 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_byte_equalities.p8:952 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_byte_equalities.p8:953 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_byte_equalities.p8:954 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_byte_equalities.p8:955 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:956 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:958 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne p8l_lbl1a - ; source: test_byte_equalities.p8:960 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:961 lbl1a: fail_byte(65,-100) -p8l_lbl1a - lda #<$41 - ldy #>$41 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:962 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:964 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:965 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:967 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:968 lbl1b: fail_byte(66,-100) -p8l_lbl1b - lda #<$42 - ldy #>$42 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:969 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:971 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_105_afterif - ; source: test_byte_equalities.p8:972 fail_byte(67,-100) - lda #<$43 - ldy #>$43 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_105_afterif - ; source: test_byte_equalities.p8:975 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_107_else - ; source: test_byte_equalities.p8:976 fail_byte(68,-100) - lda #<$44 - ldy #>$44 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_106_afterif -label_asm_107_else - ; source: test_byte_equalities.p8:978 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_byte_equalities.p8:981 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne p8l_lbl2a - ; source: test_byte_equalities.p8:983 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:984 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:985 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:987 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:988 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:990 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:991 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:992 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:994 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_108_afterif - ; source: test_byte_equalities.p8:995 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_byte_equalities.p8:998 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_110_else - ; source: test_byte_equalities.p8:999 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_byte_equalities.p8:1001 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_byte_equalities.p8:1003 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:1005 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne p8l_lbl3a - ; source: test_byte_equalities.p8:1007 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:1008 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1009 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:1011 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1012 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1014 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:1015 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1016 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:1018 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_111_afterif - ; source: test_byte_equalities.p8:1019 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_byte_equalities.p8:1022 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_113_else - ; source: test_byte_equalities.p8:1023 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_byte_equalities.p8:1025 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_byte_equalities.p8:1028 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne p8l_lbl4a - ; source: test_byte_equalities.p8:1030 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:1031 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1032 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:1034 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1035 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1037 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:1038 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1039 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:1041 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_114_afterif - ; source: test_byte_equalities.p8:1042 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_byte_equalities.p8:1045 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_116_else - ; source: test_byte_equalities.p8:1046 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_byte_equalities.p8:1048 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_byte_equalities.p8:1050 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:1052 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne p8l_lbl5a - ; source: test_byte_equalities.p8:1054 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:1055 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1056 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:1058 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1059 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1061 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:1062 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1063 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:1065 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_117_afterif - ; source: test_byte_equalities.p8:1066 success++ - inc p8b_main.p8v_success -label_asm_117_afterif - ; source: test_byte_equalities.p8:1069 if x!=cx16.r4sL+-100-cx16.r5sL - lda cx16.r4sL - sec - sbc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_119_else - ; source: test_byte_equalities.p8:1070 success++ - inc p8b_main.p8v_success - bra label_asm_118_afterif -label_asm_119_else - ; source: test_byte_equalities.p8:1072 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_byte_equalities.p8:1075 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - bne p8l_lbl6a - ; source: test_byte_equalities.p8:1077 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:1078 lbl6a: fail_byte(69,100) -p8l_lbl6a - lda #<$45 - ldy #>$45 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1079 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:1081 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1082 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1084 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:1085 lbl6b: fail_byte(70,100) -p8l_lbl6b - lda #<$46 - ldy #>$46 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1086 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:1088 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_120_afterif - ; source: test_byte_equalities.p8:1089 fail_byte(71,100) - lda #<$47 - ldy #>$47 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_120_afterif - ; source: test_byte_equalities.p8:1092 if x!=cx16.r4sL+100-cx16.r5sL - lda cx16.r4sL - clc - adc #$64 - sec - sbc cx16.r5sL - cmp p8v_x - beq label_asm_122_else - ; source: test_byte_equalities.p8:1093 fail_byte(72,100) - lda #<$48 - ldy #>$48 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_121_afterif -label_asm_122_else - ; source: test_byte_equalities.p8:1095 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_byte_equalities.p8:1097 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:949 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_equalities.p8:1099 sub test_is_array() { - -p8s_test_is_array .proc -; statements - ; source: test_byte_equalities.p8:1100 byte @shared x - ; source: test_byte_equalities.p8:1101 byte[] values = [0, 0] - ; source: test_byte_equalities.p8:1102 byte[] sources = [0, 0] - ; source: test_byte_equalities.p8:1100 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:1103 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:1104 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:1105 sources[1]=-100 - sta p8v_sources+1 - ; source: test_byte_equalities.p8:1106 values[1]=-100 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1108 if x==values[1] - cmp p8v_x - beq p8l_lbl1a - ; source: test_byte_equalities.p8:1110 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:1111 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1112 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:1114 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1115 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1117 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:1118 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1119 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:1121 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_123_afterif - ; source: test_byte_equalities.p8:1122 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_byte_equalities.p8:1125 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_125_else - ; source: test_byte_equalities.p8:1126 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_byte_equalities.p8:1128 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_byte_equalities.p8:1131 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl1c - ; source: test_byte_equalities.p8:1133 goto skip1c - bra p8l_skip1c - ; source: test_byte_equalities.p8:1134 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1135 skip1c: -p8l_skip1c - ; source: test_byte_equalities.p8:1137 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1138 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1140 goto skip1d - bra p8l_skip1d - ; source: test_byte_equalities.p8:1141 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1142 skip1d: -p8l_skip1d - ; source: test_byte_equalities.p8:1144 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_126_afterif - ; source: test_byte_equalities.p8:1145 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_byte_equalities.p8:1148 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_128_else - ; source: test_byte_equalities.p8:1149 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_byte_equalities.p8:1151 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_byte_equalities.p8:1153 values[1]=100 - lda #$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1155 if x==values[1] - cmp p8v_x - beq p8l_lbl2a - ; source: test_byte_equalities.p8:1157 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:1158 lbl2a: fail_byte(73,-100) -p8l_lbl2a - lda #<$49 - ldy #>$49 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1159 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:1161 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1162 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1164 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:1165 lbl2b: fail_byte(74,-100) -p8l_lbl2b - lda #<$4a - ldy #>$4a - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1166 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:1168 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_129_afterif - ; source: test_byte_equalities.p8:1169 fail_byte(75,-100) - lda #<$4b - ldy #>$4b - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_129_afterif - ; source: test_byte_equalities.p8:1172 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_131_else - ; source: test_byte_equalities.p8:1173 fail_byte(76,-100) - lda #<$4c - ldy #>$4c - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_130_afterif -label_asm_131_else - ; source: test_byte_equalities.p8:1175 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_byte_equalities.p8:1178 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl2c - ; source: test_byte_equalities.p8:1180 goto skip2c - bra p8l_skip2c - ; source: test_byte_equalities.p8:1181 lbl2c: fail_byte(77,-100) -p8l_lbl2c - lda #<$4d - ldy #>$4d - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1182 skip2c: -p8l_skip2c - ; source: test_byte_equalities.p8:1184 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1185 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1187 goto skip2d - bra p8l_skip2d - ; source: test_byte_equalities.p8:1188 lbl2d: fail_byte(78,-100) -p8l_lbl2d - lda #<$4e - ldy #>$4e - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1189 skip2d: -p8l_skip2d - ; source: test_byte_equalities.p8:1191 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_132_afterif - ; source: test_byte_equalities.p8:1192 fail_byte(79,-100) - lda #<$4f - ldy #>$4f - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_132_afterif - ; source: test_byte_equalities.p8:1195 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_134_else - ; source: test_byte_equalities.p8:1196 fail_byte(80,-100) - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_133_afterif -label_asm_134_else - ; source: test_byte_equalities.p8:1198 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_byte_equalities.p8:1200 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:1201 sources[1]=0 - stz p8v_sources+1 - ; source: test_byte_equalities.p8:1202 values[1]=-100 - lda #-$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1204 if x==values[1] - cmp p8v_x - beq p8l_lbl3a - ; source: test_byte_equalities.p8:1206 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:1207 lbl3a: fail_byte(81,0) -p8l_lbl3a - lda #<$51 - ldy #>$51 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1208 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:1210 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1211 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1213 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:1214 lbl3b: fail_byte(82,0) -p8l_lbl3b - lda #<$52 - ldy #>$52 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1215 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:1217 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_135_afterif - ; source: test_byte_equalities.p8:1218 fail_byte(83,0) - lda #<$53 - ldy #>$53 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_135_afterif - ; source: test_byte_equalities.p8:1221 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_137_else - ; source: test_byte_equalities.p8:1222 fail_byte(84,0) - lda #<$54 - ldy #>$54 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_136_afterif -label_asm_137_else - ; source: test_byte_equalities.p8:1224 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_byte_equalities.p8:1227 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl3c - ; source: test_byte_equalities.p8:1229 goto skip3c - bra p8l_skip3c - ; source: test_byte_equalities.p8:1230 lbl3c: fail_byte(85,0) -p8l_lbl3c - lda #<$55 - ldy #>$55 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1231 skip3c: -p8l_skip3c - ; source: test_byte_equalities.p8:1233 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1234 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1236 goto skip3d - bra p8l_skip3d - ; source: test_byte_equalities.p8:1237 lbl3d: fail_byte(86,0) -p8l_lbl3d - lda #<$56 - ldy #>$56 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1238 skip3d: -p8l_skip3d - ; source: test_byte_equalities.p8:1240 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_138_afterif - ; source: test_byte_equalities.p8:1241 fail_byte(87,0) - lda #<$57 - ldy #>$57 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_138_afterif - ; source: test_byte_equalities.p8:1244 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_140_else - ; source: test_byte_equalities.p8:1245 fail_byte(88,0) - lda #<$58 - ldy #>$58 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_139_afterif -label_asm_140_else - ; source: test_byte_equalities.p8:1247 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_byte_equalities.p8:1249 values[1]=100 - lda #$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1251 if x==values[1] - cmp p8v_x - beq p8l_lbl4a - ; source: test_byte_equalities.p8:1253 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:1254 lbl4a: fail_byte(89,0) -p8l_lbl4a - lda #<$59 - ldy #>$59 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1255 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:1257 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1258 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1260 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:1261 lbl4b: fail_byte(90,0) -p8l_lbl4b - lda #<$5a - ldy #>$5a - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1262 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:1264 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_141_afterif - ; source: test_byte_equalities.p8:1265 fail_byte(91,0) - lda #<$5b - ldy #>$5b - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_141_afterif - ; source: test_byte_equalities.p8:1268 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_143_else - ; source: test_byte_equalities.p8:1269 fail_byte(92,0) - lda #<$5c - ldy #>$5c - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_142_afterif -label_asm_143_else - ; source: test_byte_equalities.p8:1271 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_byte_equalities.p8:1274 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl4c - ; source: test_byte_equalities.p8:1276 goto skip4c - bra p8l_skip4c - ; source: test_byte_equalities.p8:1277 lbl4c: fail_byte(93,0) -p8l_lbl4c - lda #<$5d - ldy #>$5d - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1278 skip4c: -p8l_skip4c - ; source: test_byte_equalities.p8:1280 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1281 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1283 goto skip4d - bra p8l_skip4d - ; source: test_byte_equalities.p8:1284 lbl4d: fail_byte(94,0) -p8l_lbl4d - lda #<$5e - ldy #>$5e - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1285 skip4d: -p8l_skip4d - ; source: test_byte_equalities.p8:1287 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_144_afterif - ; source: test_byte_equalities.p8:1288 fail_byte(95,0) - lda #<$5f - ldy #>$5f - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_144_afterif - ; source: test_byte_equalities.p8:1291 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_146_else - ; source: test_byte_equalities.p8:1292 fail_byte(96,0) - lda #<$60 - ldy #>$60 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - stz p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_145_afterif -label_asm_146_else - ; source: test_byte_equalities.p8:1294 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_byte_equalities.p8:1296 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:1297 sources[1]=100 - sta p8v_sources+1 - ; source: test_byte_equalities.p8:1298 values[1]=-100 - lda #-$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1300 if x==values[1] - cmp p8v_x - beq p8l_lbl5a - ; source: test_byte_equalities.p8:1302 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:1303 lbl5a: fail_byte(97,100) -p8l_lbl5a - lda #<$61 - ldy #>$61 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1304 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:1306 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1307 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1309 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:1310 lbl5b: fail_byte(98,100) -p8l_lbl5b - lda #<$62 - ldy #>$62 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1311 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:1313 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_147_afterif - ; source: test_byte_equalities.p8:1314 fail_byte(99,100) - lda #<$63 - ldy #>$63 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_147_afterif - ; source: test_byte_equalities.p8:1317 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_149_else - ; source: test_byte_equalities.p8:1318 fail_byte(100,100) - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_148_afterif -label_asm_149_else - ; source: test_byte_equalities.p8:1320 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_byte_equalities.p8:1323 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl5c - ; source: test_byte_equalities.p8:1325 goto skip5c - bra p8l_skip5c - ; source: test_byte_equalities.p8:1326 lbl5c: fail_byte(101,100) -p8l_lbl5c - lda #<$65 - ldy #>$65 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1327 skip5c: -p8l_skip5c - ; source: test_byte_equalities.p8:1329 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1330 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1332 goto skip5d - bra p8l_skip5d - ; source: test_byte_equalities.p8:1333 lbl5d: fail_byte(102,100) -p8l_lbl5d - lda #<$66 - ldy #>$66 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1334 skip5d: -p8l_skip5d - ; source: test_byte_equalities.p8:1336 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_150_afterif - ; source: test_byte_equalities.p8:1337 fail_byte(103,100) - lda #<$67 - ldy #>$67 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_150_afterif - ; source: test_byte_equalities.p8:1340 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_152_else - ; source: test_byte_equalities.p8:1341 fail_byte(104,100) - lda #<$68 - ldy #>$68 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_151_afterif -label_asm_152_else - ; source: test_byte_equalities.p8:1343 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_byte_equalities.p8:1345 values[1]=100 - lda #$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1347 if x==values[1] - cmp p8v_x - beq p8l_lbl6a - ; source: test_byte_equalities.p8:1349 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:1350 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1351 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:1353 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1354 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1356 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:1357 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1358 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:1360 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_153_afterif - ; source: test_byte_equalities.p8:1361 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_byte_equalities.p8:1364 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_155_else - ; source: test_byte_equalities.p8:1365 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_byte_equalities.p8:1367 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_byte_equalities.p8:1370 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl6c - ; source: test_byte_equalities.p8:1372 goto skip6c - bra p8l_skip6c - ; source: test_byte_equalities.p8:1373 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1374 skip6c: -p8l_skip6c - ; source: test_byte_equalities.p8:1376 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1377 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1379 goto skip6d - bra p8l_skip6d - ; source: test_byte_equalities.p8:1380 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1381 skip6d: -p8l_skip6d - ; source: test_byte_equalities.p8:1383 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_156_afterif - ; source: test_byte_equalities.p8:1384 success++ - inc p8b_main.p8v_success -label_asm_156_afterif - ; source: test_byte_equalities.p8:1387 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_158_else - ; source: test_byte_equalities.p8:1388 success++ - inc p8b_main.p8v_success - bra label_asm_157_afterif -label_asm_158_else - ; source: test_byte_equalities.p8:1390 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_byte_equalities.p8:1392 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:1099 sub test_is_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS -; non-zeropage variables -p8v_sources .char $00, $00 -p8v_values .char $00, $00 - .pend - ; source: test_byte_equalities.p8:1394 sub test_not_array() { - -p8s_test_not_array .proc -; statements - ; source: test_byte_equalities.p8:1395 byte @shared x - ; source: test_byte_equalities.p8:1396 byte[] values = [0, 0] - ; source: test_byte_equalities.p8:1397 byte[] sources = [0, 0] - ; source: test_byte_equalities.p8:1395 byte @shared x - stz p8v_x - ; source: test_byte_equalities.p8:1398 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_equalities.p8:1399 x=-100 - lda #-$64 - sta p8v_x - ; source: test_byte_equalities.p8:1400 sources[1]=-100 - sta p8v_sources+1 - ; source: test_byte_equalities.p8:1401 values[1]=-100 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1403 if x!=values[1] - cmp p8v_x - bne p8l_lbl1a - ; source: test_byte_equalities.p8:1405 goto skip1a - bra p8l_skip1a - ; source: test_byte_equalities.p8:1406 lbl1a: fail_byte(105,-100) -p8l_lbl1a - lda #<$69 - ldy #>$69 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1407 skip1a: -p8l_skip1a - ; source: test_byte_equalities.p8:1409 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1410 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1412 goto skip1b - bra p8l_skip1b - ; source: test_byte_equalities.p8:1413 lbl1b: fail_byte(106,-100) -p8l_lbl1b - lda #<$6a - ldy #>$6a - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1414 skip1b: -p8l_skip1b - ; source: test_byte_equalities.p8:1416 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_159_afterif - ; source: test_byte_equalities.p8:1417 fail_byte(107,-100) - lda #<$6b - ldy #>$6b - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_159_afterif - ; source: test_byte_equalities.p8:1420 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_161_else - ; source: test_byte_equalities.p8:1421 fail_byte(108,-100) - lda #<$6c - ldy #>$6c - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_160_afterif -label_asm_161_else - ; source: test_byte_equalities.p8:1423 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_byte_equalities.p8:1426 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl1c - ; source: test_byte_equalities.p8:1428 goto skip1c - bra p8l_skip1c - ; source: test_byte_equalities.p8:1429 lbl1c: fail_byte(109,-100) -p8l_lbl1c - lda #<$6d - ldy #>$6d - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1430 skip1c: -p8l_skip1c - ; source: test_byte_equalities.p8:1432 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1433 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1435 goto skip1d - bra p8l_skip1d - ; source: test_byte_equalities.p8:1436 lbl1d: fail_byte(110,-100) -p8l_lbl1d - lda #<$6e - ldy #>$6e - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1437 skip1d: -p8l_skip1d - ; source: test_byte_equalities.p8:1439 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_162_afterif - ; source: test_byte_equalities.p8:1440 fail_byte(111,-100) - lda #<$6f - ldy #>$6f - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_162_afterif - ; source: test_byte_equalities.p8:1443 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_164_else - ; source: test_byte_equalities.p8:1444 fail_byte(112,-100) - lda #<$70 - ldy #>$70 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #-$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_163_afterif -label_asm_164_else - ; source: test_byte_equalities.p8:1446 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_byte_equalities.p8:1448 values[1]=100 - lda #$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1450 if x!=values[1] - cmp p8v_x - bne p8l_lbl2a - ; source: test_byte_equalities.p8:1452 goto skip2a - bra p8l_skip2a - ; source: test_byte_equalities.p8:1453 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1454 skip2a: -p8l_skip2a - ; source: test_byte_equalities.p8:1456 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1457 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1459 goto skip2b - bra p8l_skip2b - ; source: test_byte_equalities.p8:1460 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1461 skip2b: -p8l_skip2b - ; source: test_byte_equalities.p8:1463 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_165_afterif - ; source: test_byte_equalities.p8:1464 success++ - inc p8b_main.p8v_success -label_asm_165_afterif - ; source: test_byte_equalities.p8:1467 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_167_else - ; source: test_byte_equalities.p8:1468 success++ - inc p8b_main.p8v_success - bra label_asm_166_afterif -label_asm_167_else - ; source: test_byte_equalities.p8:1470 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_byte_equalities.p8:1473 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl2c - ; source: test_byte_equalities.p8:1475 goto skip2c - bra p8l_skip2c - ; source: test_byte_equalities.p8:1476 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1477 skip2c: -p8l_skip2c - ; source: test_byte_equalities.p8:1479 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1480 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1482 goto skip2d - bra p8l_skip2d - ; source: test_byte_equalities.p8:1483 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1484 skip2d: -p8l_skip2d - ; source: test_byte_equalities.p8:1486 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_168_afterif - ; source: test_byte_equalities.p8:1487 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_byte_equalities.p8:1490 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_170_else - ; source: test_byte_equalities.p8:1491 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_byte_equalities.p8:1493 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_byte_equalities.p8:1495 x=0 - stz p8v_x - ; source: test_byte_equalities.p8:1496 sources[1]=0 - stz p8v_sources+1 - ; source: test_byte_equalities.p8:1497 values[1]=-100 - lda #-$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1499 if x!=values[1] - cmp p8v_x - bne p8l_lbl3a - ; source: test_byte_equalities.p8:1501 goto skip3a - bra p8l_skip3a - ; source: test_byte_equalities.p8:1502 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1503 skip3a: -p8l_skip3a - ; source: test_byte_equalities.p8:1505 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1506 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1508 goto skip3b - bra p8l_skip3b - ; source: test_byte_equalities.p8:1509 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1510 skip3b: -p8l_skip3b - ; source: test_byte_equalities.p8:1512 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_171_afterif - ; source: test_byte_equalities.p8:1513 success++ - inc p8b_main.p8v_success -label_asm_171_afterif - ; source: test_byte_equalities.p8:1516 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_173_else - ; source: test_byte_equalities.p8:1517 success++ - inc p8b_main.p8v_success - bra label_asm_172_afterif -label_asm_173_else - ; source: test_byte_equalities.p8:1519 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_byte_equalities.p8:1522 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl3c - ; source: test_byte_equalities.p8:1524 goto skip3c - bra p8l_skip3c - ; source: test_byte_equalities.p8:1525 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1526 skip3c: -p8l_skip3c - ; source: test_byte_equalities.p8:1528 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1529 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1531 goto skip3d - bra p8l_skip3d - ; source: test_byte_equalities.p8:1532 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1533 skip3d: -p8l_skip3d - ; source: test_byte_equalities.p8:1535 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_174_afterif - ; source: test_byte_equalities.p8:1536 success++ - inc p8b_main.p8v_success -label_asm_174_afterif - ; source: test_byte_equalities.p8:1539 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_176_else - ; source: test_byte_equalities.p8:1540 success++ - inc p8b_main.p8v_success - bra label_asm_175_afterif -label_asm_176_else - ; source: test_byte_equalities.p8:1542 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_byte_equalities.p8:1544 values[1]=100 - lda #$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1546 if x!=values[1] - cmp p8v_x - bne p8l_lbl4a - ; source: test_byte_equalities.p8:1548 goto skip4a - bra p8l_skip4a - ; source: test_byte_equalities.p8:1549 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1550 skip4a: -p8l_skip4a - ; source: test_byte_equalities.p8:1552 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1553 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1555 goto skip4b - bra p8l_skip4b - ; source: test_byte_equalities.p8:1556 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1557 skip4b: -p8l_skip4b - ; source: test_byte_equalities.p8:1559 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_177_afterif - ; source: test_byte_equalities.p8:1560 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_byte_equalities.p8:1563 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_179_else - ; source: test_byte_equalities.p8:1564 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_byte_equalities.p8:1566 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_byte_equalities.p8:1569 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl4c - ; source: test_byte_equalities.p8:1571 goto skip4c - bra p8l_skip4c - ; source: test_byte_equalities.p8:1572 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1573 skip4c: -p8l_skip4c - ; source: test_byte_equalities.p8:1575 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1576 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1578 goto skip4d - bra p8l_skip4d - ; source: test_byte_equalities.p8:1579 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1580 skip4d: -p8l_skip4d - ; source: test_byte_equalities.p8:1582 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_180_afterif - ; source: test_byte_equalities.p8:1583 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_byte_equalities.p8:1586 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_182_else - ; source: test_byte_equalities.p8:1587 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_byte_equalities.p8:1589 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_byte_equalities.p8:1591 x=100 - lda #$64 - sta p8v_x - ; source: test_byte_equalities.p8:1592 sources[1]=100 - sta p8v_sources+1 - ; source: test_byte_equalities.p8:1593 values[1]=-100 - lda #-$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1595 if x!=values[1] - cmp p8v_x - bne p8l_lbl5a - ; source: test_byte_equalities.p8:1597 goto skip5a - bra p8l_skip5a - ; source: test_byte_equalities.p8:1598 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1599 skip5a: -p8l_skip5a - ; source: test_byte_equalities.p8:1601 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1602 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1604 goto skip5b - bra p8l_skip5b - ; source: test_byte_equalities.p8:1605 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1606 skip5b: -p8l_skip5b - ; source: test_byte_equalities.p8:1608 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_183_afterif - ; source: test_byte_equalities.p8:1609 success++ - inc p8b_main.p8v_success -label_asm_183_afterif - ; source: test_byte_equalities.p8:1612 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_185_else - ; source: test_byte_equalities.p8:1613 success++ - inc p8b_main.p8v_success - bra label_asm_184_afterif -label_asm_185_else - ; source: test_byte_equalities.p8:1615 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_byte_equalities.p8:1618 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl5c - ; source: test_byte_equalities.p8:1620 goto skip5c - bra p8l_skip5c - ; source: test_byte_equalities.p8:1621 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1622 skip5c: -p8l_skip5c - ; source: test_byte_equalities.p8:1624 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1625 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1627 goto skip5d - bra p8l_skip5d - ; source: test_byte_equalities.p8:1628 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - ; source: test_byte_equalities.p8:1629 skip5d: -p8l_skip5d - ; source: test_byte_equalities.p8:1631 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_186_afterif - ; source: test_byte_equalities.p8:1632 success++ - inc p8b_main.p8v_success -label_asm_186_afterif - ; source: test_byte_equalities.p8:1635 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_188_else - ; source: test_byte_equalities.p8:1636 success++ - inc p8b_main.p8v_success - bra label_asm_187_afterif -label_asm_188_else - ; source: test_byte_equalities.p8:1638 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_byte_equalities.p8:1640 values[1]=100 - lda #$64 - sta p8v_values+1 - ; source: test_byte_equalities.p8:1642 if x!=values[1] - cmp p8v_x - bne p8l_lbl6a - ; source: test_byte_equalities.p8:1644 goto skip6a - bra p8l_skip6a - ; source: test_byte_equalities.p8:1645 lbl6a: fail_byte(113,100) -p8l_lbl6a - lda #<$71 - ldy #>$71 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1646 skip6a: -p8l_skip6a - ; source: test_byte_equalities.p8:1648 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1649 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1651 goto skip6b - bra p8l_skip6b - ; source: test_byte_equalities.p8:1652 lbl6b: fail_byte(114,100) -p8l_lbl6b - lda #<$72 - ldy #>$72 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1653 skip6b: -p8l_skip6b - ; source: test_byte_equalities.p8:1655 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_189_afterif - ; source: test_byte_equalities.p8:1656 fail_byte(115,100) - lda #<$73 - ldy #>$73 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_189_afterif - ; source: test_byte_equalities.p8:1659 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_191_else - ; source: test_byte_equalities.p8:1660 fail_byte(116,100) - lda #<$74 - ldy #>$74 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_190_afterif -label_asm_191_else - ; source: test_byte_equalities.p8:1662 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_byte_equalities.p8:1665 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl6c - ; source: test_byte_equalities.p8:1667 goto skip6c - bra p8l_skip6c - ; source: test_byte_equalities.p8:1668 lbl6c: fail_byte(117,100) -p8l_lbl6c - lda #<$75 - ldy #>$75 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1669 skip6c: -p8l_skip6c - ; source: test_byte_equalities.p8:1671 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_equalities.p8:1672 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_byte_equalities.p8:1674 goto skip6d - bra p8l_skip6d - ; source: test_byte_equalities.p8:1675 lbl6d: fail_byte(118,100) -p8l_lbl6d - lda #<$76 - ldy #>$76 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_equalities.p8:1676 skip6d: -p8l_skip6d - ; source: test_byte_equalities.p8:1678 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_192_afterif - ; source: test_byte_equalities.p8:1679 fail_byte(119,100) - lda #<$77 - ldy #>$77 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte -label_asm_192_afterif - ; source: test_byte_equalities.p8:1682 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_194_else - ; source: test_byte_equalities.p8:1683 fail_byte(120,100) - lda #<$78 - ldy #>$78 - sta p8b_main.p8s_fail_byte.p8v_idx - sty p8b_main.p8s_fail_byte.p8v_idx+1 - - lda #$64 - sta p8b_main.p8s_fail_byte.p8v_v1 - jsr p8b_main.p8s_fail_byte - bra label_asm_193_afterif -label_asm_194_else - ; source: test_byte_equalities.p8:1685 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_byte_equalities.p8:1687 verify_success(32) - lda #$20 - jmp p8b_main.p8s_verify_success - ; source: test_byte_equalities.p8:1394 sub test_not_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS -; non-zeropage variables -p8v_sources .char $00, $00 -p8v_values .char $00, $00 - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $44, $41, $54, $41, $54, $59, $50, $45 - .byte $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[]: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[]: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 - - ; source: test_byte_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ; source: test_byte_equalities.p8:18 txt.print("==0: ") - ; source: test_byte_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_byte_equalities.p8:22 txt.print("\n==number: ") - ; source: test_byte_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_byte_equalities.p8:26 txt.print("\n==var: ") - ; source: test_byte_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_byte_equalities.p8:30 txt.print("\n==array[]: ") - ; source: test_byte_equalities.p8:32 txt.print("\n!=array[]: ") - ; source: test_byte_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_byte_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_byte_equalities.p8:45 txt.print(" **failed** ") - ; source: test_byte_equalities.p8:47 txt.print(" success, expected ") - ; source: test_byte_equalities.p8:53 txt.print(" **fail#") - ; source: test_byte_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_byte_equalities.p8 b/compiler/test/comparisons/test_byte_equalities.p8 deleted file mode 100644 index ab2317fe5..000000000 --- a/compiler/test/comparisons/test_byte_equalities.p8 +++ /dev/null @@ -1,1691 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "byte" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[]: ") - test_is_array() - txt.print("\n!=array[]: ") - test_not_array() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx, byte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_b(v1) - txt.print(" **") - } - - sub fail_ubyte(uword idx, ubyte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_ub(v1) - txt.print(" **") - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - sub fail_float(uword idx, float v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - floats.print(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - byte @shared x - success = 0 - - x=0 - ; direct jump - if x==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x==0 - success++ - - ; with else - if x==0 - success++ - else - cx16.r0L++ - - x = -100 - ; direct jump - if x==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x==0 - success-- - - ; with else - if x==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - byte @shared x - success = 0 - - x=-100 - ; direct jump - if x!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x!=0 - success++ - - ; with else - if x!=0 - success++ - else - cx16.r0L++ - - x = 0 - ; direct jump - if x!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x!=0 - success-- - - ; with else - if x!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - byte @shared x - success = 0 - x=-100 - ; direct jump - if x==-100 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==-100 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==-100 - success++ - - ; with else - if x==-100 - success++ - else - cx16.r0L++ - - ; direct jump - if x==100 - goto lbl2a - goto skip2a -lbl2a: fail_byte(1,-100) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==100 - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(2,-100) -skip2b: - ; no else - if x==100 - fail_byte(3,-100) - - ; with else - if x==100 - fail_byte(4,-100) - else - cx16.r0L++ - - x=0 - ; direct jump - if x==-100 - goto lbl3a - goto skip3a -lbl3a: fail_byte(5,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==-100 - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(6,0) -skip3b: - ; no else - if x==-100 - fail_byte(7,0) - - ; with else - if x==-100 - fail_byte(8,0) - else - cx16.r0L++ - - ; direct jump - if x==100 - goto lbl4a - goto skip4a -lbl4a: fail_byte(9,0) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==100 - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(10,0) -skip4b: - ; no else - if x==100 - fail_byte(11,0) - - ; with else - if x==100 - fail_byte(12,0) - else - cx16.r0L++ - - x=100 - ; direct jump - if x==-100 - goto lbl5a - goto skip5a -lbl5a: fail_byte(13,100) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==-100 - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(14,100) -skip5b: - ; no else - if x==-100 - fail_byte(15,100) - - ; with else - if x==-100 - fail_byte(16,100) - else - cx16.r0L++ - - ; direct jump - if x==100 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==100 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==100 - success++ - - ; with else - if x==100 - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_number() { - byte @shared x - success = 0 - x=-100 - ; direct jump - if x!=-100 - goto lbl1a - goto skip1a -lbl1a: fail_byte(17,-100) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=-100 - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(18,-100) -skip1b: - ; no else - if x!=-100 - fail_byte(19,-100) - - ; with else - if x!=-100 - fail_byte(20,-100) - else - cx16.r0L++ - - ; direct jump - if x!=100 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=100 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=100 - success++ - - ; with else - if x!=100 - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x!=-100 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=-100 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=-100 - success++ - - ; with else - if x!=-100 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=100 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=100 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=100 - success++ - - ; with else - if x!=100 - success++ - else - cx16.r0L++ - - x=100 - ; direct jump - if x!=-100 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=-100 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=-100 - success++ - - ; with else - if x!=-100 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=100 - goto lbl6a - goto skip6a -lbl6a: fail_byte(21,100) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=100 - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(22,100) -skip6b: - ; no else - if x!=100 - fail_byte(23,100) - - ; with else - if x!=100 - fail_byte(24,100) - else - cx16.r0L++ - - verify_success(16) -} - sub test_is_var() { - byte @shared x, value - success = 0 - x=-100 - value=-100 - ; direct jump - if x==value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=100 - ; direct jump - if x==value - goto lbl2a - goto skip2a -lbl2a: fail_byte(25,-100) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==value - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(26,-100) -skip2b: - ; no else - if x==value - fail_byte(27,-100) - - ; with else - if x==value - fail_byte(28,-100) - else - cx16.r0L++ - - x=0 - value=-100 - ; direct jump - if x==value - goto lbl3a - goto skip3a -lbl3a: fail_byte(29,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==value - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(30,0) -skip3b: - ; no else - if x==value - fail_byte(31,0) - - ; with else - if x==value - fail_byte(32,0) - else - cx16.r0L++ - - value=100 - ; direct jump - if x==value - goto lbl4a - goto skip4a -lbl4a: fail_byte(33,0) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==value - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(34,0) -skip4b: - ; no else - if x==value - fail_byte(35,0) - - ; with else - if x==value - fail_byte(36,0) - else - cx16.r0L++ - - x=100 - value=-100 - ; direct jump - if x==value - goto lbl5a - goto skip5a -lbl5a: fail_byte(37,100) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==value - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(38,100) -skip5b: - ; no else - if x==value - fail_byte(39,100) - - ; with else - if x==value - fail_byte(40,100) - else - cx16.r0L++ - - value=100 - ; direct jump - if x==value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_var() { - byte @shared x, value - success = 0 - x=-100 - value=-100 - ; direct jump - if x!=value - goto lbl1a - goto skip1a -lbl1a: fail_byte(41,-100) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=value - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(42,-100) -skip1b: - ; no else - if x!=value - fail_byte(43,-100) - - ; with else - if x!=value - fail_byte(44,-100) - else - cx16.r0L++ - - value=100 - ; direct jump - if x!=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=0 - value=-100 - ; direct jump - if x!=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=100 - ; direct jump - if x!=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=100 - value=-100 - ; direct jump - if x!=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=100 - ; direct jump - if x!=value - goto lbl6a - goto skip6a -lbl6a: fail_byte(45,100) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=value - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(46,100) -skip6b: - ; no else - if x!=value - fail_byte(47,100) - - ; with else - if x!=value - fail_byte(48,100) - else - cx16.r0L++ - - verify_success(16) -} - sub test_is_expr() { - byte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-100 - ; direct jump - if x==cx16.r4sL+-100-cx16.r5sL - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==cx16.r4sL+-100-cx16.r5sL - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==cx16.r4sL+-100-cx16.r5sL - success++ - - ; with else - if x==cx16.r4sL+-100-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4sL+100-cx16.r5sL - goto lbl2a - goto skip2a -lbl2a: fail_byte(49,-100) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==cx16.r4sL+100-cx16.r5sL - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(50,-100) -skip2b: - ; no else - if x==cx16.r4sL+100-cx16.r5sL - fail_byte(51,-100) - - ; with else - if x==cx16.r4sL+100-cx16.r5sL - fail_byte(52,-100) - else - cx16.r0L++ - - x=0 - ; direct jump - if x==cx16.r4sL+-100-cx16.r5sL - goto lbl3a - goto skip3a -lbl3a: fail_byte(53,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==cx16.r4sL+-100-cx16.r5sL - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(54,0) -skip3b: - ; no else - if x==cx16.r4sL+-100-cx16.r5sL - fail_byte(55,0) - - ; with else - if x==cx16.r4sL+-100-cx16.r5sL - fail_byte(56,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4sL+100-cx16.r5sL - goto lbl4a - goto skip4a -lbl4a: fail_byte(57,0) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==cx16.r4sL+100-cx16.r5sL - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(58,0) -skip4b: - ; no else - if x==cx16.r4sL+100-cx16.r5sL - fail_byte(59,0) - - ; with else - if x==cx16.r4sL+100-cx16.r5sL - fail_byte(60,0) - else - cx16.r0L++ - - x=100 - ; direct jump - if x==cx16.r4sL+-100-cx16.r5sL - goto lbl5a - goto skip5a -lbl5a: fail_byte(61,100) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==cx16.r4sL+-100-cx16.r5sL - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(62,100) -skip5b: - ; no else - if x==cx16.r4sL+-100-cx16.r5sL - fail_byte(63,100) - - ; with else - if x==cx16.r4sL+-100-cx16.r5sL - fail_byte(64,100) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4sL+100-cx16.r5sL - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==cx16.r4sL+100-cx16.r5sL - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==cx16.r4sL+100-cx16.r5sL - success++ - - ; with else - if x==cx16.r4sL+100-cx16.r5sL - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_expr() { - byte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-100 - ; direct jump - if x!=cx16.r4sL+-100-cx16.r5sL - goto lbl1a - goto skip1a -lbl1a: fail_byte(65,-100) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=cx16.r4sL+-100-cx16.r5sL - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(66,-100) -skip1b: - ; no else - if x!=cx16.r4sL+-100-cx16.r5sL - fail_byte(67,-100) - - ; with else - if x!=cx16.r4sL+-100-cx16.r5sL - fail_byte(68,-100) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4sL+100-cx16.r5sL - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=cx16.r4sL+100-cx16.r5sL - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=cx16.r4sL+100-cx16.r5sL - success++ - - ; with else - if x!=cx16.r4sL+100-cx16.r5sL - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x!=cx16.r4sL+-100-cx16.r5sL - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=cx16.r4sL+-100-cx16.r5sL - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=cx16.r4sL+-100-cx16.r5sL - success++ - - ; with else - if x!=cx16.r4sL+-100-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4sL+100-cx16.r5sL - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=cx16.r4sL+100-cx16.r5sL - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=cx16.r4sL+100-cx16.r5sL - success++ - - ; with else - if x!=cx16.r4sL+100-cx16.r5sL - success++ - else - cx16.r0L++ - - x=100 - ; direct jump - if x!=cx16.r4sL+-100-cx16.r5sL - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=cx16.r4sL+-100-cx16.r5sL - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=cx16.r4sL+-100-cx16.r5sL - success++ - - ; with else - if x!=cx16.r4sL+-100-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4sL+100-cx16.r5sL - goto lbl6a - goto skip6a -lbl6a: fail_byte(69,100) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=cx16.r4sL+100-cx16.r5sL - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(70,100) -skip6b: - ; no else - if x!=cx16.r4sL+100-cx16.r5sL - fail_byte(71,100) - - ; with else - if x!=cx16.r4sL+100-cx16.r5sL - fail_byte(72,100) - else - cx16.r0L++ - - verify_success(16) -} - sub test_is_array() { - byte @shared x - byte[] values = [0, 0] - byte[] sources = [0, 0] - success = 0 - x=-100 - sources[1]=-100 - values[1]=-100 - ; direct jump - if x==values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=100 - ; direct jump - if x==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_byte(73,-100) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(74,-100) -skip2b: - ; no else - if x==values[1] - fail_byte(75,-100) - - ; with else - if x==values[1] - fail_byte(76,-100) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: fail_byte(77,-100) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_byte(78,-100) -skip2d: - ; no else - if sources[1]==values[1] - fail_byte(79,-100) - - ; with else - if sources[1]==values[1] - fail_byte(80,-100) - else - cx16.r0L++ - - x=0 - sources[1]=0 - values[1]=-100 - ; direct jump - if x==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_byte(81,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(82,0) -skip3b: - ; no else - if x==values[1] - fail_byte(83,0) - - ; with else - if x==values[1] - fail_byte(84,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl3c - goto skip3c -lbl3c: fail_byte(85,0) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]==values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_byte(86,0) -skip3d: - ; no else - if sources[1]==values[1] - fail_byte(87,0) - - ; with else - if sources[1]==values[1] - fail_byte(88,0) - else - cx16.r0L++ - - values[1]=100 - ; direct jump - if x==values[1] - goto lbl4a - goto skip4a -lbl4a: fail_byte(89,0) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(90,0) -skip4b: - ; no else - if x==values[1] - fail_byte(91,0) - - ; with else - if x==values[1] - fail_byte(92,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl4c - goto skip4c -lbl4c: fail_byte(93,0) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]==values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_byte(94,0) -skip4d: - ; no else - if sources[1]==values[1] - fail_byte(95,0) - - ; with else - if sources[1]==values[1] - fail_byte(96,0) - else - cx16.r0L++ - - x=100 - sources[1]=100 - values[1]=-100 - ; direct jump - if x==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_byte(97,100) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(98,100) -skip5b: - ; no else - if x==values[1] - fail_byte(99,100) - - ; with else - if x==values[1] - fail_byte(100,100) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl5c - goto skip5c -lbl5c: fail_byte(101,100) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]==values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_byte(102,100) -skip5d: - ; no else - if sources[1]==values[1] - fail_byte(103,100) - - ; with else - if sources[1]==values[1] - fail_byte(104,100) - else - cx16.r0L++ - - values[1]=100 - ; direct jump - if x==values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]==values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_array() { - byte @shared x - byte[] values = [0, 0] - byte[] sources = [0, 0] - success = 0 - x=-100 - sources[1]=-100 - values[1]=-100 - ; direct jump - if x!=values[1] - goto lbl1a - goto skip1a -lbl1a: fail_byte(105,-100) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(106,-100) -skip1b: - ; no else - if x!=values[1] - fail_byte(107,-100) - - ; with else - if x!=values[1] - fail_byte(108,-100) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: fail_byte(109,-100) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_byte(110,-100) -skip1d: - ; no else - if sources[1]!=values[1] - fail_byte(111,-100) - - ; with else - if sources[1]!=values[1] - fail_byte(112,-100) - else - cx16.r0L++ - - values[1]=100 - ; direct jump - if x!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=0 - sources[1]=0 - values[1]=-100 - ; direct jump - if x!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]!=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=100 - ; direct jump - if x!=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]!=values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=100 - sources[1]=100 - values[1]=-100 - ; direct jump - if x!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]!=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=100 - ; direct jump - if x!=values[1] - goto lbl6a - goto skip6a -lbl6a: fail_byte(113,100) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(114,100) -skip6b: - ; no else - if x!=values[1] - fail_byte(115,100) - - ; with else - if x!=values[1] - fail_byte(116,100) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl6c - goto skip6c -lbl6c: fail_byte(117,100) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]!=values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_byte(118,100) -skip6d: - ; no else - if sources[1]!=values[1] - fail_byte(119,100) - - ; with else - if sources[1]!=values[1] - fail_byte(120,100) - else - cx16.r0L++ - - verify_success(32) -} - -} - diff --git a/compiler/test/comparisons/test_byte_gt.asm b/compiler/test/comparisons/test_byte_gt.asm deleted file mode 100644 index a42763b96..000000000 --- a/compiler/test/comparisons/test_byte_gt.asm +++ /dev/null @@ -1,9320 +0,0 @@ -; w65c02 assembly code for 'test_byte_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:41 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_byte_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"byte" - .byte $42, $59, $54, $45, $00 - - ; source: test_byte_gt.p8:9 ubyte success = 0 - ; source: test_byte_gt.p8:10 str datatype = "byte" - ; source: test_byte_gt.p8:11 uword @shared comparison - ; source: test_byte_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_byte_gt.p8:14 txt.print("\ngreater-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #number: ") - ldy #>prog8_interned_strings.string_2 - lda #var: ") - ldy #>prog8_interned_strings.string_3 - lda #array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #-1 - bpl p8l_lbl1a - ; source: test_byte_gt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_byte_gt.p8:79 lbl1a: fail_byte(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:80 skip1a: -p8l_skip1a - ; source: test_byte_gt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:83 if x>-1 - lda p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_byte_gt.p8:86 lbl1b: fail_byte(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:87 skip1b: -p8l_skip1b - ; source: test_byte_gt.p8:89 if x>-1 - lda p8v_x - bmi label_asm_3_afterif - ; source: test_byte_gt.p8:90 fail_byte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_byte -label_asm_3_afterif - ; source: test_byte_gt.p8:93 if x>-1 - lda p8v_x - bmi label_asm_5_else - ; source: test_byte_gt.p8:94 fail_byte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_byte - bra label_asm_4_afterif -label_asm_5_else - ; source: test_byte_gt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_byte_gt.p8:99 if x>0 - lda p8v_x - beq + - bpl p8l_lbl2a -+ - ; source: test_byte_gt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_byte_gt.p8:102 lbl2a: fail_byte(5) -p8l_lbl2a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:103 skip2a: -p8l_skip2a - ; source: test_byte_gt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:106 if x>0 - lda p8v_x - bmi + - beq + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_byte_gt.p8:109 lbl2b: fail_byte(6) -p8l_lbl2b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:110 skip2b: -p8l_skip2b - ; source: test_byte_gt.p8:112 if x>0 - lda p8v_x - bmi label_asm_6_afterif - beq label_asm_6_afterif - ; source: test_byte_gt.p8:113 fail_byte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_byte -label_asm_6_afterif - ; source: test_byte_gt.p8:116 if x>0 - lda p8v_x - bmi label_asm_8_else - beq label_asm_8_else - ; source: test_byte_gt.p8:117 fail_byte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_byte - bra label_asm_7_afterif -label_asm_8_else - ; source: test_byte_gt.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_byte_gt.p8:122 if x>1 - lda p8v_x - cmp #2 - bpl p8l_lbl3a - ; source: test_byte_gt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_byte_gt.p8:125 lbl3a: fail_byte(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:126 skip3a: -p8l_skip3a - ; source: test_byte_gt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:129 if x>1 - lda p8v_x - cmp #2 - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_byte_gt.p8:132 lbl3b: fail_byte(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:133 skip3b: -p8l_skip3b - ; source: test_byte_gt.p8:135 if x>1 - lda p8v_x - cmp #2 - bmi label_asm_9_afterif - ; source: test_byte_gt.p8:136 fail_byte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_byte -label_asm_9_afterif - ; source: test_byte_gt.p8:139 if x>1 - lda p8v_x - cmp #2 - bmi label_asm_11_else - ; source: test_byte_gt.p8:140 fail_byte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_byte - bra label_asm_10_afterif -label_asm_11_else - ; source: test_byte_gt.p8:142 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_byte_gt.p8:144 x=0 - stz p8v_x - ; source: test_byte_gt.p8:146 if x>-1 - lda p8v_x - bpl p8l_lbl4a - ; source: test_byte_gt.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_byte_gt.p8:149 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:150 skip4a: -p8l_skip4a - ; source: test_byte_gt.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:153 if x>-1 - lda p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_byte_gt.p8:156 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:157 skip4b: -p8l_skip4b - ; source: test_byte_gt.p8:159 if x>-1 - lda p8v_x - bmi label_asm_12_afterif - ; source: test_byte_gt.p8:160 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_byte_gt.p8:163 if x>-1 - lda p8v_x - bmi label_asm_14_else - ; source: test_byte_gt.p8:164 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_byte_gt.p8:166 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_byte_gt.p8:169 if x>0 - lda p8v_x - beq + - bpl p8l_lbl5a -+ - ; source: test_byte_gt.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_byte_gt.p8:172 lbl5a: fail_byte(13) -p8l_lbl5a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:173 skip5a: -p8l_skip5a - ; source: test_byte_gt.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:176 if x>0 - lda p8v_x - bmi + - beq + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_byte_gt.p8:179 lbl5b: fail_byte(14) -p8l_lbl5b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:180 skip5b: -p8l_skip5b - ; source: test_byte_gt.p8:182 if x>0 - lda p8v_x - bmi label_asm_15_afterif - beq label_asm_15_afterif - ; source: test_byte_gt.p8:183 fail_byte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_byte -label_asm_15_afterif - ; source: test_byte_gt.p8:186 if x>0 - lda p8v_x - bmi label_asm_17_else - beq label_asm_17_else - ; source: test_byte_gt.p8:187 fail_byte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_byte - bra label_asm_16_afterif -label_asm_17_else - ; source: test_byte_gt.p8:189 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_byte_gt.p8:192 if x>1 - lda p8v_x - cmp #2 - bpl p8l_lbl6a - ; source: test_byte_gt.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_byte_gt.p8:195 lbl6a: fail_byte(17) -p8l_lbl6a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:196 skip6a: -p8l_skip6a - ; source: test_byte_gt.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:199 if x>1 - lda p8v_x - cmp #2 - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_byte_gt.p8:202 lbl6b: fail_byte(18) -p8l_lbl6b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:203 skip6b: -p8l_skip6b - ; source: test_byte_gt.p8:205 if x>1 - lda p8v_x - cmp #2 - bmi label_asm_18_afterif - ; source: test_byte_gt.p8:206 fail_byte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_byte -label_asm_18_afterif - ; source: test_byte_gt.p8:209 if x>1 - lda p8v_x - cmp #2 - bmi label_asm_20_else - ; source: test_byte_gt.p8:210 fail_byte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_byte - bra label_asm_19_afterif -label_asm_20_else - ; source: test_byte_gt.p8:212 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_byte_gt.p8:214 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gt.p8:216 if x>-1 - bpl p8l_lbl7a - ; source: test_byte_gt.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_byte_gt.p8:219 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:220 skip7a: -p8l_skip7a - ; source: test_byte_gt.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:223 if x>-1 - lda p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_byte_gt.p8:226 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:227 skip7b: -p8l_skip7b - ; source: test_byte_gt.p8:229 if x>-1 - lda p8v_x - bmi label_asm_21_afterif - ; source: test_byte_gt.p8:230 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_byte_gt.p8:233 if x>-1 - lda p8v_x - bmi label_asm_23_else - ; source: test_byte_gt.p8:234 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_byte_gt.p8:236 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_byte_gt.p8:239 if x>0 - lda p8v_x - beq + - bpl p8l_lbl8a -+ - ; source: test_byte_gt.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_byte_gt.p8:242 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:243 skip8a: -p8l_skip8a - ; source: test_byte_gt.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:246 if x>0 - lda p8v_x - bmi + - beq + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_byte_gt.p8:249 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:250 skip8b: -p8l_skip8b - ; source: test_byte_gt.p8:252 if x>0 - lda p8v_x - bmi label_asm_24_afterif - beq label_asm_24_afterif - ; source: test_byte_gt.p8:253 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_byte_gt.p8:256 if x>0 - lda p8v_x - bmi label_asm_26_else - beq label_asm_26_else - ; source: test_byte_gt.p8:257 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_byte_gt.p8:259 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_byte_gt.p8:262 if x>1 - lda p8v_x - cmp #2 - bpl p8l_lbl9a - ; source: test_byte_gt.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_byte_gt.p8:265 lbl9a: fail_byte(21) -p8l_lbl9a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:266 skip9a: -p8l_skip9a - ; source: test_byte_gt.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:269 if x>1 - lda p8v_x - cmp #2 - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_byte_gt.p8:272 lbl9b: fail_byte(22) -p8l_lbl9b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:273 skip9b: -p8l_skip9b - ; source: test_byte_gt.p8:275 if x>1 - lda p8v_x - cmp #2 - bmi label_asm_27_afterif - ; source: test_byte_gt.p8:276 fail_byte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_byte -label_asm_27_afterif - ; source: test_byte_gt.p8:279 if x>1 - lda p8v_x - cmp #2 - bmi label_asm_29_else - ; source: test_byte_gt.p8:280 fail_byte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_byte - bra label_asm_28_afterif -label_asm_29_else - ; source: test_byte_gt.p8:282 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_byte_gt.p8:284 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_gt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_gt.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_byte_gt.p8:287 byte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_byte_gt.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_gt.p8:289 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_gt.p8:290 value=-1 - sta p8v_value - ; source: test_byte_gt.p8:292 if x>value - sec - sbc p8v_x - bmi p8l_lbl1a - ; source: test_byte_gt.p8:294 goto skip1a - bra p8l_skip1a - ; source: test_byte_gt.p8:295 lbl1a: fail_byte(25) -p8l_lbl1a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:296 skip1a: -p8l_skip1a - ; source: test_byte_gt.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:299 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:301 goto skip1b - bra p8l_skip1b - ; source: test_byte_gt.p8:302 lbl1b: fail_byte(26) -p8l_lbl1b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:303 skip1b: -p8l_skip1b - ; source: test_byte_gt.p8:305 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_30_afterif - ; source: test_byte_gt.p8:306 fail_byte(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_byte -label_asm_30_afterif - ; source: test_byte_gt.p8:309 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_32_else - ; source: test_byte_gt.p8:310 fail_byte(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_byte - bra label_asm_31_afterif -label_asm_32_else - ; source: test_byte_gt.p8:312 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_byte_gt.p8:314 value=0 - stz p8v_value - ; source: test_byte_gt.p8:316 if x>value - lda p8v_value - sec - sbc p8v_x - bmi p8l_lbl2a - ; source: test_byte_gt.p8:318 goto skip2a - bra p8l_skip2a - ; source: test_byte_gt.p8:319 lbl2a: fail_byte(29) -p8l_lbl2a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:320 skip2a: -p8l_skip2a - ; source: test_byte_gt.p8:322 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:323 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:325 goto skip2b - bra p8l_skip2b - ; source: test_byte_gt.p8:326 lbl2b: fail_byte(30) -p8l_lbl2b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:327 skip2b: -p8l_skip2b - ; source: test_byte_gt.p8:329 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_33_afterif - ; source: test_byte_gt.p8:330 fail_byte(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_byte -label_asm_33_afterif - ; source: test_byte_gt.p8:333 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_35_else - ; source: test_byte_gt.p8:334 fail_byte(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_byte - bra label_asm_34_afterif -label_asm_35_else - ; source: test_byte_gt.p8:336 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_byte_gt.p8:338 value=1 - lda #1 - sta p8v_value - ; source: test_byte_gt.p8:340 if x>value - sec - sbc p8v_x - bmi p8l_lbl3a - ; source: test_byte_gt.p8:342 goto skip3a - bra p8l_skip3a - ; source: test_byte_gt.p8:343 lbl3a: fail_byte(33) -p8l_lbl3a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:344 skip3a: -p8l_skip3a - ; source: test_byte_gt.p8:346 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:347 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:349 goto skip3b - bra p8l_skip3b - ; source: test_byte_gt.p8:350 lbl3b: fail_byte(34) -p8l_lbl3b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:351 skip3b: -p8l_skip3b - ; source: test_byte_gt.p8:353 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_36_afterif - ; source: test_byte_gt.p8:354 fail_byte(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_byte -label_asm_36_afterif - ; source: test_byte_gt.p8:357 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_38_else - ; source: test_byte_gt.p8:358 fail_byte(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_byte - bra label_asm_37_afterif -label_asm_38_else - ; source: test_byte_gt.p8:360 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_byte_gt.p8:362 x=0 - stz p8v_x - ; source: test_byte_gt.p8:363 value=-1 - lda #-1 - sta p8v_value - ; source: test_byte_gt.p8:365 if x>value - sec - sbc p8v_x - bmi p8l_lbl4a - ; source: test_byte_gt.p8:367 goto skip4a - bra p8l_skip4a - ; source: test_byte_gt.p8:368 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:369 skip4a: -p8l_skip4a - ; source: test_byte_gt.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:372 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:374 goto skip4b - bra p8l_skip4b - ; source: test_byte_gt.p8:375 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:376 skip4b: -p8l_skip4b - ; source: test_byte_gt.p8:378 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_39_afterif - ; source: test_byte_gt.p8:379 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_byte_gt.p8:382 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_41_else - ; source: test_byte_gt.p8:383 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_byte_gt.p8:385 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_byte_gt.p8:387 value=0 - stz p8v_value - ; source: test_byte_gt.p8:389 if x>value - lda p8v_value - sec - sbc p8v_x - bmi p8l_lbl5a - ; source: test_byte_gt.p8:391 goto skip5a - bra p8l_skip5a - ; source: test_byte_gt.p8:392 lbl5a: fail_byte(37) -p8l_lbl5a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:393 skip5a: -p8l_skip5a - ; source: test_byte_gt.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:396 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:398 goto skip5b - bra p8l_skip5b - ; source: test_byte_gt.p8:399 lbl5b: fail_byte(38) -p8l_lbl5b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:400 skip5b: -p8l_skip5b - ; source: test_byte_gt.p8:402 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_42_afterif - ; source: test_byte_gt.p8:403 fail_byte(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_byte -label_asm_42_afterif - ; source: test_byte_gt.p8:406 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_44_else - ; source: test_byte_gt.p8:407 fail_byte(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_byte - bra label_asm_43_afterif -label_asm_44_else - ; source: test_byte_gt.p8:409 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_byte_gt.p8:411 value=1 - lda #1 - sta p8v_value - ; source: test_byte_gt.p8:413 if x>value - sec - sbc p8v_x - bmi p8l_lbl6a - ; source: test_byte_gt.p8:415 goto skip6a - bra p8l_skip6a - ; source: test_byte_gt.p8:416 lbl6a: fail_byte(41) -p8l_lbl6a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:417 skip6a: -p8l_skip6a - ; source: test_byte_gt.p8:419 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:420 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:422 goto skip6b - bra p8l_skip6b - ; source: test_byte_gt.p8:423 lbl6b: fail_byte(42) -p8l_lbl6b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:424 skip6b: -p8l_skip6b - ; source: test_byte_gt.p8:426 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_45_afterif - ; source: test_byte_gt.p8:427 fail_byte(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_byte -label_asm_45_afterif - ; source: test_byte_gt.p8:430 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_47_else - ; source: test_byte_gt.p8:431 fail_byte(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_byte - bra label_asm_46_afterif -label_asm_47_else - ; source: test_byte_gt.p8:433 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_byte_gt.p8:435 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gt.p8:436 value=-1 - lda #-1 - sta p8v_value - ; source: test_byte_gt.p8:438 if x>value - sec - sbc p8v_x - bmi p8l_lbl7a - ; source: test_byte_gt.p8:440 goto skip7a - bra p8l_skip7a - ; source: test_byte_gt.p8:441 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:442 skip7a: -p8l_skip7a - ; source: test_byte_gt.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:445 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:447 goto skip7b - bra p8l_skip7b - ; source: test_byte_gt.p8:448 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:449 skip7b: -p8l_skip7b - ; source: test_byte_gt.p8:451 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_48_afterif - ; source: test_byte_gt.p8:452 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_byte_gt.p8:455 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_50_else - ; source: test_byte_gt.p8:456 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_byte_gt.p8:458 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_byte_gt.p8:460 value=0 - stz p8v_value - ; source: test_byte_gt.p8:462 if x>value - lda p8v_value - sec - sbc p8v_x - bmi p8l_lbl8a - ; source: test_byte_gt.p8:464 goto skip8a - bra p8l_skip8a - ; source: test_byte_gt.p8:465 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:466 skip8a: -p8l_skip8a - ; source: test_byte_gt.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:469 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:471 goto skip8b - bra p8l_skip8b - ; source: test_byte_gt.p8:472 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:473 skip8b: -p8l_skip8b - ; source: test_byte_gt.p8:475 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_51_afterif - ; source: test_byte_gt.p8:476 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_byte_gt.p8:479 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_53_else - ; source: test_byte_gt.p8:480 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_byte_gt.p8:482 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_byte_gt.p8:484 value=1 - lda #1 - sta p8v_value - ; source: test_byte_gt.p8:486 if x>value - sec - sbc p8v_x - bmi p8l_lbl9a - ; source: test_byte_gt.p8:488 goto skip9a - bra p8l_skip9a - ; source: test_byte_gt.p8:489 lbl9a: fail_byte(45) -p8l_lbl9a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:490 skip9a: -p8l_skip9a - ; source: test_byte_gt.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:493 if x>value - lda p8v_value - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:495 goto skip9b - bra p8l_skip9b - ; source: test_byte_gt.p8:496 lbl9b: fail_byte(46) -p8l_lbl9b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:497 skip9b: -p8l_skip9b - ; source: test_byte_gt.p8:499 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_54_afterif - ; source: test_byte_gt.p8:500 fail_byte(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_byte -label_asm_54_afterif - ; source: test_byte_gt.p8:503 if x>value - lda p8v_value - sec - sbc p8v_x - bpl label_asm_56_else - ; source: test_byte_gt.p8:504 fail_byte(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_byte - bra label_asm_55_afterif -label_asm_56_else - ; source: test_byte_gt.p8:506 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_byte_gt.p8:508 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_gt.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .char ? -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_gt.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_byte_gt.p8:511 byte @shared x - ; source: test_byte_gt.p8:512 byte[] values = [0, 0] - ; source: test_byte_gt.p8:511 byte @shared x - stz p8v_x - ; source: test_byte_gt.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_gt.p8:514 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_gt.p8:515 values[1]=-1 - sta p8v_values+1 - ; source: test_byte_gt.p8:517 if x>values[1] - sec - sbc p8v_x - bmi p8l_lbl1a - ; source: test_byte_gt.p8:519 goto skip1a - bra p8l_skip1a - ; source: test_byte_gt.p8:520 lbl1a: fail_byte(49) -p8l_lbl1a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:521 skip1a: -p8l_skip1a - ; source: test_byte_gt.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:524 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:526 goto skip1b - bra p8l_skip1b - ; source: test_byte_gt.p8:527 lbl1b: fail_byte(50) -p8l_lbl1b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:528 skip1b: -p8l_skip1b - ; source: test_byte_gt.p8:530 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_57_afterif - ; source: test_byte_gt.p8:531 fail_byte(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_byte -label_asm_57_afterif - ; source: test_byte_gt.p8:534 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_59_else - ; source: test_byte_gt.p8:535 fail_byte(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_byte - bra label_asm_58_afterif -label_asm_59_else - ; source: test_byte_gt.p8:537 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_byte_gt.p8:539 values[1]=0 - stz p8v_values+1 - ; source: test_byte_gt.p8:541 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bmi p8l_lbl2a - ; source: test_byte_gt.p8:543 goto skip2a - bra p8l_skip2a - ; source: test_byte_gt.p8:544 lbl2a: fail_byte(53) -p8l_lbl2a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:545 skip2a: -p8l_skip2a - ; source: test_byte_gt.p8:547 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:548 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:550 goto skip2b - bra p8l_skip2b - ; source: test_byte_gt.p8:551 lbl2b: fail_byte(54) -p8l_lbl2b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:552 skip2b: -p8l_skip2b - ; source: test_byte_gt.p8:554 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_60_afterif - ; source: test_byte_gt.p8:555 fail_byte(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_byte -label_asm_60_afterif - ; source: test_byte_gt.p8:558 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_62_else - ; source: test_byte_gt.p8:559 fail_byte(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_byte - bra label_asm_61_afterif -label_asm_62_else - ; source: test_byte_gt.p8:561 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_byte_gt.p8:563 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_gt.p8:565 if x>values[1] - sec - sbc p8v_x - bmi p8l_lbl3a - ; source: test_byte_gt.p8:567 goto skip3a - bra p8l_skip3a - ; source: test_byte_gt.p8:568 lbl3a: fail_byte(57) -p8l_lbl3a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:569 skip3a: -p8l_skip3a - ; source: test_byte_gt.p8:571 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:572 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:574 goto skip3b - bra p8l_skip3b - ; source: test_byte_gt.p8:575 lbl3b: fail_byte(58) -p8l_lbl3b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:576 skip3b: -p8l_skip3b - ; source: test_byte_gt.p8:578 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_63_afterif - ; source: test_byte_gt.p8:579 fail_byte(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_byte -label_asm_63_afterif - ; source: test_byte_gt.p8:582 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_65_else - ; source: test_byte_gt.p8:583 fail_byte(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_byte - bra label_asm_64_afterif -label_asm_65_else - ; source: test_byte_gt.p8:585 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_byte_gt.p8:587 x=0 - stz p8v_x - ; source: test_byte_gt.p8:588 values[1]=-1 - lda #-1 - sta p8v_values+1 - ; source: test_byte_gt.p8:590 if x>values[1] - sec - sbc p8v_x - bmi p8l_lbl4a - ; source: test_byte_gt.p8:592 goto skip4a - bra p8l_skip4a - ; source: test_byte_gt.p8:593 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:594 skip4a: -p8l_skip4a - ; source: test_byte_gt.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:597 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:599 goto skip4b - bra p8l_skip4b - ; source: test_byte_gt.p8:600 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:601 skip4b: -p8l_skip4b - ; source: test_byte_gt.p8:603 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_66_afterif - ; source: test_byte_gt.p8:604 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_byte_gt.p8:607 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_68_else - ; source: test_byte_gt.p8:608 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_byte_gt.p8:610 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_byte_gt.p8:612 values[1]=0 - stz p8v_values+1 - ; source: test_byte_gt.p8:614 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bmi p8l_lbl5a - ; source: test_byte_gt.p8:616 goto skip5a - bra p8l_skip5a - ; source: test_byte_gt.p8:617 lbl5a: fail_byte(61) -p8l_lbl5a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:618 skip5a: -p8l_skip5a - ; source: test_byte_gt.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:621 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:623 goto skip5b - bra p8l_skip5b - ; source: test_byte_gt.p8:624 lbl5b: fail_byte(62) -p8l_lbl5b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:625 skip5b: -p8l_skip5b - ; source: test_byte_gt.p8:627 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_69_afterif - ; source: test_byte_gt.p8:628 fail_byte(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_byte -label_asm_69_afterif - ; source: test_byte_gt.p8:631 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_71_else - ; source: test_byte_gt.p8:632 fail_byte(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_byte - bra label_asm_70_afterif -label_asm_71_else - ; source: test_byte_gt.p8:634 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_byte_gt.p8:636 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_gt.p8:638 if x>values[1] - sec - sbc p8v_x - bmi p8l_lbl6a - ; source: test_byte_gt.p8:640 goto skip6a - bra p8l_skip6a - ; source: test_byte_gt.p8:641 lbl6a: fail_byte(65) -p8l_lbl6a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:642 skip6a: -p8l_skip6a - ; source: test_byte_gt.p8:644 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:645 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:647 goto skip6b - bra p8l_skip6b - ; source: test_byte_gt.p8:648 lbl6b: fail_byte(66) -p8l_lbl6b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:649 skip6b: -p8l_skip6b - ; source: test_byte_gt.p8:651 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_72_afterif - ; source: test_byte_gt.p8:652 fail_byte(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_byte -label_asm_72_afterif - ; source: test_byte_gt.p8:655 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_74_else - ; source: test_byte_gt.p8:656 fail_byte(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_byte - bra label_asm_73_afterif -label_asm_74_else - ; source: test_byte_gt.p8:658 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_byte_gt.p8:660 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gt.p8:661 values[1]=-1 - lda #-1 - sta p8v_values+1 - ; source: test_byte_gt.p8:663 if x>values[1] - sec - sbc p8v_x - bmi p8l_lbl7a - ; source: test_byte_gt.p8:665 goto skip7a - bra p8l_skip7a - ; source: test_byte_gt.p8:666 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:667 skip7a: -p8l_skip7a - ; source: test_byte_gt.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:670 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:672 goto skip7b - bra p8l_skip7b - ; source: test_byte_gt.p8:673 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:674 skip7b: -p8l_skip7b - ; source: test_byte_gt.p8:676 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_75_afterif - ; source: test_byte_gt.p8:677 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_byte_gt.p8:680 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_77_else - ; source: test_byte_gt.p8:681 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_byte_gt.p8:683 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_byte_gt.p8:685 values[1]=0 - stz p8v_values+1 - ; source: test_byte_gt.p8:687 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bmi p8l_lbl8a - ; source: test_byte_gt.p8:689 goto skip8a - bra p8l_skip8a - ; source: test_byte_gt.p8:690 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:691 skip8a: -p8l_skip8a - ; source: test_byte_gt.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:694 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:696 goto skip8b - bra p8l_skip8b - ; source: test_byte_gt.p8:697 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:698 skip8b: -p8l_skip8b - ; source: test_byte_gt.p8:700 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_78_afterif - ; source: test_byte_gt.p8:701 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_byte_gt.p8:704 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_80_else - ; source: test_byte_gt.p8:705 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_byte_gt.p8:707 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_byte_gt.p8:709 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_gt.p8:711 if x>values[1] - sec - sbc p8v_x - bmi p8l_lbl9a - ; source: test_byte_gt.p8:713 goto skip9a - bra p8l_skip9a - ; source: test_byte_gt.p8:714 lbl9a: fail_byte(69) -p8l_lbl9a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:715 skip9a: -p8l_skip9a - ; source: test_byte_gt.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:718 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:720 goto skip9b - bra p8l_skip9b - ; source: test_byte_gt.p8:721 lbl9b: fail_byte(70) -p8l_lbl9b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:722 skip9b: -p8l_skip9b - ; source: test_byte_gt.p8:724 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_81_afterif - ; source: test_byte_gt.p8:725 fail_byte(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_byte -label_asm_81_afterif - ; source: test_byte_gt.p8:728 if x>values[1] - lda p8v_values+1 - sec - sbc p8v_x - bpl label_asm_83_else - ; source: test_byte_gt.p8:729 fail_byte(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_byte - bra label_asm_82_afterif -label_asm_83_else - ; source: test_byte_gt.p8:731 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_byte_gt.p8:733 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_gt.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS -; non-zeropage variables -p8v_values .char $00, $00 - .pend - ; source: test_byte_gt.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_byte_gt.p8:736 byte @shared x - ; source: test_byte_gt.p8:739 float @shared f4 = 1.0 - ; source: test_byte_gt.p8:740 float @shared f5 = 1.0 - ; source: test_byte_gt.p8:736 byte @shared x - stz p8v_x - ; source: test_byte_gt.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_byte_gt.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_byte_gt.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_byte_gt.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_byte_gt.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_gt.p8:742 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_gt.p8:744 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl1a - ; source: test_byte_gt.p8:746 goto skip1a - bra p8l_skip1a - ; source: test_byte_gt.p8:747 lbl1a: fail_byte(73) -p8l_lbl1a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:748 skip1a: -p8l_skip1a - ; source: test_byte_gt.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:751 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:753 goto skip1b - bra p8l_skip1b - ; source: test_byte_gt.p8:754 lbl1b: fail_byte(74) -p8l_lbl1b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:755 skip1b: -p8l_skip1b - ; source: test_byte_gt.p8:757 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_84_afterif - ; source: test_byte_gt.p8:758 fail_byte(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_byte -label_asm_84_afterif - ; source: test_byte_gt.p8:761 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_86_else - ; source: test_byte_gt.p8:762 fail_byte(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_byte - bra label_asm_85_afterif -label_asm_86_else - ; source: test_byte_gt.p8:764 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_byte_gt.p8:767 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl2a - ; source: test_byte_gt.p8:769 goto skip2a - bra p8l_skip2a - ; source: test_byte_gt.p8:770 lbl2a: fail_byte(77) -p8l_lbl2a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:771 skip2a: -p8l_skip2a - ; source: test_byte_gt.p8:773 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:774 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:776 goto skip2b - bra p8l_skip2b - ; source: test_byte_gt.p8:777 lbl2b: fail_byte(78) -p8l_lbl2b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:778 skip2b: -p8l_skip2b - ; source: test_byte_gt.p8:780 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_87_afterif - ; source: test_byte_gt.p8:781 fail_byte(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_byte -label_asm_87_afterif - ; source: test_byte_gt.p8:784 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_89_else - ; source: test_byte_gt.p8:785 fail_byte(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_byte - bra label_asm_88_afterif -label_asm_89_else - ; source: test_byte_gt.p8:787 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_byte_gt.p8:790 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl3a - ; source: test_byte_gt.p8:792 goto skip3a - bra p8l_skip3a - ; source: test_byte_gt.p8:793 lbl3a: fail_byte(81) -p8l_lbl3a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:794 skip3a: -p8l_skip3a - ; source: test_byte_gt.p8:796 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:797 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:799 goto skip3b - bra p8l_skip3b - ; source: test_byte_gt.p8:800 lbl3b: fail_byte(82) -p8l_lbl3b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:801 skip3b: -p8l_skip3b - ; source: test_byte_gt.p8:803 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_90_afterif - ; source: test_byte_gt.p8:804 fail_byte(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_byte -label_asm_90_afterif - ; source: test_byte_gt.p8:807 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_92_else - ; source: test_byte_gt.p8:808 fail_byte(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_byte - bra label_asm_91_afterif -label_asm_92_else - ; source: test_byte_gt.p8:810 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_byte_gt.p8:812 x=0 - stz p8v_x - ; source: test_byte_gt.p8:814 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl4a - ; source: test_byte_gt.p8:816 goto skip4a - bra p8l_skip4a - ; source: test_byte_gt.p8:817 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:818 skip4a: -p8l_skip4a - ; source: test_byte_gt.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:821 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:823 goto skip4b - bra p8l_skip4b - ; source: test_byte_gt.p8:824 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:825 skip4b: -p8l_skip4b - ; source: test_byte_gt.p8:827 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_93_afterif - ; source: test_byte_gt.p8:828 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_byte_gt.p8:831 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_95_else - ; source: test_byte_gt.p8:832 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_byte_gt.p8:834 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_byte_gt.p8:837 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl5a - ; source: test_byte_gt.p8:839 goto skip5a - bra p8l_skip5a - ; source: test_byte_gt.p8:840 lbl5a: fail_byte(85) -p8l_lbl5a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:841 skip5a: -p8l_skip5a - ; source: test_byte_gt.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:844 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:846 goto skip5b - bra p8l_skip5b - ; source: test_byte_gt.p8:847 lbl5b: fail_byte(86) -p8l_lbl5b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:848 skip5b: -p8l_skip5b - ; source: test_byte_gt.p8:850 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_96_afterif - ; source: test_byte_gt.p8:851 fail_byte(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_byte -label_asm_96_afterif - ; source: test_byte_gt.p8:854 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_98_else - ; source: test_byte_gt.p8:855 fail_byte(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_byte - bra label_asm_97_afterif -label_asm_98_else - ; source: test_byte_gt.p8:857 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_byte_gt.p8:860 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl6a - ; source: test_byte_gt.p8:862 goto skip6a - bra p8l_skip6a - ; source: test_byte_gt.p8:863 lbl6a: fail_byte(89) -p8l_lbl6a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:864 skip6a: -p8l_skip6a - ; source: test_byte_gt.p8:866 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:867 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:869 goto skip6b - bra p8l_skip6b - ; source: test_byte_gt.p8:870 lbl6b: fail_byte(90) -p8l_lbl6b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:871 skip6b: -p8l_skip6b - ; source: test_byte_gt.p8:873 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_99_afterif - ; source: test_byte_gt.p8:874 fail_byte(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_byte -label_asm_99_afterif - ; source: test_byte_gt.p8:877 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_101_else - ; source: test_byte_gt.p8:878 fail_byte(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_byte - bra label_asm_100_afterif -label_asm_101_else - ; source: test_byte_gt.p8:880 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_byte_gt.p8:882 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gt.p8:884 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl7a - ; source: test_byte_gt.p8:886 goto skip7a - bra p8l_skip7a - ; source: test_byte_gt.p8:887 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:888 skip7a: -p8l_skip7a - ; source: test_byte_gt.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:891 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:893 goto skip7b - bra p8l_skip7b - ; source: test_byte_gt.p8:894 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:895 skip7b: -p8l_skip7b - ; source: test_byte_gt.p8:897 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_102_afterif - ; source: test_byte_gt.p8:898 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_byte_gt.p8:901 if x>cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_104_else - ; source: test_byte_gt.p8:902 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_byte_gt.p8:904 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_byte_gt.p8:907 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl8a - ; source: test_byte_gt.p8:909 goto skip8a - bra p8l_skip8a - ; source: test_byte_gt.p8:910 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:911 skip8a: -p8l_skip8a - ; source: test_byte_gt.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:914 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:916 goto skip8b - bra p8l_skip8b - ; source: test_byte_gt.p8:917 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gt.p8:918 skip8b: -p8l_skip8b - ; source: test_byte_gt.p8:920 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_105_afterif - ; source: test_byte_gt.p8:921 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_byte_gt.p8:924 if x>cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_107_else - ; source: test_byte_gt.p8:925 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_byte_gt.p8:927 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_byte_gt.p8:930 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bmi p8l_lbl9a - ; source: test_byte_gt.p8:932 goto skip9a - bra p8l_skip9a - ; source: test_byte_gt.p8:933 lbl9a: fail_byte(93) -p8l_lbl9a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:934 skip9a: -p8l_skip9a - ; source: test_byte_gt.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gt.p8:937 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_gt.p8:939 goto skip9b - bra p8l_skip9b - ; source: test_byte_gt.p8:940 lbl9b: fail_byte(94) -p8l_lbl9b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gt.p8:941 skip9b: -p8l_skip9b - ; source: test_byte_gt.p8:943 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_108_afterif - ; source: test_byte_gt.p8:944 fail_byte(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_byte -label_asm_108_afterif - ; source: test_byte_gt.p8:947 if x>cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sec - sbc p8v_x - bpl label_asm_110_else - ; source: test_byte_gt.p8:948 fail_byte(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_byte - bra label_asm_109_afterif -label_asm_110_else - ; source: test_byte_gt.p8:950 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_byte_gt.p8:952 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_gt.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .char ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>number: " - .byte $0d, $3e, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>var: " - .byte $0d, $3e, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>expr: " - .byte $0d, $3e, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_byte_gt.p8:14 txt.print("\ngreater-than tests for: ") - ; source: test_byte_gt.p8:18 txt.print("\n>number: ") - ; source: test_byte_gt.p8:20 txt.print("\n>var: ") - ; source: test_byte_gt.p8:22 txt.print("\n>array[]: ") - ; source: test_byte_gt.p8:24 txt.print("\n>expr: ") - ; source: test_byte_gt.p8:33 txt.print(" **failed** ") - ; source: test_byte_gt.p8:35 txt.print(" success, expected ") - ; source: test_byte_gt.p8:41 txt.print(" **fail#") - ; source: test_byte_gt.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_byte_gt.p8 b/compiler/test/comparisons/test_byte_gt.p8 deleted file mode 100644 index fcd79d541..000000000 --- a/compiler/test/comparisons/test_byte_gt.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "byte" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>number: ") - test_cmp_number() - txt.print("\n>var: ") - test_cmp_var() - txt.print("\n>array[]: ") - test_cmp_array() - txt.print("\n>expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - byte @shared x - success = 0 - x=-1 - ; direct jump - if x>-1 - goto lbl1a - goto skip1a -lbl1a: fail_byte(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>-1 - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(2) -skip1b: - ; no else - if x>-1 - fail_byte(3) - - ; with else - if x>-1 - fail_byte(4) - else - success++ - - ; direct jump - if x>0 - goto lbl2a - goto skip2a -lbl2a: fail_byte(5) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>0 - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(6) -skip2b: - ; no else - if x>0 - fail_byte(7) - - ; with else - if x>0 - fail_byte(8) - else - success++ - - ; direct jump - if x>1 - goto lbl3a - goto skip3a -lbl3a: fail_byte(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>1 - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(10) -skip3b: - ; no else - if x>1 - fail_byte(11) - - ; with else - if x>1 - fail_byte(12) - else - success++ - - x=0 - ; direct jump - if x>-1 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>-1 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl5a - goto skip5a -lbl5a: fail_byte(13) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>0 - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(14) -skip5b: - ; no else - if x>0 - fail_byte(15) - - ; with else - if x>0 - fail_byte(16) - else - success++ - - ; direct jump - if x>1 - goto lbl6a - goto skip6a -lbl6a: fail_byte(17) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>1 - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(18) -skip6b: - ; no else - if x>1 - fail_byte(19) - - ; with else - if x>1 - fail_byte(20) - else - success++ - - x=1 - ; direct jump - if x>-1 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>-1 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>0 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl9a - goto skip9a -lbl9a: fail_byte(21) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>1 - goto cx16.r3 - goto skip9b -lbl9b: fail_byte(22) -skip9b: - ; no else - if x>1 - fail_byte(23) - - ; with else - if x>1 - fail_byte(24) - else - success++ - - verify_success(18) -} - sub test_cmp_var() { - byte @shared x, value - success = 0 - x=-1 - value=-1 - ; direct jump - if x>value - goto lbl1a - goto skip1a -lbl1a: fail_byte(25) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>value - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(26) -skip1b: - ; no else - if x>value - fail_byte(27) - - ; with else - if x>value - fail_byte(28) - else - success++ - - value=0 - ; direct jump - if x>value - goto lbl2a - goto skip2a -lbl2a: fail_byte(29) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>value - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(30) -skip2b: - ; no else - if x>value - fail_byte(31) - - ; with else - if x>value - fail_byte(32) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl3a - goto skip3a -lbl3a: fail_byte(33) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>value - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(34) -skip3b: - ; no else - if x>value - fail_byte(35) - - ; with else - if x>value - fail_byte(36) - else - success++ - - x=0 - value=-1 - ; direct jump - if x>value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl5a - goto skip5a -lbl5a: fail_byte(37) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>value - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(38) -skip5b: - ; no else - if x>value - fail_byte(39) - - ; with else - if x>value - fail_byte(40) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl6a - goto skip6a -lbl6a: fail_byte(41) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>value - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(42) -skip6b: - ; no else - if x>value - fail_byte(43) - - ; with else - if x>value - fail_byte(44) - else - success++ - - x=1 - value=-1 - ; direct jump - if x>value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl9a - goto skip9a -lbl9a: fail_byte(45) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>value - goto cx16.r3 - goto skip9b -lbl9b: fail_byte(46) -skip9b: - ; no else - if x>value - fail_byte(47) - - ; with else - if x>value - fail_byte(48) - else - success++ - - verify_success(18) -} - sub test_cmp_array() { - byte @shared x - byte[] values = [0, 0] - success = 0 - x=-1 - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_byte(49) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(50) -skip1b: - ; no else - if x>values[1] - fail_byte(51) - - ; with else - if x>values[1] - fail_byte(52) - else - success++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_byte(53) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(54) -skip2b: - ; no else - if x>values[1] - fail_byte(55) - - ; with else - if x>values[1] - fail_byte(56) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: fail_byte(57) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(58) -skip3b: - ; no else - if x>values[1] - fail_byte(59) - - ; with else - if x>values[1] - fail_byte(60) - else - success++ - - x=0 - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl5a - goto skip5a -lbl5a: fail_byte(61) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(62) -skip5b: - ; no else - if x>values[1] - fail_byte(63) - - ; with else - if x>values[1] - fail_byte(64) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl6a - goto skip6a -lbl6a: fail_byte(65) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(66) -skip6b: - ; no else - if x>values[1] - fail_byte(67) - - ; with else - if x>values[1] - fail_byte(68) - else - success++ - - x=1 - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl9a - goto skip9a -lbl9a: fail_byte(69) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_byte(70) -skip9b: - ; no else - if x>values[1] - fail_byte(71) - - ; with else - if x>values[1] - fail_byte(72) - else - success++ - - verify_success(18) -} - sub test_cmp_expr() { - byte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-1 - ; direct jump - if x>cx16.r4sL+-1-cx16.r5sL - goto lbl1a - goto skip1a -lbl1a: fail_byte(73) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip1b -lbl1b: fail_byte(74) -skip1b: - ; no else - if x>cx16.r4sL+-1-cx16.r5sL - fail_byte(75) - - ; with else - if x>cx16.r4sL+-1-cx16.r5sL - fail_byte(76) - else - success++ - - ; direct jump - if x>cx16.r4sL+0-cx16.r5sL - goto lbl2a - goto skip2a -lbl2a: fail_byte(77) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(78) -skip2b: - ; no else - if x>cx16.r4sL+0-cx16.r5sL - fail_byte(79) - - ; with else - if x>cx16.r4sL+0-cx16.r5sL - fail_byte(80) - else - success++ - - ; direct jump - if x>cx16.r4sL+1-cx16.r5sL - goto lbl3a - goto skip3a -lbl3a: fail_byte(81) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(82) -skip3b: - ; no else - if x>cx16.r4sL+1-cx16.r5sL - fail_byte(83) - - ; with else - if x>cx16.r4sL+1-cx16.r5sL - fail_byte(84) - else - success++ - - x=0 - ; direct jump - if x>cx16.r4sL+-1-cx16.r5sL - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>cx16.r4sL+-1-cx16.r5sL - success++ - - ; with else - if x>cx16.r4sL+-1-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4sL+0-cx16.r5sL - goto lbl5a - goto skip5a -lbl5a: fail_byte(85) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip5b -lbl5b: fail_byte(86) -skip5b: - ; no else - if x>cx16.r4sL+0-cx16.r5sL - fail_byte(87) - - ; with else - if x>cx16.r4sL+0-cx16.r5sL - fail_byte(88) - else - success++ - - ; direct jump - if x>cx16.r4sL+1-cx16.r5sL - goto lbl6a - goto skip6a -lbl6a: fail_byte(89) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(90) -skip6b: - ; no else - if x>cx16.r4sL+1-cx16.r5sL - fail_byte(91) - - ; with else - if x>cx16.r4sL+1-cx16.r5sL - fail_byte(92) - else - success++ - - x=1 - ; direct jump - if x>cx16.r4sL+-1-cx16.r5sL - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>cx16.r4sL+-1-cx16.r5sL - success++ - - ; with else - if x>cx16.r4sL+-1-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4sL+0-cx16.r5sL - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>cx16.r4sL+0-cx16.r5sL - success++ - - ; with else - if x>cx16.r4sL+0-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4sL+1-cx16.r5sL - goto lbl9a - goto skip9a -lbl9a: fail_byte(93) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip9b -lbl9b: fail_byte(94) -skip9b: - ; no else - if x>cx16.r4sL+1-cx16.r5sL - fail_byte(95) - - ; with else - if x>cx16.r4sL+1-cx16.r5sL - fail_byte(96) - else - success++ - - verify_success(18) -} - -} - diff --git a/compiler/test/comparisons/test_byte_gte.asm b/compiler/test/comparisons/test_byte_gte.asm deleted file mode 100644 index 9ee44359d..000000000 --- a/compiler/test/comparisons/test_byte_gte.asm +++ /dev/null @@ -1,9304 +0,0 @@ -; w65c02 assembly code for 'test_byte_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:41 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_byte_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"byte" - .byte $42, $59, $54, $45, $00 - - ; source: test_byte_gte.p8:9 ubyte success = 0 - ; source: test_byte_gte.p8:10 str datatype = "byte" - ; source: test_byte_gte.p8:11 uword @shared comparison - ; source: test_byte_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_byte_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=number: ") - ldy #>prog8_interned_strings.string_2 - lda #=var: ") - ldy #>prog8_interned_strings.string_3 - lda #=array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #=expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #=-1 - cmp #-1 - bpl p8l_lbl1a - ; source: test_byte_gte.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_byte_gte.p8:79 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:80 skip1a: -p8l_skip1a - ; source: test_byte_gte.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:83 if x>=-1 - lda p8v_x - cmp #-1 - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_byte_gte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:87 skip1b: -p8l_skip1b - ; source: test_byte_gte.p8:89 if x>=-1 - lda p8v_x - cmp #-1 - bmi label_asm_3_afterif - ; source: test_byte_gte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_byte_gte.p8:93 if x>=-1 - lda p8v_x - cmp #-1 - bmi label_asm_5_else - ; source: test_byte_gte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_byte_gte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_byte_gte.p8:99 if x>=0 - lda p8v_x - bpl p8l_lbl2a - ; source: test_byte_gte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_byte_gte.p8:102 lbl2a: fail_byte(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:103 skip2a: -p8l_skip2a - ; source: test_byte_gte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:106 if x>=0 - lda p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_byte_gte.p8:109 lbl2b: fail_byte(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:110 skip2b: -p8l_skip2b - ; source: test_byte_gte.p8:112 if x>=0 - lda p8v_x - bmi label_asm_6_afterif - ; source: test_byte_gte.p8:113 fail_byte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_byte -label_asm_6_afterif - ; source: test_byte_gte.p8:116 if x>=0 - lda p8v_x - bmi label_asm_8_else - ; source: test_byte_gte.p8:117 fail_byte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_byte - bra label_asm_7_afterif -label_asm_8_else - ; source: test_byte_gte.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_byte_gte.p8:122 if x>=1 - lda p8v_x - beq + - bpl p8l_lbl3a -+ - ; source: test_byte_gte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_byte_gte.p8:125 lbl3a: fail_byte(5) -p8l_lbl3a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:126 skip3a: -p8l_skip3a - ; source: test_byte_gte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:129 if x>=1 - lda p8v_x - bmi + - beq + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_byte_gte.p8:132 lbl3b: fail_byte(6) -p8l_lbl3b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:133 skip3b: -p8l_skip3b - ; source: test_byte_gte.p8:135 if x>=1 - lda p8v_x - bmi label_asm_9_afterif - beq label_asm_9_afterif - ; source: test_byte_gte.p8:136 fail_byte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_byte -label_asm_9_afterif - ; source: test_byte_gte.p8:139 if x>=1 - lda p8v_x - bmi label_asm_11_else - beq label_asm_11_else - ; source: test_byte_gte.p8:140 fail_byte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_byte - bra label_asm_10_afterif -label_asm_11_else - ; source: test_byte_gte.p8:142 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_byte_gte.p8:144 x=0 - stz p8v_x - ; source: test_byte_gte.p8:146 if x>=-1 - lda p8v_x - cmp #-1 - bpl p8l_lbl4a - ; source: test_byte_gte.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_byte_gte.p8:149 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:150 skip4a: -p8l_skip4a - ; source: test_byte_gte.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:153 if x>=-1 - lda p8v_x - cmp #-1 - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_byte_gte.p8:156 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:157 skip4b: -p8l_skip4b - ; source: test_byte_gte.p8:159 if x>=-1 - lda p8v_x - cmp #-1 - bmi label_asm_12_afterif - ; source: test_byte_gte.p8:160 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_byte_gte.p8:163 if x>=-1 - lda p8v_x - cmp #-1 - bmi label_asm_14_else - ; source: test_byte_gte.p8:164 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_byte_gte.p8:166 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_byte_gte.p8:169 if x>=0 - lda p8v_x - bpl p8l_lbl5a - ; source: test_byte_gte.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_byte_gte.p8:172 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:173 skip5a: -p8l_skip5a - ; source: test_byte_gte.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:176 if x>=0 - lda p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_byte_gte.p8:179 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:180 skip5b: -p8l_skip5b - ; source: test_byte_gte.p8:182 if x>=0 - lda p8v_x - bmi label_asm_15_afterif - ; source: test_byte_gte.p8:183 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_byte_gte.p8:186 if x>=0 - lda p8v_x - bmi label_asm_17_else - ; source: test_byte_gte.p8:187 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_byte_gte.p8:189 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_byte_gte.p8:192 if x>=1 - lda p8v_x - beq + - bpl p8l_lbl6a -+ - ; source: test_byte_gte.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_byte_gte.p8:195 lbl6a: fail_byte(9) -p8l_lbl6a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:196 skip6a: -p8l_skip6a - ; source: test_byte_gte.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:199 if x>=1 - lda p8v_x - bmi + - beq + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_byte_gte.p8:202 lbl6b: fail_byte(10) -p8l_lbl6b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:203 skip6b: -p8l_skip6b - ; source: test_byte_gte.p8:205 if x>=1 - lda p8v_x - bmi label_asm_18_afterif - beq label_asm_18_afterif - ; source: test_byte_gte.p8:206 fail_byte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_byte -label_asm_18_afterif - ; source: test_byte_gte.p8:209 if x>=1 - lda p8v_x - bmi label_asm_20_else - beq label_asm_20_else - ; source: test_byte_gte.p8:210 fail_byte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_byte - bra label_asm_19_afterif -label_asm_20_else - ; source: test_byte_gte.p8:212 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_byte_gte.p8:214 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gte.p8:216 if x>=-1 - cmp #-1 - bpl p8l_lbl7a - ; source: test_byte_gte.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_byte_gte.p8:219 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:220 skip7a: -p8l_skip7a - ; source: test_byte_gte.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:223 if x>=-1 - lda p8v_x - cmp #-1 - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_byte_gte.p8:226 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:227 skip7b: -p8l_skip7b - ; source: test_byte_gte.p8:229 if x>=-1 - lda p8v_x - cmp #-1 - bmi label_asm_21_afterif - ; source: test_byte_gte.p8:230 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_byte_gte.p8:233 if x>=-1 - lda p8v_x - cmp #-1 - bmi label_asm_23_else - ; source: test_byte_gte.p8:234 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_byte_gte.p8:236 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_byte_gte.p8:239 if x>=0 - lda p8v_x - bpl p8l_lbl8a - ; source: test_byte_gte.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_byte_gte.p8:242 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:243 skip8a: -p8l_skip8a - ; source: test_byte_gte.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:246 if x>=0 - lda p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_byte_gte.p8:249 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:250 skip8b: -p8l_skip8b - ; source: test_byte_gte.p8:252 if x>=0 - lda p8v_x - bmi label_asm_24_afterif - ; source: test_byte_gte.p8:253 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_byte_gte.p8:256 if x>=0 - lda p8v_x - bmi label_asm_26_else - ; source: test_byte_gte.p8:257 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_byte_gte.p8:259 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_byte_gte.p8:262 if x>=1 - lda p8v_x - beq + - bpl p8l_lbl9a -+ - ; source: test_byte_gte.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_byte_gte.p8:265 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:266 skip9a: -p8l_skip9a - ; source: test_byte_gte.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:269 if x>=1 - lda p8v_x - bmi + - beq + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_byte_gte.p8:272 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:273 skip9b: -p8l_skip9b - ; source: test_byte_gte.p8:275 if x>=1 - lda p8v_x - bmi label_asm_27_afterif - beq label_asm_27_afterif - ; source: test_byte_gte.p8:276 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_byte_gte.p8:279 if x>=1 - lda p8v_x - bmi label_asm_29_else - beq label_asm_29_else - ; source: test_byte_gte.p8:280 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_byte_gte.p8:282 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_byte_gte.p8:284 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_gte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_gte.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_byte_gte.p8:287 byte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_byte_gte.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_gte.p8:289 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_gte.p8:290 value=-1 - sta p8v_value - ; source: test_byte_gte.p8:292 if x>=value - cmp p8v_value - bpl p8l_lbl1a - ; source: test_byte_gte.p8:294 goto skip1a - bra p8l_skip1a - ; source: test_byte_gte.p8:295 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:296 skip1a: -p8l_skip1a - ; source: test_byte_gte.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:299 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:301 goto skip1b - bra p8l_skip1b - ; source: test_byte_gte.p8:302 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:303 skip1b: -p8l_skip1b - ; source: test_byte_gte.p8:305 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_30_afterif - ; source: test_byte_gte.p8:306 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_byte_gte.p8:309 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_32_else - ; source: test_byte_gte.p8:310 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_byte_gte.p8:312 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_byte_gte.p8:314 value=0 - stz p8v_value - ; source: test_byte_gte.p8:316 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl2a - ; source: test_byte_gte.p8:318 goto skip2a - bra p8l_skip2a - ; source: test_byte_gte.p8:319 lbl2a: fail_byte(13) -p8l_lbl2a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:320 skip2a: -p8l_skip2a - ; source: test_byte_gte.p8:322 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:323 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:325 goto skip2b - bra p8l_skip2b - ; source: test_byte_gte.p8:326 lbl2b: fail_byte(14) -p8l_lbl2b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:327 skip2b: -p8l_skip2b - ; source: test_byte_gte.p8:329 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_33_afterif - ; source: test_byte_gte.p8:330 fail_byte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_byte -label_asm_33_afterif - ; source: test_byte_gte.p8:333 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_35_else - ; source: test_byte_gte.p8:334 fail_byte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_byte - bra label_asm_34_afterif -label_asm_35_else - ; source: test_byte_gte.p8:336 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_byte_gte.p8:338 value=1 - lda #1 - sta p8v_value - ; source: test_byte_gte.p8:340 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl3a - ; source: test_byte_gte.p8:342 goto skip3a - bra p8l_skip3a - ; source: test_byte_gte.p8:343 lbl3a: fail_byte(17) -p8l_lbl3a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:344 skip3a: -p8l_skip3a - ; source: test_byte_gte.p8:346 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:347 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:349 goto skip3b - bra p8l_skip3b - ; source: test_byte_gte.p8:350 lbl3b: fail_byte(18) -p8l_lbl3b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:351 skip3b: -p8l_skip3b - ; source: test_byte_gte.p8:353 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_36_afterif - ; source: test_byte_gte.p8:354 fail_byte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_byte -label_asm_36_afterif - ; source: test_byte_gte.p8:357 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_38_else - ; source: test_byte_gte.p8:358 fail_byte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_byte - bra label_asm_37_afterif -label_asm_38_else - ; source: test_byte_gte.p8:360 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_byte_gte.p8:362 x=0 - stz p8v_x - ; source: test_byte_gte.p8:363 value=-1 - lda #-1 - sta p8v_value - ; source: test_byte_gte.p8:365 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl4a - ; source: test_byte_gte.p8:367 goto skip4a - bra p8l_skip4a - ; source: test_byte_gte.p8:368 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:369 skip4a: -p8l_skip4a - ; source: test_byte_gte.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:372 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:374 goto skip4b - bra p8l_skip4b - ; source: test_byte_gte.p8:375 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:376 skip4b: -p8l_skip4b - ; source: test_byte_gte.p8:378 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_39_afterif - ; source: test_byte_gte.p8:379 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_byte_gte.p8:382 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_41_else - ; source: test_byte_gte.p8:383 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_byte_gte.p8:385 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_byte_gte.p8:387 value=0 - stz p8v_value - ; source: test_byte_gte.p8:389 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl5a - ; source: test_byte_gte.p8:391 goto skip5a - bra p8l_skip5a - ; source: test_byte_gte.p8:392 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:393 skip5a: -p8l_skip5a - ; source: test_byte_gte.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:396 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:398 goto skip5b - bra p8l_skip5b - ; source: test_byte_gte.p8:399 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:400 skip5b: -p8l_skip5b - ; source: test_byte_gte.p8:402 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_42_afterif - ; source: test_byte_gte.p8:403 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_byte_gte.p8:406 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_44_else - ; source: test_byte_gte.p8:407 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_byte_gte.p8:409 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_byte_gte.p8:411 value=1 - lda #1 - sta p8v_value - ; source: test_byte_gte.p8:413 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl6a - ; source: test_byte_gte.p8:415 goto skip6a - bra p8l_skip6a - ; source: test_byte_gte.p8:416 lbl6a: fail_byte(21) -p8l_lbl6a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:417 skip6a: -p8l_skip6a - ; source: test_byte_gte.p8:419 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:420 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:422 goto skip6b - bra p8l_skip6b - ; source: test_byte_gte.p8:423 lbl6b: fail_byte(22) -p8l_lbl6b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:424 skip6b: -p8l_skip6b - ; source: test_byte_gte.p8:426 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_45_afterif - ; source: test_byte_gte.p8:427 fail_byte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_byte -label_asm_45_afterif - ; source: test_byte_gte.p8:430 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_47_else - ; source: test_byte_gte.p8:431 fail_byte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_byte - bra label_asm_46_afterif -label_asm_47_else - ; source: test_byte_gte.p8:433 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_byte_gte.p8:435 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gte.p8:436 value=-1 - lda #-1 - sta p8v_value - ; source: test_byte_gte.p8:438 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl7a - ; source: test_byte_gte.p8:440 goto skip7a - bra p8l_skip7a - ; source: test_byte_gte.p8:441 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:442 skip7a: -p8l_skip7a - ; source: test_byte_gte.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:445 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:447 goto skip7b - bra p8l_skip7b - ; source: test_byte_gte.p8:448 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:449 skip7b: -p8l_skip7b - ; source: test_byte_gte.p8:451 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_48_afterif - ; source: test_byte_gte.p8:452 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_byte_gte.p8:455 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_50_else - ; source: test_byte_gte.p8:456 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_byte_gte.p8:458 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_byte_gte.p8:460 value=0 - stz p8v_value - ; source: test_byte_gte.p8:462 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl8a - ; source: test_byte_gte.p8:464 goto skip8a - bra p8l_skip8a - ; source: test_byte_gte.p8:465 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:466 skip8a: -p8l_skip8a - ; source: test_byte_gte.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:469 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:471 goto skip8b - bra p8l_skip8b - ; source: test_byte_gte.p8:472 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:473 skip8b: -p8l_skip8b - ; source: test_byte_gte.p8:475 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_51_afterif - ; source: test_byte_gte.p8:476 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_byte_gte.p8:479 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_53_else - ; source: test_byte_gte.p8:480 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_byte_gte.p8:482 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_byte_gte.p8:484 value=1 - lda #1 - sta p8v_value - ; source: test_byte_gte.p8:486 if x>=value - lda p8v_x - cmp p8v_value - bpl p8l_lbl9a - ; source: test_byte_gte.p8:488 goto skip9a - bra p8l_skip9a - ; source: test_byte_gte.p8:489 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:490 skip9a: -p8l_skip9a - ; source: test_byte_gte.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:493 if x>=value - lda p8v_x - cmp p8v_value - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:495 goto skip9b - bra p8l_skip9b - ; source: test_byte_gte.p8:496 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:497 skip9b: -p8l_skip9b - ; source: test_byte_gte.p8:499 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_54_afterif - ; source: test_byte_gte.p8:500 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_byte_gte.p8:503 if x>=value - lda p8v_x - cmp p8v_value - bmi label_asm_56_else - ; source: test_byte_gte.p8:504 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_byte_gte.p8:506 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_byte_gte.p8:508 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_gte.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .char ? -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_gte.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_byte_gte.p8:511 byte @shared x - ; source: test_byte_gte.p8:512 byte[] values = [0, 0] - ; source: test_byte_gte.p8:511 byte @shared x - stz p8v_x - ; source: test_byte_gte.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_gte.p8:514 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_gte.p8:515 values[1]=-1 - sta p8v_values+1 - ; source: test_byte_gte.p8:517 if x>=values[1] - ldy #1 - cmp p8v_values,y - bpl p8l_lbl1a - ; source: test_byte_gte.p8:519 goto skip1a - bra p8l_skip1a - ; source: test_byte_gte.p8:520 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:521 skip1a: -p8l_skip1a - ; source: test_byte_gte.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:524 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:526 goto skip1b - bra p8l_skip1b - ; source: test_byte_gte.p8:527 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:528 skip1b: -p8l_skip1b - ; source: test_byte_gte.p8:530 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_57_afterif - ; source: test_byte_gte.p8:531 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_byte_gte.p8:534 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_59_else - ; source: test_byte_gte.p8:535 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_byte_gte.p8:537 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_byte_gte.p8:539 values[1]=0 - stz p8v_values+1 - ; source: test_byte_gte.p8:541 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl2a - ; source: test_byte_gte.p8:543 goto skip2a - bra p8l_skip2a - ; source: test_byte_gte.p8:544 lbl2a: fail_byte(25) -p8l_lbl2a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:545 skip2a: -p8l_skip2a - ; source: test_byte_gte.p8:547 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:548 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:550 goto skip2b - bra p8l_skip2b - ; source: test_byte_gte.p8:551 lbl2b: fail_byte(26) -p8l_lbl2b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:552 skip2b: -p8l_skip2b - ; source: test_byte_gte.p8:554 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_60_afterif - ; source: test_byte_gte.p8:555 fail_byte(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_byte -label_asm_60_afterif - ; source: test_byte_gte.p8:558 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_62_else - ; source: test_byte_gte.p8:559 fail_byte(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_byte - bra label_asm_61_afterif -label_asm_62_else - ; source: test_byte_gte.p8:561 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_byte_gte.p8:563 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_gte.p8:565 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl3a - ; source: test_byte_gte.p8:567 goto skip3a - bra p8l_skip3a - ; source: test_byte_gte.p8:568 lbl3a: fail_byte(29) -p8l_lbl3a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:569 skip3a: -p8l_skip3a - ; source: test_byte_gte.p8:571 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:572 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:574 goto skip3b - bra p8l_skip3b - ; source: test_byte_gte.p8:575 lbl3b: fail_byte(30) -p8l_lbl3b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:576 skip3b: -p8l_skip3b - ; source: test_byte_gte.p8:578 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_63_afterif - ; source: test_byte_gte.p8:579 fail_byte(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_byte -label_asm_63_afterif - ; source: test_byte_gte.p8:582 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_65_else - ; source: test_byte_gte.p8:583 fail_byte(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_byte - bra label_asm_64_afterif -label_asm_65_else - ; source: test_byte_gte.p8:585 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_byte_gte.p8:587 x=0 - stz p8v_x - ; source: test_byte_gte.p8:588 values[1]=-1 - lda #-1 - sta p8v_values+1 - ; source: test_byte_gte.p8:590 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl4a - ; source: test_byte_gte.p8:592 goto skip4a - bra p8l_skip4a - ; source: test_byte_gte.p8:593 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:594 skip4a: -p8l_skip4a - ; source: test_byte_gte.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:597 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:599 goto skip4b - bra p8l_skip4b - ; source: test_byte_gte.p8:600 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:601 skip4b: -p8l_skip4b - ; source: test_byte_gte.p8:603 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_66_afterif - ; source: test_byte_gte.p8:604 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_byte_gte.p8:607 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_68_else - ; source: test_byte_gte.p8:608 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_byte_gte.p8:610 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_byte_gte.p8:612 values[1]=0 - stz p8v_values+1 - ; source: test_byte_gte.p8:614 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl5a - ; source: test_byte_gte.p8:616 goto skip5a - bra p8l_skip5a - ; source: test_byte_gte.p8:617 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:618 skip5a: -p8l_skip5a - ; source: test_byte_gte.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:621 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:623 goto skip5b - bra p8l_skip5b - ; source: test_byte_gte.p8:624 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:625 skip5b: -p8l_skip5b - ; source: test_byte_gte.p8:627 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_69_afterif - ; source: test_byte_gte.p8:628 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_byte_gte.p8:631 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_71_else - ; source: test_byte_gte.p8:632 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_byte_gte.p8:634 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_byte_gte.p8:636 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_gte.p8:638 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl6a - ; source: test_byte_gte.p8:640 goto skip6a - bra p8l_skip6a - ; source: test_byte_gte.p8:641 lbl6a: fail_byte(33) -p8l_lbl6a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:642 skip6a: -p8l_skip6a - ; source: test_byte_gte.p8:644 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:645 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:647 goto skip6b - bra p8l_skip6b - ; source: test_byte_gte.p8:648 lbl6b: fail_byte(34) -p8l_lbl6b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:649 skip6b: -p8l_skip6b - ; source: test_byte_gte.p8:651 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_72_afterif - ; source: test_byte_gte.p8:652 fail_byte(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_byte -label_asm_72_afterif - ; source: test_byte_gte.p8:655 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_74_else - ; source: test_byte_gte.p8:656 fail_byte(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_byte - bra label_asm_73_afterif -label_asm_74_else - ; source: test_byte_gte.p8:658 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_byte_gte.p8:660 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gte.p8:661 values[1]=-1 - lda #-1 - sta p8v_values+1 - ; source: test_byte_gte.p8:663 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl7a - ; source: test_byte_gte.p8:665 goto skip7a - bra p8l_skip7a - ; source: test_byte_gte.p8:666 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:667 skip7a: -p8l_skip7a - ; source: test_byte_gte.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:670 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:672 goto skip7b - bra p8l_skip7b - ; source: test_byte_gte.p8:673 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:674 skip7b: -p8l_skip7b - ; source: test_byte_gte.p8:676 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_75_afterif - ; source: test_byte_gte.p8:677 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_byte_gte.p8:680 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_77_else - ; source: test_byte_gte.p8:681 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_byte_gte.p8:683 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_byte_gte.p8:685 values[1]=0 - stz p8v_values+1 - ; source: test_byte_gte.p8:687 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl8a - ; source: test_byte_gte.p8:689 goto skip8a - bra p8l_skip8a - ; source: test_byte_gte.p8:690 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:691 skip8a: -p8l_skip8a - ; source: test_byte_gte.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:694 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:696 goto skip8b - bra p8l_skip8b - ; source: test_byte_gte.p8:697 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:698 skip8b: -p8l_skip8b - ; source: test_byte_gte.p8:700 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_78_afterif - ; source: test_byte_gte.p8:701 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_byte_gte.p8:704 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_80_else - ; source: test_byte_gte.p8:705 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_byte_gte.p8:707 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_byte_gte.p8:709 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_gte.p8:711 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bpl p8l_lbl9a - ; source: test_byte_gte.p8:713 goto skip9a - bra p8l_skip9a - ; source: test_byte_gte.p8:714 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:715 skip9a: -p8l_skip9a - ; source: test_byte_gte.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:718 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:720 goto skip9b - bra p8l_skip9b - ; source: test_byte_gte.p8:721 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:722 skip9b: -p8l_skip9b - ; source: test_byte_gte.p8:724 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_81_afterif - ; source: test_byte_gte.p8:725 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_byte_gte.p8:728 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bmi label_asm_83_else - ; source: test_byte_gte.p8:729 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_byte_gte.p8:731 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_byte_gte.p8:733 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_gte.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS -; non-zeropage variables -p8v_values .char $00, $00 - .pend - ; source: test_byte_gte.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_byte_gte.p8:736 byte @shared x - ; source: test_byte_gte.p8:739 float @shared f4 = 1.0 - ; source: test_byte_gte.p8:740 float @shared f5 = 1.0 - ; source: test_byte_gte.p8:736 byte @shared x - stz p8v_x - ; source: test_byte_gte.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_byte_gte.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_byte_gte.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_byte_gte.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_byte_gte.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_gte.p8:742 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_gte.p8:744 if x>=cx16.r4sL+-1-cx16.r5sL - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl1a - ; source: test_byte_gte.p8:746 goto skip1a - bra p8l_skip1a - ; source: test_byte_gte.p8:747 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:748 skip1a: -p8l_skip1a - ; source: test_byte_gte.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:751 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:753 goto skip1b - bra p8l_skip1b - ; source: test_byte_gte.p8:754 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:755 skip1b: -p8l_skip1b - ; source: test_byte_gte.p8:757 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_84_afterif - ; source: test_byte_gte.p8:758 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_byte_gte.p8:761 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_86_else - ; source: test_byte_gte.p8:762 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_byte_gte.p8:764 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_byte_gte.p8:767 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl2a - ; source: test_byte_gte.p8:769 goto skip2a - bra p8l_skip2a - ; source: test_byte_gte.p8:770 lbl2a: fail_byte(37) -p8l_lbl2a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:771 skip2a: -p8l_skip2a - ; source: test_byte_gte.p8:773 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:774 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:776 goto skip2b - bra p8l_skip2b - ; source: test_byte_gte.p8:777 lbl2b: fail_byte(38) -p8l_lbl2b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:778 skip2b: -p8l_skip2b - ; source: test_byte_gte.p8:780 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_87_afterif - ; source: test_byte_gte.p8:781 fail_byte(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_byte -label_asm_87_afterif - ; source: test_byte_gte.p8:784 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_89_else - ; source: test_byte_gte.p8:785 fail_byte(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_byte - bra label_asm_88_afterif -label_asm_89_else - ; source: test_byte_gte.p8:787 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_byte_gte.p8:790 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl3a - ; source: test_byte_gte.p8:792 goto skip3a - bra p8l_skip3a - ; source: test_byte_gte.p8:793 lbl3a: fail_byte(41) -p8l_lbl3a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:794 skip3a: -p8l_skip3a - ; source: test_byte_gte.p8:796 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:797 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:799 goto skip3b - bra p8l_skip3b - ; source: test_byte_gte.p8:800 lbl3b: fail_byte(42) -p8l_lbl3b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:801 skip3b: -p8l_skip3b - ; source: test_byte_gte.p8:803 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_90_afterif - ; source: test_byte_gte.p8:804 fail_byte(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_byte -label_asm_90_afterif - ; source: test_byte_gte.p8:807 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_92_else - ; source: test_byte_gte.p8:808 fail_byte(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_byte - bra label_asm_91_afterif -label_asm_92_else - ; source: test_byte_gte.p8:810 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_byte_gte.p8:812 x=0 - stz p8v_x - ; source: test_byte_gte.p8:814 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl4a - ; source: test_byte_gte.p8:816 goto skip4a - bra p8l_skip4a - ; source: test_byte_gte.p8:817 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:818 skip4a: -p8l_skip4a - ; source: test_byte_gte.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:821 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:823 goto skip4b - bra p8l_skip4b - ; source: test_byte_gte.p8:824 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:825 skip4b: -p8l_skip4b - ; source: test_byte_gte.p8:827 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_93_afterif - ; source: test_byte_gte.p8:828 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_byte_gte.p8:831 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_95_else - ; source: test_byte_gte.p8:832 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_byte_gte.p8:834 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_byte_gte.p8:837 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl5a - ; source: test_byte_gte.p8:839 goto skip5a - bra p8l_skip5a - ; source: test_byte_gte.p8:840 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:841 skip5a: -p8l_skip5a - ; source: test_byte_gte.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:844 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:846 goto skip5b - bra p8l_skip5b - ; source: test_byte_gte.p8:847 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:848 skip5b: -p8l_skip5b - ; source: test_byte_gte.p8:850 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_96_afterif - ; source: test_byte_gte.p8:851 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_byte_gte.p8:854 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_98_else - ; source: test_byte_gte.p8:855 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_byte_gte.p8:857 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_byte_gte.p8:860 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl6a - ; source: test_byte_gte.p8:862 goto skip6a - bra p8l_skip6a - ; source: test_byte_gte.p8:863 lbl6a: fail_byte(45) -p8l_lbl6a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:864 skip6a: -p8l_skip6a - ; source: test_byte_gte.p8:866 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:867 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:869 goto skip6b - bra p8l_skip6b - ; source: test_byte_gte.p8:870 lbl6b: fail_byte(46) -p8l_lbl6b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_gte.p8:871 skip6b: -p8l_skip6b - ; source: test_byte_gte.p8:873 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_99_afterif - ; source: test_byte_gte.p8:874 fail_byte(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_byte -label_asm_99_afterif - ; source: test_byte_gte.p8:877 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_101_else - ; source: test_byte_gte.p8:878 fail_byte(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_byte - bra label_asm_100_afterif -label_asm_101_else - ; source: test_byte_gte.p8:880 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_byte_gte.p8:882 x=1 - lda #1 - sta p8v_x - ; source: test_byte_gte.p8:884 if x>=cx16.r4sL+-1-cx16.r5sL - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl7a - ; source: test_byte_gte.p8:886 goto skip7a - bra p8l_skip7a - ; source: test_byte_gte.p8:887 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:888 skip7a: -p8l_skip7a - ; source: test_byte_gte.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:891 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:893 goto skip7b - bra p8l_skip7b - ; source: test_byte_gte.p8:894 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:895 skip7b: -p8l_skip7b - ; source: test_byte_gte.p8:897 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_102_afterif - ; source: test_byte_gte.p8:898 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_byte_gte.p8:901 if x>=cx16.r4sL+-1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_104_else - ; source: test_byte_gte.p8:902 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_byte_gte.p8:904 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_byte_gte.p8:907 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl8a - ; source: test_byte_gte.p8:909 goto skip8a - bra p8l_skip8a - ; source: test_byte_gte.p8:910 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:911 skip8a: -p8l_skip8a - ; source: test_byte_gte.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:914 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:916 goto skip8b - bra p8l_skip8b - ; source: test_byte_gte.p8:917 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:918 skip8b: -p8l_skip8b - ; source: test_byte_gte.p8:920 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_105_afterif - ; source: test_byte_gte.p8:921 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_byte_gte.p8:924 if x>=cx16.r4sL+0-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_107_else - ; source: test_byte_gte.p8:925 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_byte_gte.p8:927 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_byte_gte.p8:930 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bpl p8l_lbl9a - ; source: test_byte_gte.p8:932 goto skip9a - bra p8l_skip9a - ; source: test_byte_gte.p8:933 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:934 skip9a: -p8l_skip9a - ; source: test_byte_gte.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_gte.p8:937 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_gte.p8:939 goto skip9b - bra p8l_skip9b - ; source: test_byte_gte.p8:940 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_gte.p8:941 skip9b: -p8l_skip9b - ; source: test_byte_gte.p8:943 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_108_afterif - ; source: test_byte_gte.p8:944 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_byte_gte.p8:947 if x>=cx16.r4sL+1-cx16.r5sL - lda p8v_x - pha - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bmi label_asm_110_else - ; source: test_byte_gte.p8:948 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_byte_gte.p8:950 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_byte_gte.p8:952 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_gte.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .char ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $54 - .byte $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>=number: " - .byte $0d, $3e, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>=var: " - .byte $0d, $3e, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>=expr: " - .byte $0d, $3e, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_byte_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ; source: test_byte_gte.p8:18 txt.print("\n>=number: ") - ; source: test_byte_gte.p8:20 txt.print("\n>=var: ") - ; source: test_byte_gte.p8:22 txt.print("\n>=array[]: ") - ; source: test_byte_gte.p8:24 txt.print("\n>=expr: ") - ; source: test_byte_gte.p8:33 txt.print(" **failed** ") - ; source: test_byte_gte.p8:35 txt.print(" success, expected ") - ; source: test_byte_gte.p8:41 txt.print(" **fail#") - ; source: test_byte_gte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_byte_gte.p8 b/compiler/test/comparisons/test_byte_gte.p8 deleted file mode 100644 index a73271d0b..000000000 --- a/compiler/test/comparisons/test_byte_gte.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "byte" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=number: ") - test_cmp_number() - txt.print("\n>=var: ") - test_cmp_var() - txt.print("\n>=array[]: ") - test_cmp_array() - txt.print("\n>=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - byte @shared x - success = 0 - x=-1 - ; direct jump - if x>=-1 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=-1 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl2a - goto skip2a -lbl2a: fail_byte(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=0 - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(2) -skip2b: - ; no else - if x>=0 - fail_byte(3) - - ; with else - if x>=0 - fail_byte(4) - else - success++ - - ; direct jump - if x>=1 - goto lbl3a - goto skip3a -lbl3a: fail_byte(5) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=1 - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(6) -skip3b: - ; no else - if x>=1 - fail_byte(7) - - ; with else - if x>=1 - fail_byte(8) - else - success++ - - x=0 - ; direct jump - if x>=-1 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=-1 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=0 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl6a - goto skip6a -lbl6a: fail_byte(9) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=1 - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(10) -skip6b: - ; no else - if x>=1 - fail_byte(11) - - ; with else - if x>=1 - fail_byte(12) - else - success++ - - x=1 - ; direct jump - if x>=-1 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=-1 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=0 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=1 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_var() { - byte @shared x, value - success = 0 - x=-1 - value=-1 - ; direct jump - if x>=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl2a - goto skip2a -lbl2a: fail_byte(13) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=value - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(14) -skip2b: - ; no else - if x>=value - fail_byte(15) - - ; with else - if x>=value - fail_byte(16) - else - success++ - - value=1 - ; direct jump - if x>=value - goto lbl3a - goto skip3a -lbl3a: fail_byte(17) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=value - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(18) -skip3b: - ; no else - if x>=value - fail_byte(19) - - ; with else - if x>=value - fail_byte(20) - else - success++ - - x=0 - value=-1 - ; direct jump - if x>=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl6a - goto skip6a -lbl6a: fail_byte(21) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=value - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(22) -skip6b: - ; no else - if x>=value - fail_byte(23) - - ; with else - if x>=value - fail_byte(24) - else - success++ - - x=1 - value=-1 - ; direct jump - if x>=value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_array() { - byte @shared x - byte[] values = [0, 0] - success = 0 - x=-1 - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_byte(25) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(26) -skip2b: - ; no else - if x>=values[1] - fail_byte(27) - - ; with else - if x>=values[1] - fail_byte(28) - else - success++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_byte(29) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(30) -skip3b: - ; no else - if x>=values[1] - fail_byte(31) - - ; with else - if x>=values[1] - fail_byte(32) - else - success++ - - x=0 - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl6a - goto skip6a -lbl6a: fail_byte(33) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(34) -skip6b: - ; no else - if x>=values[1] - fail_byte(35) - - ; with else - if x>=values[1] - fail_byte(36) - else - success++ - - x=1 - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_expr() { - byte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-1 - ; direct jump - if x>=cx16.r4sL+-1-cx16.r5sL - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=cx16.r4sL+-1-cx16.r5sL - success++ - - ; with else - if x>=cx16.r4sL+-1-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4sL+0-cx16.r5sL - goto lbl2a - goto skip2a -lbl2a: fail_byte(37) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip2b -lbl2b: fail_byte(38) -skip2b: - ; no else - if x>=cx16.r4sL+0-cx16.r5sL - fail_byte(39) - - ; with else - if x>=cx16.r4sL+0-cx16.r5sL - fail_byte(40) - else - success++ - - ; direct jump - if x>=cx16.r4sL+1-cx16.r5sL - goto lbl3a - goto skip3a -lbl3a: fail_byte(41) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip3b -lbl3b: fail_byte(42) -skip3b: - ; no else - if x>=cx16.r4sL+1-cx16.r5sL - fail_byte(43) - - ; with else - if x>=cx16.r4sL+1-cx16.r5sL - fail_byte(44) - else - success++ - - x=0 - ; direct jump - if x>=cx16.r4sL+-1-cx16.r5sL - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=cx16.r4sL+-1-cx16.r5sL - success++ - - ; with else - if x>=cx16.r4sL+-1-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4sL+0-cx16.r5sL - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=cx16.r4sL+0-cx16.r5sL - success++ - - ; with else - if x>=cx16.r4sL+0-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4sL+1-cx16.r5sL - goto lbl6a - goto skip6a -lbl6a: fail_byte(45) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip6b -lbl6b: fail_byte(46) -skip6b: - ; no else - if x>=cx16.r4sL+1-cx16.r5sL - fail_byte(47) - - ; with else - if x>=cx16.r4sL+1-cx16.r5sL - fail_byte(48) - else - success++ - - x=1 - ; direct jump - if x>=cx16.r4sL+-1-cx16.r5sL - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=cx16.r4sL+-1-cx16.r5sL - success++ - - ; with else - if x>=cx16.r4sL+-1-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4sL+0-cx16.r5sL - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=cx16.r4sL+0-cx16.r5sL - success++ - - ; with else - if x>=cx16.r4sL+0-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4sL+1-cx16.r5sL - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=cx16.r4sL+1-cx16.r5sL - success++ - - ; with else - if x>=cx16.r4sL+1-cx16.r5sL - success++ - else - cx16.r0L++ - - verify_success(27) -} - -} - diff --git a/compiler/test/comparisons/test_byte_lt.asm b/compiler/test/comparisons/test_byte_lt.asm deleted file mode 100644 index 9227d9324..000000000 --- a/compiler/test/comparisons/test_byte_lt.asm +++ /dev/null @@ -1,9403 +0,0 @@ -; w65c02 assembly code for 'test_byte_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_byte_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"byte" - .byte $42, $59, $54, $45, $00 - - ; source: test_byte_lt.p8:9 ubyte success = 0 - ; source: test_byte_lt.p8:10 str datatype = "byte" - ; source: test_byte_lt.p8:11 uword @shared comparison - ; source: test_byte_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_byte_lt.p8:14 txt.print("\nless-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #1 - lda #<1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:80 skip1a: -p8l_skip1a - ; source: test_byte_lt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:83 if x<-1 - lda p8v_x - cmp #-1 - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_byte_lt.p8:86 lbl1b: fail_byte(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:87 skip1b: -p8l_skip1b - ; source: test_byte_lt.p8:89 if x<-1 - lda p8v_x - cmp #-1 - bpl label_asm_3_afterif - ; source: test_byte_lt.p8:90 fail_byte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_byte -label_asm_3_afterif - ; source: test_byte_lt.p8:93 if x<-1 - lda p8v_x - cmp #-1 - bpl label_asm_5_else - ; source: test_byte_lt.p8:94 fail_byte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_byte - bra label_asm_4_afterif -label_asm_5_else - ; source: test_byte_lt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_byte_lt.p8:99 if x<0 - lda p8v_x - bmi p8l_lbl2a - ; source: test_byte_lt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_byte_lt.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_lt.p8:103 skip2a: -p8l_skip2a - ; source: test_byte_lt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:106 if x<0 - lda p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_byte_lt.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_lt.p8:110 skip2b: -p8l_skip2b - ; source: test_byte_lt.p8:112 if x<0 - lda p8v_x - bpl label_asm_6_afterif - ; source: test_byte_lt.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_byte_lt.p8:116 if x<0 - lda p8v_x - bpl label_asm_8_else - ; source: test_byte_lt.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_byte_lt.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_byte_lt.p8:122 if x<1 - lda p8v_x - bmi p8l_lbl3a - beq p8l_lbl3a - ; source: test_byte_lt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_byte_lt.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_lt.p8:126 skip3a: -p8l_skip3a - ; source: test_byte_lt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:129 if x<1 - lda p8v_x - bmi + - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_byte_lt.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_lt.p8:133 skip3b: -p8l_skip3b - ; source: test_byte_lt.p8:135 if x<1 - lda p8v_x - beq + - bpl label_asm_9_afterif -+ - ; source: test_byte_lt.p8:136 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_byte_lt.p8:139 if x<1 - lda p8v_x - beq + - bpl label_asm_11_else -+ - ; source: test_byte_lt.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_byte_lt.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_byte_lt.p8:144 x=0 - stz p8v_x - ; source: test_byte_lt.p8:146 if x<-1 - lda p8v_x - cmp #-1 - bmi p8l_lbl4a - ; source: test_byte_lt.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_byte_lt.p8:149 lbl4a: fail_byte(5) -p8l_lbl4a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:150 skip4a: -p8l_skip4a - ; source: test_byte_lt.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:153 if x<-1 - lda p8v_x - cmp #-1 - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_byte_lt.p8:156 lbl4b: fail_byte(6) -p8l_lbl4b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:157 skip4b: -p8l_skip4b - ; source: test_byte_lt.p8:159 if x<-1 - lda p8v_x - cmp #-1 - bpl label_asm_12_afterif - ; source: test_byte_lt.p8:160 fail_byte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_byte -label_asm_12_afterif - ; source: test_byte_lt.p8:163 if x<-1 - lda p8v_x - cmp #-1 - bpl label_asm_14_else - ; source: test_byte_lt.p8:164 fail_byte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_byte - bra label_asm_13_afterif -label_asm_14_else - ; source: test_byte_lt.p8:166 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_byte_lt.p8:169 if x<0 - lda p8v_x - bmi p8l_lbl5a - ; source: test_byte_lt.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_byte_lt.p8:172 lbl5a: fail_byte(9) -p8l_lbl5a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:173 skip5a: -p8l_skip5a - ; source: test_byte_lt.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:176 if x<0 - lda p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_byte_lt.p8:179 lbl5b: fail_byte(10) -p8l_lbl5b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:180 skip5b: -p8l_skip5b - ; source: test_byte_lt.p8:182 if x<0 - lda p8v_x - bpl label_asm_15_afterif - ; source: test_byte_lt.p8:183 fail_byte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_byte -label_asm_15_afterif - ; source: test_byte_lt.p8:186 if x<0 - lda p8v_x - bpl label_asm_17_else - ; source: test_byte_lt.p8:187 fail_byte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_byte - bra label_asm_16_afterif -label_asm_17_else - ; source: test_byte_lt.p8:189 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_byte_lt.p8:192 if x<1 - lda p8v_x - bmi p8l_lbl6a - beq p8l_lbl6a - ; source: test_byte_lt.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_byte_lt.p8:195 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_lt.p8:196 skip6a: -p8l_skip6a - ; source: test_byte_lt.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:199 if x<1 - lda p8v_x - bmi + - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_byte_lt.p8:202 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_lt.p8:203 skip6b: -p8l_skip6b - ; source: test_byte_lt.p8:205 if x<1 - lda p8v_x - beq + - bpl label_asm_18_afterif -+ - ; source: test_byte_lt.p8:206 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_byte_lt.p8:209 if x<1 - lda p8v_x - beq + - bpl label_asm_20_else -+ - ; source: test_byte_lt.p8:210 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_byte_lt.p8:212 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_byte_lt.p8:214 x=1 - lda #1 - sta p8v_x - ; source: test_byte_lt.p8:216 if x<-1 - cmp #-1 - bmi p8l_lbl7a - ; source: test_byte_lt.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_byte_lt.p8:219 lbl7a: fail_byte(13) -p8l_lbl7a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:220 skip7a: -p8l_skip7a - ; source: test_byte_lt.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:223 if x<-1 - lda p8v_x - cmp #-1 - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_byte_lt.p8:226 lbl7b: fail_byte(14) -p8l_lbl7b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:227 skip7b: -p8l_skip7b - ; source: test_byte_lt.p8:229 if x<-1 - lda p8v_x - cmp #-1 - bpl label_asm_21_afterif - ; source: test_byte_lt.p8:230 fail_byte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_byte -label_asm_21_afterif - ; source: test_byte_lt.p8:233 if x<-1 - lda p8v_x - cmp #-1 - bpl label_asm_23_else - ; source: test_byte_lt.p8:234 fail_byte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_byte - bra label_asm_22_afterif -label_asm_23_else - ; source: test_byte_lt.p8:236 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_byte_lt.p8:239 if x<0 - lda p8v_x - bmi p8l_lbl8a - ; source: test_byte_lt.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_byte_lt.p8:242 lbl8a: fail_byte(17) -p8l_lbl8a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:243 skip8a: -p8l_skip8a - ; source: test_byte_lt.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:246 if x<0 - lda p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_byte_lt.p8:249 lbl8b: fail_byte(18) -p8l_lbl8b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:250 skip8b: -p8l_skip8b - ; source: test_byte_lt.p8:252 if x<0 - lda p8v_x - bpl label_asm_24_afterif - ; source: test_byte_lt.p8:253 fail_byte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_byte -label_asm_24_afterif - ; source: test_byte_lt.p8:256 if x<0 - lda p8v_x - bpl label_asm_26_else - ; source: test_byte_lt.p8:257 fail_byte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_byte - bra label_asm_25_afterif -label_asm_26_else - ; source: test_byte_lt.p8:259 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_byte_lt.p8:262 if x<1 - lda p8v_x - bmi p8l_lbl9a - beq p8l_lbl9a - ; source: test_byte_lt.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_byte_lt.p8:265 lbl9a: fail_byte(21) -p8l_lbl9a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:266 skip9a: -p8l_skip9a - ; source: test_byte_lt.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:269 if x<1 - lda p8v_x - bmi + - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_byte_lt.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_byte_lt.p8:272 lbl9b: fail_byte(22) -p8l_lbl9b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:273 skip9b: -p8l_skip9b - ; source: test_byte_lt.p8:275 if x<1 - lda p8v_x - beq + - bpl label_asm_27_afterif -+ - ; source: test_byte_lt.p8:276 fail_byte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_byte -label_asm_27_afterif - ; source: test_byte_lt.p8:279 if x<1 - lda p8v_x - beq + - bpl label_asm_29_else -+ - ; source: test_byte_lt.p8:280 fail_byte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_byte - bra label_asm_28_afterif -label_asm_29_else - ; source: test_byte_lt.p8:282 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_byte_lt.p8:284 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_lt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_lt.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_byte_lt.p8:287 byte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_byte_lt.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_lt.p8:289 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_lt.p8:290 value=-1 - sta p8v_value - ; source: test_byte_lt.p8:292 if x$19 - lda #<$19 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:296 skip1a: -p8l_skip1a - ; source: test_byte_lt.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:299 if x$1a - lda #<$1a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:303 skip1b: -p8l_skip1b - ; source: test_byte_lt.p8:305 if x$1b - lda #<$1b - jsr p8b_main.p8s_fail_byte -label_asm_30_afterif - ; source: test_byte_lt.p8:309 if x$1c - lda #<$1c - jsr p8b_main.p8s_fail_byte - bra label_asm_31_afterif -label_asm_32_else - ; source: test_byte_lt.p8:312 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_byte_lt.p8:314 value=0 - stz p8v_value - ; source: test_byte_lt.p8:316 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:323 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:347 if x$1d - lda #<$1d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:369 skip4a: -p8l_skip4a - ; source: test_byte_lt.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:372 if x$1e - lda #<$1e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:376 skip4b: -p8l_skip4b - ; source: test_byte_lt.p8:378 if x$1f - lda #<$1f - jsr p8b_main.p8s_fail_byte -label_asm_39_afterif - ; source: test_byte_lt.p8:382 if x$20 - lda #<$20 - jsr p8b_main.p8s_fail_byte - bra label_asm_40_afterif -label_asm_41_else - ; source: test_byte_lt.p8:385 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_byte_lt.p8:387 value=0 - stz p8v_value - ; source: test_byte_lt.p8:389 if x$21 - lda #<$21 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:393 skip5a: -p8l_skip5a - ; source: test_byte_lt.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:396 if x$22 - lda #<$22 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:400 skip5b: -p8l_skip5b - ; source: test_byte_lt.p8:402 if x$23 - lda #<$23 - jsr p8b_main.p8s_fail_byte -label_asm_42_afterif - ; source: test_byte_lt.p8:406 if x$24 - lda #<$24 - jsr p8b_main.p8s_fail_byte - bra label_asm_43_afterif -label_asm_44_else - ; source: test_byte_lt.p8:409 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_byte_lt.p8:411 value=1 - lda #1 - sta p8v_value - ; source: test_byte_lt.p8:413 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:420 if x$25 - lda #<$25 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:442 skip7a: -p8l_skip7a - ; source: test_byte_lt.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:445 if x$26 - lda #<$26 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:449 skip7b: -p8l_skip7b - ; source: test_byte_lt.p8:451 if x$27 - lda #<$27 - jsr p8b_main.p8s_fail_byte -label_asm_48_afterif - ; source: test_byte_lt.p8:455 if x$28 - lda #<$28 - jsr p8b_main.p8s_fail_byte - bra label_asm_49_afterif -label_asm_50_else - ; source: test_byte_lt.p8:458 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_byte_lt.p8:460 value=0 - stz p8v_value - ; source: test_byte_lt.p8:462 if x$29 - lda #<$29 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:466 skip8a: -p8l_skip8a - ; source: test_byte_lt.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:469 if x$2a - lda #<$2a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:473 skip8b: -p8l_skip8b - ; source: test_byte_lt.p8:475 if x$2b - lda #<$2b - jsr p8b_main.p8s_fail_byte -label_asm_51_afterif - ; source: test_byte_lt.p8:479 if x$2c - lda #<$2c - jsr p8b_main.p8s_fail_byte - bra label_asm_52_afterif -label_asm_53_else - ; source: test_byte_lt.p8:482 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_byte_lt.p8:484 value=1 - lda #1 - sta p8v_value - ; source: test_byte_lt.p8:486 if x$2d - lda #<$2d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:490 skip9a: -p8l_skip9a - ; source: test_byte_lt.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:493 if x$2e - lda #<$2e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:497 skip9b: -p8l_skip9b - ; source: test_byte_lt.p8:499 if x$2f - lda #<$2f - jsr p8b_main.p8s_fail_byte -label_asm_54_afterif - ; source: test_byte_lt.p8:503 if x$30 - lda #<$30 - jsr p8b_main.p8s_fail_byte - bra label_asm_55_afterif -label_asm_56_else - ; source: test_byte_lt.p8:506 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_byte_lt.p8:508 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_lt.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .char ? -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_lt.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_byte_lt.p8:511 byte @shared x - ; source: test_byte_lt.p8:512 byte[] values = [0, 0] - ; source: test_byte_lt.p8:511 byte @shared x - stz p8v_x - ; source: test_byte_lt.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_lt.p8:514 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_lt.p8:515 values[1]=-1 - sta p8v_values+1 - ; source: test_byte_lt.p8:517 if x$31 - lda #<$31 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:521 skip1a: -p8l_skip1a - ; source: test_byte_lt.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:524 if x$32 - lda #<$32 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:528 skip1b: -p8l_skip1b - ; source: test_byte_lt.p8:530 if x$33 - lda #<$33 - jsr p8b_main.p8s_fail_byte -label_asm_57_afterif - ; source: test_byte_lt.p8:534 if x$34 - lda #<$34 - jsr p8b_main.p8s_fail_byte - bra label_asm_58_afterif -label_asm_59_else - ; source: test_byte_lt.p8:537 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_byte_lt.p8:539 values[1]=0 - stz p8v_values+1 - ; source: test_byte_lt.p8:541 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:548 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:572 if x$35 - lda #<$35 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:594 skip4a: -p8l_skip4a - ; source: test_byte_lt.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:597 if x$36 - lda #<$36 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:601 skip4b: -p8l_skip4b - ; source: test_byte_lt.p8:603 if x$37 - lda #<$37 - jsr p8b_main.p8s_fail_byte -label_asm_66_afterif - ; source: test_byte_lt.p8:607 if x$38 - lda #<$38 - jsr p8b_main.p8s_fail_byte - bra label_asm_67_afterif -label_asm_68_else - ; source: test_byte_lt.p8:610 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_byte_lt.p8:612 values[1]=0 - stz p8v_values+1 - ; source: test_byte_lt.p8:614 if x$39 - lda #<$39 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:618 skip5a: -p8l_skip5a - ; source: test_byte_lt.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:621 if x$3a - lda #<$3a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:625 skip5b: -p8l_skip5b - ; source: test_byte_lt.p8:627 if x$3b - lda #<$3b - jsr p8b_main.p8s_fail_byte -label_asm_69_afterif - ; source: test_byte_lt.p8:631 if x$3c - lda #<$3c - jsr p8b_main.p8s_fail_byte - bra label_asm_70_afterif -label_asm_71_else - ; source: test_byte_lt.p8:634 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_byte_lt.p8:636 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_lt.p8:638 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:645 if x$3d - lda #<$3d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:667 skip7a: -p8l_skip7a - ; source: test_byte_lt.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:670 if x$3e - lda #<$3e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:674 skip7b: -p8l_skip7b - ; source: test_byte_lt.p8:676 if x$3f - lda #<$3f - jsr p8b_main.p8s_fail_byte -label_asm_75_afterif - ; source: test_byte_lt.p8:680 if x$40 - lda #<$40 - jsr p8b_main.p8s_fail_byte - bra label_asm_76_afterif -label_asm_77_else - ; source: test_byte_lt.p8:683 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_byte_lt.p8:685 values[1]=0 - stz p8v_values+1 - ; source: test_byte_lt.p8:687 if x$41 - lda #<$41 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:691 skip8a: -p8l_skip8a - ; source: test_byte_lt.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:694 if x$42 - lda #<$42 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:698 skip8b: -p8l_skip8b - ; source: test_byte_lt.p8:700 if x$43 - lda #<$43 - jsr p8b_main.p8s_fail_byte -label_asm_78_afterif - ; source: test_byte_lt.p8:704 if x$44 - lda #<$44 - jsr p8b_main.p8s_fail_byte - bra label_asm_79_afterif -label_asm_80_else - ; source: test_byte_lt.p8:707 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_byte_lt.p8:709 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_lt.p8:711 if x$45 - lda #<$45 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:715 skip9a: -p8l_skip9a - ; source: test_byte_lt.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:718 if x$46 - lda #<$46 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:722 skip9b: -p8l_skip9b - ; source: test_byte_lt.p8:724 if x$47 - lda #<$47 - jsr p8b_main.p8s_fail_byte -label_asm_81_afterif - ; source: test_byte_lt.p8:728 if x$48 - lda #<$48 - jsr p8b_main.p8s_fail_byte - bra label_asm_82_afterif -label_asm_83_else - ; source: test_byte_lt.p8:731 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_byte_lt.p8:733 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_lt.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS -; non-zeropage variables -p8v_values .char $00, $00 - .pend - ; source: test_byte_lt.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_byte_lt.p8:736 byte @shared x - ; source: test_byte_lt.p8:739 float @shared f4 = 1.0 - ; source: test_byte_lt.p8:740 float @shared f5 = 1.0 - ; source: test_byte_lt.p8:736 byte @shared x - stz p8v_x - ; source: test_byte_lt.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_byte_lt.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_byte_lt.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_byte_lt.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_byte_lt.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_lt.p8:742 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_lt.p8:744 if x$49 - lda #<$49 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:748 skip1a: -p8l_skip1a - ; source: test_byte_lt.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:751 if x$4a - lda #<$4a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:755 skip1b: -p8l_skip1b - ; source: test_byte_lt.p8:757 if x$4b - lda #<$4b - jsr p8b_main.p8s_fail_byte -label_asm_84_afterif - ; source: test_byte_lt.p8:761 if x$4c - lda #<$4c - jsr p8b_main.p8s_fail_byte - bra label_asm_85_afterif -label_asm_86_else - ; source: test_byte_lt.p8:764 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_byte_lt.p8:767 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:774 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:797 if x$4d - lda #<$4d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:818 skip4a: -p8l_skip4a - ; source: test_byte_lt.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:821 if x$4e - lda #<$4e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:825 skip4b: -p8l_skip4b - ; source: test_byte_lt.p8:827 if x$4f - lda #<$4f - jsr p8b_main.p8s_fail_byte -label_asm_93_afterif - ; source: test_byte_lt.p8:831 if x$50 - lda #<$50 - jsr p8b_main.p8s_fail_byte - bra label_asm_94_afterif -label_asm_95_else - ; source: test_byte_lt.p8:834 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_byte_lt.p8:837 if x$51 - lda #<$51 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:841 skip5a: -p8l_skip5a - ; source: test_byte_lt.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:844 if x$52 - lda #<$52 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:848 skip5b: -p8l_skip5b - ; source: test_byte_lt.p8:850 if x$53 - lda #<$53 - jsr p8b_main.p8s_fail_byte -label_asm_96_afterif - ; source: test_byte_lt.p8:854 if x$54 - lda #<$54 - jsr p8b_main.p8s_fail_byte - bra label_asm_97_afterif -label_asm_98_else - ; source: test_byte_lt.p8:857 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_byte_lt.p8:860 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:867 if x$55 - lda #<$55 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:888 skip7a: -p8l_skip7a - ; source: test_byte_lt.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:891 if x$56 - lda #<$56 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:895 skip7b: -p8l_skip7b - ; source: test_byte_lt.p8:897 if x$57 - lda #<$57 - jsr p8b_main.p8s_fail_byte -label_asm_102_afterif - ; source: test_byte_lt.p8:901 if x$58 - lda #<$58 - jsr p8b_main.p8s_fail_byte - bra label_asm_103_afterif -label_asm_104_else - ; source: test_byte_lt.p8:904 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_byte_lt.p8:907 if x$59 - lda #<$59 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:911 skip8a: -p8l_skip8a - ; source: test_byte_lt.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:914 if x$5a - lda #<$5a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:918 skip8b: -p8l_skip8b - ; source: test_byte_lt.p8:920 if x$5b - lda #<$5b - jsr p8b_main.p8s_fail_byte -label_asm_105_afterif - ; source: test_byte_lt.p8:924 if x$5c - lda #<$5c - jsr p8b_main.p8s_fail_byte - bra label_asm_106_afterif -label_asm_107_else - ; source: test_byte_lt.p8:927 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_byte_lt.p8:930 if x$5d - lda #<$5d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:934 skip9a: -p8l_skip9a - ; source: test_byte_lt.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lt.p8:937 if x$5e - lda #<$5e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lt.p8:941 skip9b: -p8l_skip9b - ; source: test_byte_lt.p8:943 if x$5f - lda #<$5f - jsr p8b_main.p8s_fail_byte -label_asm_108_afterif - ; source: test_byte_lt.p8:947 if x$60 - lda #<$60 - jsr p8b_main.p8s_fail_byte - bra label_asm_109_afterif -label_asm_110_else - ; source: test_byte_lt.p8:950 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_byte_lt.p8:952 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_byte_lt.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .char ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $54, $45, $53, $54, $53 - .byte $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_byte_lt.p8 b/compiler/test/comparisons/test_byte_lt.p8 deleted file mode 100644 index 5ffe47a30..000000000 --- a/compiler/test/comparisons/test_byte_lt.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "byte" - uword @shared comparison - - sub start() { - txt.print("\nless-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_byte_lte.p8:14 txt.print("\nless-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:83 if x<=-1 - lda p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_byte_lte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:87 skip1b: -p8l_skip1b - ; source: test_byte_lte.p8:89 if x<=-1 - lda p8v_x - bpl label_asm_3_afterif - ; source: test_byte_lte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_byte_lte.p8:93 if x<=-1 - lda p8v_x - bpl label_asm_5_else - ; source: test_byte_lte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_byte_lte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_byte_lte.p8:99 if x<=0 - lda p8v_x - bmi p8l_lbl2a - beq p8l_lbl2a - ; source: test_byte_lte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_byte_lte.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:103 skip2a: -p8l_skip2a - ; source: test_byte_lte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:106 if x<=0 - lda p8v_x - bmi + - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_byte_lte.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:110 skip2b: -p8l_skip2b - ; source: test_byte_lte.p8:112 if x<=0 - lda p8v_x - beq + - bpl label_asm_6_afterif -+ - ; source: test_byte_lte.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_byte_lte.p8:116 if x<=0 - lda p8v_x - beq + - bpl label_asm_8_else -+ - ; source: test_byte_lte.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_byte_lte.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_byte_lte.p8:122 if x<=1 - lda p8v_x - cmp #2 - bmi p8l_lbl3a - ; source: test_byte_lte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_byte_lte.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:126 skip3a: -p8l_skip3a - ; source: test_byte_lte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:129 if x<=1 - lda p8v_x - cmp #2 - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_byte_lte.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:133 skip3b: -p8l_skip3b - ; source: test_byte_lte.p8:135 if x<=1 - lda p8v_x - cmp #2 - bpl label_asm_9_afterif - ; source: test_byte_lte.p8:136 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_byte_lte.p8:139 if x<=1 - lda p8v_x - cmp #2 - bpl label_asm_11_else - ; source: test_byte_lte.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_byte_lte.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_byte_lte.p8:144 x=0 - stz p8v_x - ; source: test_byte_lte.p8:146 if x<=-1 - lda p8v_x - bmi p8l_lbl4a - ; source: test_byte_lte.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_byte_lte.p8:149 lbl4a: fail_byte(1) -p8l_lbl4a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:150 skip4a: -p8l_skip4a - ; source: test_byte_lte.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:153 if x<=-1 - lda p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_byte_lte.p8:156 lbl4b: fail_byte(2) -p8l_lbl4b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:157 skip4b: -p8l_skip4b - ; source: test_byte_lte.p8:159 if x<=-1 - lda p8v_x - bpl label_asm_12_afterif - ; source: test_byte_lte.p8:160 fail_byte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_byte -label_asm_12_afterif - ; source: test_byte_lte.p8:163 if x<=-1 - lda p8v_x - bpl label_asm_14_else - ; source: test_byte_lte.p8:164 fail_byte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_byte - bra label_asm_13_afterif -label_asm_14_else - ; source: test_byte_lte.p8:166 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_byte_lte.p8:169 if x<=0 - lda p8v_x - bmi p8l_lbl5a - beq p8l_lbl5a - ; source: test_byte_lte.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_byte_lte.p8:172 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:173 skip5a: -p8l_skip5a - ; source: test_byte_lte.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:176 if x<=0 - lda p8v_x - bmi + - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_byte_lte.p8:179 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:180 skip5b: -p8l_skip5b - ; source: test_byte_lte.p8:182 if x<=0 - lda p8v_x - beq + - bpl label_asm_15_afterif -+ - ; source: test_byte_lte.p8:183 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_byte_lte.p8:186 if x<=0 - lda p8v_x - beq + - bpl label_asm_17_else -+ - ; source: test_byte_lte.p8:187 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_byte_lte.p8:189 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_byte_lte.p8:192 if x<=1 - lda p8v_x - cmp #2 - bmi p8l_lbl6a - ; source: test_byte_lte.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_byte_lte.p8:195 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:196 skip6a: -p8l_skip6a - ; source: test_byte_lte.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:199 if x<=1 - lda p8v_x - cmp #2 - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_byte_lte.p8:202 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:203 skip6b: -p8l_skip6b - ; source: test_byte_lte.p8:205 if x<=1 - lda p8v_x - cmp #2 - bpl label_asm_18_afterif - ; source: test_byte_lte.p8:206 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_byte_lte.p8:209 if x<=1 - lda p8v_x - cmp #2 - bpl label_asm_20_else - ; source: test_byte_lte.p8:210 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_byte_lte.p8:212 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_byte_lte.p8:214 x=1 - lda #1 - sta p8v_x - ; source: test_byte_lte.p8:216 if x<=-1 - bmi p8l_lbl7a - ; source: test_byte_lte.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_byte_lte.p8:219 lbl7a: fail_byte(5) -p8l_lbl7a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:220 skip7a: -p8l_skip7a - ; source: test_byte_lte.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:223 if x<=-1 - lda p8v_x - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_byte_lte.p8:226 lbl7b: fail_byte(6) -p8l_lbl7b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:227 skip7b: -p8l_skip7b - ; source: test_byte_lte.p8:229 if x<=-1 - lda p8v_x - bpl label_asm_21_afterif - ; source: test_byte_lte.p8:230 fail_byte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_byte -label_asm_21_afterif - ; source: test_byte_lte.p8:233 if x<=-1 - lda p8v_x - bpl label_asm_23_else - ; source: test_byte_lte.p8:234 fail_byte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_byte - bra label_asm_22_afterif -label_asm_23_else - ; source: test_byte_lte.p8:236 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_byte_lte.p8:239 if x<=0 - lda p8v_x - bmi p8l_lbl8a - beq p8l_lbl8a - ; source: test_byte_lte.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_byte_lte.p8:242 lbl8a: fail_byte(9) -p8l_lbl8a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:243 skip8a: -p8l_skip8a - ; source: test_byte_lte.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:246 if x<=0 - lda p8v_x - bmi + - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_byte_lte.p8:249 lbl8b: fail_byte(10) -p8l_lbl8b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:250 skip8b: -p8l_skip8b - ; source: test_byte_lte.p8:252 if x<=0 - lda p8v_x - beq + - bpl label_asm_24_afterif -+ - ; source: test_byte_lte.p8:253 fail_byte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_byte -label_asm_24_afterif - ; source: test_byte_lte.p8:256 if x<=0 - lda p8v_x - beq + - bpl label_asm_26_else -+ - ; source: test_byte_lte.p8:257 fail_byte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_byte - bra label_asm_25_afterif -label_asm_26_else - ; source: test_byte_lte.p8:259 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_byte_lte.p8:262 if x<=1 - lda p8v_x - cmp #2 - bmi p8l_lbl9a - ; source: test_byte_lte.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_byte_lte.p8:265 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:266 skip9a: -p8l_skip9a - ; source: test_byte_lte.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:269 if x<=1 - lda p8v_x - cmp #2 - bpl + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_byte_lte.p8:272 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:273 skip9b: -p8l_skip9b - ; source: test_byte_lte.p8:275 if x<=1 - lda p8v_x - cmp #2 - bpl label_asm_27_afterif - ; source: test_byte_lte.p8:276 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_byte_lte.p8:279 if x<=1 - lda p8v_x - cmp #2 - bpl label_asm_29_else - ; source: test_byte_lte.p8:280 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_byte_lte.p8:282 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_byte_lte.p8:284 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_lte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_lte.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_byte_lte.p8:287 byte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_byte_lte.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_lte.p8:289 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_lte.p8:290 value=-1 - sta p8v_value - ; source: test_byte_lte.p8:292 if x<=value - cmp p8v_x - bpl p8l_lbl1a - ; source: test_byte_lte.p8:294 goto skip1a - bra p8l_skip1a - ; source: test_byte_lte.p8:295 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:296 skip1a: -p8l_skip1a - ; source: test_byte_lte.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:299 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:301 goto skip1b - bra p8l_skip1b - ; source: test_byte_lte.p8:302 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:303 skip1b: -p8l_skip1b - ; source: test_byte_lte.p8:305 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_30_afterif - ; source: test_byte_lte.p8:306 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_byte_lte.p8:309 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_32_else - ; source: test_byte_lte.p8:310 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_byte_lte.p8:312 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_byte_lte.p8:314 value=0 - stz p8v_value - ; source: test_byte_lte.p8:316 if x<=value - lda p8v_value - cmp p8v_x - bpl p8l_lbl2a - ; source: test_byte_lte.p8:318 goto skip2a - bra p8l_skip2a - ; source: test_byte_lte.p8:319 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:320 skip2a: -p8l_skip2a - ; source: test_byte_lte.p8:322 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:323 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:325 goto skip2b - bra p8l_skip2b - ; source: test_byte_lte.p8:326 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:327 skip2b: -p8l_skip2b - ; source: test_byte_lte.p8:329 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_33_afterif - ; source: test_byte_lte.p8:330 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_byte_lte.p8:333 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_35_else - ; source: test_byte_lte.p8:334 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_byte_lte.p8:336 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_byte_lte.p8:338 value=1 - lda #1 - sta p8v_value - ; source: test_byte_lte.p8:340 if x<=value - cmp p8v_x - bpl p8l_lbl3a - ; source: test_byte_lte.p8:342 goto skip3a - bra p8l_skip3a - ; source: test_byte_lte.p8:343 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:344 skip3a: -p8l_skip3a - ; source: test_byte_lte.p8:346 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:347 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:349 goto skip3b - bra p8l_skip3b - ; source: test_byte_lte.p8:350 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:351 skip3b: -p8l_skip3b - ; source: test_byte_lte.p8:353 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_36_afterif - ; source: test_byte_lte.p8:354 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_byte_lte.p8:357 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_38_else - ; source: test_byte_lte.p8:358 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_byte_lte.p8:360 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_byte_lte.p8:362 x=0 - stz p8v_x - ; source: test_byte_lte.p8:363 value=-1 - lda #-1 - sta p8v_value - ; source: test_byte_lte.p8:365 if x<=value - cmp p8v_x - bpl p8l_lbl4a - ; source: test_byte_lte.p8:367 goto skip4a - bra p8l_skip4a - ; source: test_byte_lte.p8:368 lbl4a: fail_byte(13) -p8l_lbl4a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:369 skip4a: -p8l_skip4a - ; source: test_byte_lte.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:372 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:374 goto skip4b - bra p8l_skip4b - ; source: test_byte_lte.p8:375 lbl4b: fail_byte(14) -p8l_lbl4b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:376 skip4b: -p8l_skip4b - ; source: test_byte_lte.p8:378 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_39_afterif - ; source: test_byte_lte.p8:379 fail_byte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_byte -label_asm_39_afterif - ; source: test_byte_lte.p8:382 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_41_else - ; source: test_byte_lte.p8:383 fail_byte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_byte - bra label_asm_40_afterif -label_asm_41_else - ; source: test_byte_lte.p8:385 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_byte_lte.p8:387 value=0 - stz p8v_value - ; source: test_byte_lte.p8:389 if x<=value - lda p8v_value - cmp p8v_x - bpl p8l_lbl5a - ; source: test_byte_lte.p8:391 goto skip5a - bra p8l_skip5a - ; source: test_byte_lte.p8:392 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:393 skip5a: -p8l_skip5a - ; source: test_byte_lte.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:396 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:398 goto skip5b - bra p8l_skip5b - ; source: test_byte_lte.p8:399 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:400 skip5b: -p8l_skip5b - ; source: test_byte_lte.p8:402 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_42_afterif - ; source: test_byte_lte.p8:403 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_byte_lte.p8:406 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_44_else - ; source: test_byte_lte.p8:407 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_byte_lte.p8:409 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_byte_lte.p8:411 value=1 - lda #1 - sta p8v_value - ; source: test_byte_lte.p8:413 if x<=value - cmp p8v_x - bpl p8l_lbl6a - ; source: test_byte_lte.p8:415 goto skip6a - bra p8l_skip6a - ; source: test_byte_lte.p8:416 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:417 skip6a: -p8l_skip6a - ; source: test_byte_lte.p8:419 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:420 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:422 goto skip6b - bra p8l_skip6b - ; source: test_byte_lte.p8:423 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:424 skip6b: -p8l_skip6b - ; source: test_byte_lte.p8:426 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_45_afterif - ; source: test_byte_lte.p8:427 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_byte_lte.p8:430 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_47_else - ; source: test_byte_lte.p8:431 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_byte_lte.p8:433 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_byte_lte.p8:435 x=1 - lda #1 - sta p8v_x - ; source: test_byte_lte.p8:436 value=-1 - lda #-1 - sta p8v_value - ; source: test_byte_lte.p8:438 if x<=value - cmp p8v_x - bpl p8l_lbl7a - ; source: test_byte_lte.p8:440 goto skip7a - bra p8l_skip7a - ; source: test_byte_lte.p8:441 lbl7a: fail_byte(17) -p8l_lbl7a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:442 skip7a: -p8l_skip7a - ; source: test_byte_lte.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:445 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:447 goto skip7b - bra p8l_skip7b - ; source: test_byte_lte.p8:448 lbl7b: fail_byte(18) -p8l_lbl7b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:449 skip7b: -p8l_skip7b - ; source: test_byte_lte.p8:451 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_48_afterif - ; source: test_byte_lte.p8:452 fail_byte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_byte -label_asm_48_afterif - ; source: test_byte_lte.p8:455 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_50_else - ; source: test_byte_lte.p8:456 fail_byte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_byte - bra label_asm_49_afterif -label_asm_50_else - ; source: test_byte_lte.p8:458 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_byte_lte.p8:460 value=0 - stz p8v_value - ; source: test_byte_lte.p8:462 if x<=value - lda p8v_value - cmp p8v_x - bpl p8l_lbl8a - ; source: test_byte_lte.p8:464 goto skip8a - bra p8l_skip8a - ; source: test_byte_lte.p8:465 lbl8a: fail_byte(21) -p8l_lbl8a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:466 skip8a: -p8l_skip8a - ; source: test_byte_lte.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:469 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:471 goto skip8b - bra p8l_skip8b - ; source: test_byte_lte.p8:472 lbl8b: fail_byte(22) -p8l_lbl8b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:473 skip8b: -p8l_skip8b - ; source: test_byte_lte.p8:475 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_51_afterif - ; source: test_byte_lte.p8:476 fail_byte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_byte -label_asm_51_afterif - ; source: test_byte_lte.p8:479 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_53_else - ; source: test_byte_lte.p8:480 fail_byte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_byte - bra label_asm_52_afterif -label_asm_53_else - ; source: test_byte_lte.p8:482 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_byte_lte.p8:484 value=1 - lda #1 - sta p8v_value - ; source: test_byte_lte.p8:486 if x<=value - cmp p8v_x - bpl p8l_lbl9a - ; source: test_byte_lte.p8:488 goto skip9a - bra p8l_skip9a - ; source: test_byte_lte.p8:489 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:490 skip9a: -p8l_skip9a - ; source: test_byte_lte.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:493 if x<=value - lda p8v_value - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:495 goto skip9b - bra p8l_skip9b - ; source: test_byte_lte.p8:496 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:497 skip9b: -p8l_skip9b - ; source: test_byte_lte.p8:499 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_54_afterif - ; source: test_byte_lte.p8:500 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_byte_lte.p8:503 if x<=value - lda p8v_value - cmp p8v_x - bmi label_asm_56_else - ; source: test_byte_lte.p8:504 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_byte_lte.p8:506 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_byte_lte.p8:508 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_lte.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .char ? -p8v_x .char ? - .send BSS - .pend - ; source: test_byte_lte.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_byte_lte.p8:511 byte @shared x - ; source: test_byte_lte.p8:512 byte[] values = [0, 0] - ; source: test_byte_lte.p8:511 byte @shared x - stz p8v_x - ; source: test_byte_lte.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_lte.p8:514 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_lte.p8:515 values[1]=-1 - sta p8v_values+1 - ; source: test_byte_lte.p8:517 if x<=values[1] - cmp p8v_x - bpl p8l_lbl1a - ; source: test_byte_lte.p8:519 goto skip1a - bra p8l_skip1a - ; source: test_byte_lte.p8:520 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:521 skip1a: -p8l_skip1a - ; source: test_byte_lte.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:524 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:526 goto skip1b - bra p8l_skip1b - ; source: test_byte_lte.p8:527 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:528 skip1b: -p8l_skip1b - ; source: test_byte_lte.p8:530 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_57_afterif - ; source: test_byte_lte.p8:531 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_byte_lte.p8:534 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_59_else - ; source: test_byte_lte.p8:535 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_byte_lte.p8:537 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_byte_lte.p8:539 values[1]=0 - stz p8v_values+1 - ; source: test_byte_lte.p8:541 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bpl p8l_lbl2a - ; source: test_byte_lte.p8:543 goto skip2a - bra p8l_skip2a - ; source: test_byte_lte.p8:544 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:545 skip2a: -p8l_skip2a - ; source: test_byte_lte.p8:547 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:548 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:550 goto skip2b - bra p8l_skip2b - ; source: test_byte_lte.p8:551 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:552 skip2b: -p8l_skip2b - ; source: test_byte_lte.p8:554 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_60_afterif - ; source: test_byte_lte.p8:555 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_byte_lte.p8:558 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_62_else - ; source: test_byte_lte.p8:559 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_byte_lte.p8:561 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_byte_lte.p8:563 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_lte.p8:565 if x<=values[1] - cmp p8v_x - bpl p8l_lbl3a - ; source: test_byte_lte.p8:567 goto skip3a - bra p8l_skip3a - ; source: test_byte_lte.p8:568 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:569 skip3a: -p8l_skip3a - ; source: test_byte_lte.p8:571 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:572 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:574 goto skip3b - bra p8l_skip3b - ; source: test_byte_lte.p8:575 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:576 skip3b: -p8l_skip3b - ; source: test_byte_lte.p8:578 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_63_afterif - ; source: test_byte_lte.p8:579 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_byte_lte.p8:582 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_65_else - ; source: test_byte_lte.p8:583 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_byte_lte.p8:585 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_byte_lte.p8:587 x=0 - stz p8v_x - ; source: test_byte_lte.p8:588 values[1]=-1 - lda #-1 - sta p8v_values+1 - ; source: test_byte_lte.p8:590 if x<=values[1] - cmp p8v_x - bpl p8l_lbl4a - ; source: test_byte_lte.p8:592 goto skip4a - bra p8l_skip4a - ; source: test_byte_lte.p8:593 lbl4a: fail_byte(25) -p8l_lbl4a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:594 skip4a: -p8l_skip4a - ; source: test_byte_lte.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:597 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:599 goto skip4b - bra p8l_skip4b - ; source: test_byte_lte.p8:600 lbl4b: fail_byte(26) -p8l_lbl4b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:601 skip4b: -p8l_skip4b - ; source: test_byte_lte.p8:603 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_66_afterif - ; source: test_byte_lte.p8:604 fail_byte(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_byte -label_asm_66_afterif - ; source: test_byte_lte.p8:607 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_68_else - ; source: test_byte_lte.p8:608 fail_byte(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_byte - bra label_asm_67_afterif -label_asm_68_else - ; source: test_byte_lte.p8:610 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_byte_lte.p8:612 values[1]=0 - stz p8v_values+1 - ; source: test_byte_lte.p8:614 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bpl p8l_lbl5a - ; source: test_byte_lte.p8:616 goto skip5a - bra p8l_skip5a - ; source: test_byte_lte.p8:617 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:618 skip5a: -p8l_skip5a - ; source: test_byte_lte.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:621 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:623 goto skip5b - bra p8l_skip5b - ; source: test_byte_lte.p8:624 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:625 skip5b: -p8l_skip5b - ; source: test_byte_lte.p8:627 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_69_afterif - ; source: test_byte_lte.p8:628 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_byte_lte.p8:631 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_71_else - ; source: test_byte_lte.p8:632 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_byte_lte.p8:634 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_byte_lte.p8:636 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_lte.p8:638 if x<=values[1] - cmp p8v_x - bpl p8l_lbl6a - ; source: test_byte_lte.p8:640 goto skip6a - bra p8l_skip6a - ; source: test_byte_lte.p8:641 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:642 skip6a: -p8l_skip6a - ; source: test_byte_lte.p8:644 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:645 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:647 goto skip6b - bra p8l_skip6b - ; source: test_byte_lte.p8:648 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:649 skip6b: -p8l_skip6b - ; source: test_byte_lte.p8:651 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_72_afterif - ; source: test_byte_lte.p8:652 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_byte_lte.p8:655 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_74_else - ; source: test_byte_lte.p8:656 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_byte_lte.p8:658 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_byte_lte.p8:660 x=1 - lda #1 - sta p8v_x - ; source: test_byte_lte.p8:661 values[1]=-1 - lda #-1 - sta p8v_values+1 - ; source: test_byte_lte.p8:663 if x<=values[1] - cmp p8v_x - bpl p8l_lbl7a - ; source: test_byte_lte.p8:665 goto skip7a - bra p8l_skip7a - ; source: test_byte_lte.p8:666 lbl7a: fail_byte(29) -p8l_lbl7a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:667 skip7a: -p8l_skip7a - ; source: test_byte_lte.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:670 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:672 goto skip7b - bra p8l_skip7b - ; source: test_byte_lte.p8:673 lbl7b: fail_byte(30) -p8l_lbl7b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:674 skip7b: -p8l_skip7b - ; source: test_byte_lte.p8:676 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_75_afterif - ; source: test_byte_lte.p8:677 fail_byte(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_byte -label_asm_75_afterif - ; source: test_byte_lte.p8:680 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_77_else - ; source: test_byte_lte.p8:681 fail_byte(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_byte - bra label_asm_76_afterif -label_asm_77_else - ; source: test_byte_lte.p8:683 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_byte_lte.p8:685 values[1]=0 - stz p8v_values+1 - ; source: test_byte_lte.p8:687 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bpl p8l_lbl8a - ; source: test_byte_lte.p8:689 goto skip8a - bra p8l_skip8a - ; source: test_byte_lte.p8:690 lbl8a: fail_byte(33) -p8l_lbl8a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:691 skip8a: -p8l_skip8a - ; source: test_byte_lte.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:694 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:696 goto skip8b - bra p8l_skip8b - ; source: test_byte_lte.p8:697 lbl8b: fail_byte(34) -p8l_lbl8b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:698 skip8b: -p8l_skip8b - ; source: test_byte_lte.p8:700 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_78_afterif - ; source: test_byte_lte.p8:701 fail_byte(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_byte -label_asm_78_afterif - ; source: test_byte_lte.p8:704 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_80_else - ; source: test_byte_lte.p8:705 fail_byte(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_byte - bra label_asm_79_afterif -label_asm_80_else - ; source: test_byte_lte.p8:707 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_byte_lte.p8:709 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_byte_lte.p8:711 if x<=values[1] - cmp p8v_x - bpl p8l_lbl9a - ; source: test_byte_lte.p8:713 goto skip9a - bra p8l_skip9a - ; source: test_byte_lte.p8:714 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:715 skip9a: -p8l_skip9a - ; source: test_byte_lte.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:718 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:720 goto skip9b - bra p8l_skip9b - ; source: test_byte_lte.p8:721 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:722 skip9b: -p8l_skip9b - ; source: test_byte_lte.p8:724 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_81_afterif - ; source: test_byte_lte.p8:725 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_byte_lte.p8:728 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bmi label_asm_83_else - ; source: test_byte_lte.p8:729 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_byte_lte.p8:731 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_byte_lte.p8:733 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_lte.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .char ? - .send BSS -; non-zeropage variables -p8v_values .char $00, $00 - .pend - ; source: test_byte_lte.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_byte_lte.p8:736 byte @shared x - ; source: test_byte_lte.p8:739 float @shared f4 = 1.0 - ; source: test_byte_lte.p8:740 float @shared f5 = 1.0 - ; source: test_byte_lte.p8:736 byte @shared x - stz p8v_x - ; source: test_byte_lte.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_byte_lte.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_byte_lte.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_byte_lte.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_byte_lte.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_byte_lte.p8:742 x=-1 - lda #-1 - sta p8v_x - ; source: test_byte_lte.p8:744 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl1a - ; source: test_byte_lte.p8:746 goto skip1a - bra p8l_skip1a - ; source: test_byte_lte.p8:747 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:748 skip1a: -p8l_skip1a - ; source: test_byte_lte.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:751 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:753 goto skip1b - bra p8l_skip1b - ; source: test_byte_lte.p8:754 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:755 skip1b: -p8l_skip1b - ; source: test_byte_lte.p8:757 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_84_afterif - ; source: test_byte_lte.p8:758 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_byte_lte.p8:761 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_86_else - ; source: test_byte_lte.p8:762 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_byte_lte.p8:764 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_byte_lte.p8:767 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl2a - ; source: test_byte_lte.p8:769 goto skip2a - bra p8l_skip2a - ; source: test_byte_lte.p8:770 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:771 skip2a: -p8l_skip2a - ; source: test_byte_lte.p8:773 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:774 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:776 goto skip2b - bra p8l_skip2b - ; source: test_byte_lte.p8:777 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:778 skip2b: -p8l_skip2b - ; source: test_byte_lte.p8:780 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_87_afterif - ; source: test_byte_lte.p8:781 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_byte_lte.p8:784 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_89_else - ; source: test_byte_lte.p8:785 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_byte_lte.p8:787 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_byte_lte.p8:790 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl3a - ; source: test_byte_lte.p8:792 goto skip3a - bra p8l_skip3a - ; source: test_byte_lte.p8:793 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:794 skip3a: -p8l_skip3a - ; source: test_byte_lte.p8:796 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:797 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:799 goto skip3b - bra p8l_skip3b - ; source: test_byte_lte.p8:800 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:801 skip3b: -p8l_skip3b - ; source: test_byte_lte.p8:803 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_90_afterif - ; source: test_byte_lte.p8:804 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_byte_lte.p8:807 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_92_else - ; source: test_byte_lte.p8:808 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_byte_lte.p8:810 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_byte_lte.p8:812 x=0 - stz p8v_x - ; source: test_byte_lte.p8:814 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl4a - ; source: test_byte_lte.p8:816 goto skip4a - bra p8l_skip4a - ; source: test_byte_lte.p8:817 lbl4a: fail_byte(37) -p8l_lbl4a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:818 skip4a: -p8l_skip4a - ; source: test_byte_lte.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:821 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:823 goto skip4b - bra p8l_skip4b - ; source: test_byte_lte.p8:824 lbl4b: fail_byte(38) -p8l_lbl4b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:825 skip4b: -p8l_skip4b - ; source: test_byte_lte.p8:827 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_93_afterif - ; source: test_byte_lte.p8:828 fail_byte(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_byte -label_asm_93_afterif - ; source: test_byte_lte.p8:831 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_95_else - ; source: test_byte_lte.p8:832 fail_byte(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_byte - bra label_asm_94_afterif -label_asm_95_else - ; source: test_byte_lte.p8:834 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_byte_lte.p8:837 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl5a - ; source: test_byte_lte.p8:839 goto skip5a - bra p8l_skip5a - ; source: test_byte_lte.p8:840 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:841 skip5a: -p8l_skip5a - ; source: test_byte_lte.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:844 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:846 goto skip5b - bra p8l_skip5b - ; source: test_byte_lte.p8:847 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:848 skip5b: -p8l_skip5b - ; source: test_byte_lte.p8:850 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_96_afterif - ; source: test_byte_lte.p8:851 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_byte_lte.p8:854 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_98_else - ; source: test_byte_lte.p8:855 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_byte_lte.p8:857 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_byte_lte.p8:860 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl6a - ; source: test_byte_lte.p8:862 goto skip6a - bra p8l_skip6a - ; source: test_byte_lte.p8:863 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:864 skip6a: -p8l_skip6a - ; source: test_byte_lte.p8:866 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:867 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:869 goto skip6b - bra p8l_skip6b - ; source: test_byte_lte.p8:870 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:871 skip6b: -p8l_skip6b - ; source: test_byte_lte.p8:873 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_99_afterif - ; source: test_byte_lte.p8:874 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_byte_lte.p8:877 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_101_else - ; source: test_byte_lte.p8:878 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_byte_lte.p8:880 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_byte_lte.p8:882 x=1 - lda #1 - sta p8v_x - ; source: test_byte_lte.p8:884 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl7a - ; source: test_byte_lte.p8:886 goto skip7a - bra p8l_skip7a - ; source: test_byte_lte.p8:887 lbl7a: fail_byte(41) -p8l_lbl7a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:888 skip7a: -p8l_skip7a - ; source: test_byte_lte.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:891 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:893 goto skip7b - bra p8l_skip7b - ; source: test_byte_lte.p8:894 lbl7b: fail_byte(42) -p8l_lbl7b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:895 skip7b: -p8l_skip7b - ; source: test_byte_lte.p8:897 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_102_afterif - ; source: test_byte_lte.p8:898 fail_byte(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_byte -label_asm_102_afterif - ; source: test_byte_lte.p8:901 if x<=cx16.r4sL+-1-cx16.r5sL - lda cx16.r4sL - sec - sbc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_104_else - ; source: test_byte_lte.p8:902 fail_byte(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_byte - bra label_asm_103_afterif -label_asm_104_else - ; source: test_byte_lte.p8:904 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_byte_lte.p8:907 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl8a - ; source: test_byte_lte.p8:909 goto skip8a - bra p8l_skip8a - ; source: test_byte_lte.p8:910 lbl8a: fail_byte(45) -p8l_lbl8a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:911 skip8a: -p8l_skip8a - ; source: test_byte_lte.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:914 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:916 goto skip8b - bra p8l_skip8b - ; source: test_byte_lte.p8:917 lbl8b: fail_byte(46) -p8l_lbl8b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_byte - ; source: test_byte_lte.p8:918 skip8b: -p8l_skip8b - ; source: test_byte_lte.p8:920 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_105_afterif - ; source: test_byte_lte.p8:921 fail_byte(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_byte -label_asm_105_afterif - ; source: test_byte_lte.p8:924 if x<=cx16.r4sL+0-cx16.r5sL - lda cx16.r4sL - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_107_else - ; source: test_byte_lte.p8:925 fail_byte(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_byte - bra label_asm_106_afterif -label_asm_107_else - ; source: test_byte_lte.p8:927 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_byte_lte.p8:930 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bpl p8l_lbl9a - ; source: test_byte_lte.p8:932 goto skip9a - bra p8l_skip9a - ; source: test_byte_lte.p8:933 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:934 skip9a: -p8l_skip9a - ; source: test_byte_lte.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_byte_lte.p8:937 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi + - jmp (cx16.r3) -+ - ; source: test_byte_lte.p8:939 goto skip9b - bra p8l_skip9b - ; source: test_byte_lte.p8:940 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_byte_lte.p8:941 skip9b: -p8l_skip9b - ; source: test_byte_lte.p8:943 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_108_afterif - ; source: test_byte_lte.p8:944 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_byte_lte.p8:947 if x<=cx16.r4sL+1-cx16.r5sL - lda cx16.r4sL - clc - adc #1 - sec - sbc cx16.r5sL - cmp p8v_x - bmi label_asm_110_else - ; source: test_byte_lte.p8:948 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_byte_lte.p8:950 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_byte_lte.p8:952 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_byte_lte.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .char ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $54, $45, $53, $54 - .byte $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n<=number: " - .byte $0d, $3c, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n<=var: " - .byte $0d, $3c, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n<=expr: " - .byte $0d, $3c, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_byte_lte.p8:14 txt.print("\nless-equal tests for: ") - ; source: test_byte_lte.p8:18 txt.print("\n<=number: ") - ; source: test_byte_lte.p8:20 txt.print("\n<=var: ") - ; source: test_byte_lte.p8:22 txt.print("\n<=array[]: ") - ; source: test_byte_lte.p8:24 txt.print("\n<=expr: ") - ; source: test_byte_lte.p8:33 txt.print(" **failed** ") - ; source: test_byte_lte.p8:35 txt.print(" success, expected ") - ; source: test_byte_lte.p8:41 txt.print(" **fail#") - ; source: test_byte_lte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_byte_lte.p8 b/compiler/test/comparisons/test_byte_lte.p8 deleted file mode 100644 index e13f7e96a..000000000 --- a/compiler/test/comparisons/test_byte_lte.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "byte" - uword @shared comparison - - sub start() { - txt.print("\nless-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=number: ") - test_cmp_number() - txt.print("\n<=var: ") - test_cmp_var() - txt.print("\n<=array[]: ") - test_cmp_array() - txt.print("\n<=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - byte @shared x - success = 0 - x=-1 - ; direct jump - if x<=-1 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=-1 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=-1 - success++ - - ; with else - if x<=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=0 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=0 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=1 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x<=-1 - goto lbl4a - goto skip4a -lbl4a: fail_byte(1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=-1 - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(2) -skip4b: - ; no else - if x<=-1 - fail_byte(3) - - ; with else - if x<=-1 - fail_byte(4) - else - success++ - - ; direct jump - if x<=0 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=0 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=1 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=-1 - goto lbl7a - goto skip7a -lbl7a: fail_byte(5) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=-1 - goto cx16.r3 - goto skip7b -lbl7b: fail_byte(6) -skip7b: - ; no else - if x<=-1 - fail_byte(7) - - ; with else - if x<=-1 - fail_byte(8) - else - success++ - - ; direct jump - if x<=0 - goto lbl8a - goto skip8a -lbl8a: fail_byte(9) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=0 - goto cx16.r3 - goto skip8b -lbl8b: fail_byte(10) -skip8b: - ; no else - if x<=0 - fail_byte(11) - - ; with else - if x<=0 - fail_byte(12) - else - success++ - - ; direct jump - if x<=1 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=1 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_var() { - byte @shared x, value - success = 0 - x=-1 - value=-1 - ; direct jump - if x<=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x<=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=0 - value=-1 - ; direct jump - if x<=value - goto lbl4a - goto skip4a -lbl4a: fail_byte(13) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=value - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(14) -skip4b: - ; no else - if x<=value - fail_byte(15) - - ; with else - if x<=value - fail_byte(16) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=1 - value=-1 - ; direct jump - if x<=value - goto lbl7a - goto skip7a -lbl7a: fail_byte(17) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=value - goto cx16.r3 - goto skip7b -lbl7b: fail_byte(18) -skip7b: - ; no else - if x<=value - fail_byte(19) - - ; with else - if x<=value - fail_byte(20) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl8a - goto skip8a -lbl8a: fail_byte(21) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=value - goto cx16.r3 - goto skip8b -lbl8b: fail_byte(22) -skip8b: - ; no else - if x<=value - fail_byte(23) - - ; with else - if x<=value - fail_byte(24) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_array() { - byte @shared x - byte[] values = [0, 0] - success = 0 - x=-1 - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=0 - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_byte(25) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(26) -skip4b: - ; no else - if x<=values[1] - fail_byte(27) - - ; with else - if x<=values[1] - fail_byte(28) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=1 - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl7a - goto skip7a -lbl7a: fail_byte(29) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_byte(30) -skip7b: - ; no else - if x<=values[1] - fail_byte(31) - - ; with else - if x<=values[1] - fail_byte(32) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_byte(33) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_byte(34) -skip8b: - ; no else - if x<=values[1] - fail_byte(35) - - ; with else - if x<=values[1] - fail_byte(36) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_expr() { - byte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-1 - ; direct jump - if x<=cx16.r4sL+-1-cx16.r5sL - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=cx16.r4sL+-1-cx16.r5sL - success++ - - ; with else - if x<=cx16.r4sL+-1-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4sL+0-cx16.r5sL - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=cx16.r4sL+0-cx16.r5sL - success++ - - ; with else - if x<=cx16.r4sL+0-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4sL+1-cx16.r5sL - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=cx16.r4sL+1-cx16.r5sL - success++ - - ; with else - if x<=cx16.r4sL+1-cx16.r5sL - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x<=cx16.r4sL+-1-cx16.r5sL - goto lbl4a - goto skip4a -lbl4a: fail_byte(37) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip4b -lbl4b: fail_byte(38) -skip4b: - ; no else - if x<=cx16.r4sL+-1-cx16.r5sL - fail_byte(39) - - ; with else - if x<=cx16.r4sL+-1-cx16.r5sL - fail_byte(40) - else - success++ - - ; direct jump - if x<=cx16.r4sL+0-cx16.r5sL - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=cx16.r4sL+0-cx16.r5sL - success++ - - ; with else - if x<=cx16.r4sL+0-cx16.r5sL - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4sL+1-cx16.r5sL - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=cx16.r4sL+1-cx16.r5sL - success++ - - ; with else - if x<=cx16.r4sL+1-cx16.r5sL - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=cx16.r4sL+-1-cx16.r5sL - goto lbl7a - goto skip7a -lbl7a: fail_byte(41) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=cx16.r4sL+-1-cx16.r5sL - goto cx16.r3 - goto skip7b -lbl7b: fail_byte(42) -skip7b: - ; no else - if x<=cx16.r4sL+-1-cx16.r5sL - fail_byte(43) - - ; with else - if x<=cx16.r4sL+-1-cx16.r5sL - fail_byte(44) - else - success++ - - ; direct jump - if x<=cx16.r4sL+0-cx16.r5sL - goto lbl8a - goto skip8a -lbl8a: fail_byte(45) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=cx16.r4sL+0-cx16.r5sL - goto cx16.r3 - goto skip8b -lbl8b: fail_byte(46) -skip8b: - ; no else - if x<=cx16.r4sL+0-cx16.r5sL - fail_byte(47) - - ; with else - if x<=cx16.r4sL+0-cx16.r5sL - fail_byte(48) - else - success++ - - ; direct jump - if x<=cx16.r4sL+1-cx16.r5sL - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=cx16.r4sL+1-cx16.r5sL - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=cx16.r4sL+1-cx16.r5sL - success++ - - ; with else - if x<=cx16.r4sL+1-cx16.r5sL - success++ - else - cx16.r0L++ - - verify_success(27) -} - -} - diff --git a/compiler/test/comparisons/test_float_equalities.asm b/compiler/test/comparisons/test_float_equalities.asm deleted file mode 100644 index 40d433716..000000000 --- a/compiler/test/comparisons/test_float_equalities.asm +++ /dev/null @@ -1,9992 +0,0 @@ -; w65c02 assembly code for 'test_float_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_float_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"float" - .byte $46, $4c, $4f, $41, $54, $00 - - ; source: test_float_equalities.p8:9 ubyte success = 0 - ; source: test_float_equalities.p8:10 str datatype = "float" - ; source: test_float_equalities.p8:11 uword @shared comparison - ; source: test_float_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_float_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #p8v_v1 - jsr floats.MOVFM - jsr floats.print - ; source: test_float_equalities.p8:89 txt.print(" **") - ldy #>prog8_interned_strings.string_16 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq p8l_lbl1 - ; source: test_float_equalities.p8:102 goto skip1 - bra p8l_skip1 - ; source: test_float_equalities.p8:103 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:104 skip1: -p8l_skip1 - ; source: test_float_equalities.p8:106 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:107 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:109 goto skip2 - bra p8l_skip2 - ; source: test_float_equalities.p8:110 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:111 skip2: -p8l_skip2 - ; source: test_float_equalities.p8:113 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne label_asm_3_afterif - ; source: test_float_equalities.p8:114 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_float_equalities.p8:117 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne label_asm_5_else - ; source: test_float_equalities.p8:118 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_float_equalities.p8:120 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_float_equalities.p8:122 x = 1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:124 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq p8l_skip3 - ; source: test_float_equalities.p8:126 success++ - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:127 skip3: -p8l_skip3 - ; source: test_float_equalities.p8:129 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:130 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:132 success++ - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:133 skip4: -p8l_skip4 - ; source: test_float_equalities.p8:135 success++ - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:136 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne label_asm_6_afterif - ; source: test_float_equalities.p8:137 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_float_equalities.p8:140 if x==0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne label_asm_8_else - ; source: test_float_equalities.p8:141 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_float_equalities.p8:143 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_float_equalities.p8:145 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:94 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:149 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_float_equalities.p8:150 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:151 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:153 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:155 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne p8l_lbl1 - ; source: test_float_equalities.p8:157 goto skip1 - bra p8l_skip1 - ; source: test_float_equalities.p8:158 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:159 skip1: -p8l_skip1 - ; source: test_float_equalities.p8:161 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:162 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:164 goto skip2 - bra p8l_skip2 - ; source: test_float_equalities.p8:165 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:166 skip2: -p8l_skip2 - ; source: test_float_equalities.p8:168 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq label_asm_9_afterif - ; source: test_float_equalities.p8:169 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_float_equalities.p8:172 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq label_asm_11_else - ; source: test_float_equalities.p8:173 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_float_equalities.p8:175 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_float_equalities.p8:177 x = 0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:179 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - bne p8l_skip3 - ; source: test_float_equalities.p8:181 success++ - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:182 skip3: -p8l_skip3 - ; source: test_float_equalities.p8:184 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:185 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:187 success++ - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:188 skip4: -p8l_skip4 - ; source: test_float_equalities.p8:190 success++ - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:191 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq label_asm_12_afterif - ; source: test_float_equalities.p8:192 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_float_equalities.p8:195 if x!=0 - lda #p8v_x - jsr floats.MOVFM - jsr floats.SIGN - cmp #0 - beq label_asm_14_else - ; source: test_float_equalities.p8:196 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_float_equalities.p8:198 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_float_equalities.p8:200 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:149 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:203 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_float_equalities.p8:204 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:205 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:206 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:208 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne p8l_lbl1a - ; source: test_float_equalities.p8:210 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:211 lbl1a: fail_float(1,0.0) -p8l_lbl1a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:212 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:214 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:215 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:217 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:218 lbl1b: fail_float(2,0.0) -p8l_lbl1b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:219 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:221 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_15_afterif - ; source: test_float_equalities.p8:222 fail_float(3,0.0) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float -label_asm_15_afterif - ; source: test_float_equalities.p8:225 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_17_else - ; source: test_float_equalities.p8:226 fail_float(4,0.0) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - bra label_asm_16_afterif -label_asm_17_else - ; source: test_float_equalities.p8:228 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_float_equalities.p8:230 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:232 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne p8l_lbl2a - ; source: test_float_equalities.p8:234 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:235 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:236 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:238 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:239 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:241 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:242 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:243 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:245 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_18_afterif - ; source: test_float_equalities.p8:246 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_float_equalities.p8:249 if x==1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq label_asm_20_else - ; source: test_float_equalities.p8:250 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_float_equalities.p8:252 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_float_equalities.p8:254 verify_success(4) - lda #4 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:203 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:256 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_float_equalities.p8:257 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:258 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:259 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:261 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq p8l_lbl1a - ; source: test_float_equalities.p8:263 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:264 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:265 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:267 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:268 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:270 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:271 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:272 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:274 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_21_afterif - ; source: test_float_equalities.p8:275 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_float_equalities.p8:278 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_23_else - ; source: test_float_equalities.p8:279 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_float_equalities.p8:281 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_float_equalities.p8:283 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:285 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - beq p8l_lbl2a - ; source: test_float_equalities.p8:287 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:288 lbl2a: fail_float(5,1234.56) -p8l_lbl2a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:289 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:291 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:292 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:294 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:295 lbl2b: fail_float(6,1234.56) -p8l_lbl2b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:296 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:298 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_24_afterif - ; source: test_float_equalities.p8:299 fail_float(7,1234.56) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float -label_asm_24_afterif - ; source: test_float_equalities.p8:302 if x!=1234.56 - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_const_0 - jsr floats.vars_equal_f - bne label_asm_26_else - ; source: test_float_equalities.p8:303 fail_float(8,1234.56) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - bra label_asm_25_afterif -label_asm_26_else - ; source: test_float_equalities.p8:305 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_float_equalities.p8:307 verify_success(4) - lda #4 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:256 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:309 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_float_equalities.p8:310 float @shared x, value - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_equalities.p8:311 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:312 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:313 value=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_equalities.p8:315 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne p8l_lbl1a - ; source: test_float_equalities.p8:317 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:318 lbl1a: fail_float(9,0.0) -p8l_lbl1a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:319 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:321 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:322 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:324 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:325 lbl1b: fail_float(10,0.0) -p8l_lbl1b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:326 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:328 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq label_asm_27_afterif - ; source: test_float_equalities.p8:329 fail_float(11,0.0) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float -label_asm_27_afterif - ; source: test_float_equalities.p8:332 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq label_asm_29_else - ; source: test_float_equalities.p8:333 fail_float(12,0.0) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - bra label_asm_28_afterif -label_asm_29_else - ; source: test_float_equalities.p8:335 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_float_equalities.p8:337 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:338 value=1234.56 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_equalities.p8:340 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne p8l_lbl2a - ; source: test_float_equalities.p8:342 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:343 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:344 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:346 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:347 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:349 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:350 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:351 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:353 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq label_asm_30_afterif - ; source: test_float_equalities.p8:354 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_float_equalities.p8:357 if x==value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq label_asm_32_else - ; source: test_float_equalities.p8:358 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_float_equalities.p8:360 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_float_equalities.p8:362 verify_success(4) - lda #4 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:309 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:364 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_float_equalities.p8:365 float @shared x, value - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_equalities.p8:366 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:367 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:368 value=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_equalities.p8:370 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq p8l_lbl1a - ; source: test_float_equalities.p8:372 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:373 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:374 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:376 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:377 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:379 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:380 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:381 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:383 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne label_asm_33_afterif - ; source: test_float_equalities.p8:384 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_float_equalities.p8:387 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne label_asm_35_else - ; source: test_float_equalities.p8:388 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_float_equalities.p8:390 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_float_equalities.p8:392 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:393 value=1234.56 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_equalities.p8:395 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - beq p8l_lbl2a - ; source: test_float_equalities.p8:397 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:398 lbl2a: fail_float(13,1234.56) -p8l_lbl2a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:399 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:401 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:402 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:404 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:405 lbl2b: fail_float(14,1234.56) -p8l_lbl2b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:406 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:408 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne label_asm_36_afterif - ; source: test_float_equalities.p8:409 fail_float(15,1234.56) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float -label_asm_36_afterif - ; source: test_float_equalities.p8:412 if x!=value - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.vars_equal_f - bne label_asm_38_else - ; source: test_float_equalities.p8:413 fail_float(16,1234.56) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - bra label_asm_37_afterif -label_asm_38_else - ; source: test_float_equalities.p8:415 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_float_equalities.p8:417 verify_success(4) - lda #4 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:364 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:419 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_float_equalities.p8:420 float @shared x - ; source: test_float_equalities.p8:423 float @shared f4 = 1.0 - ; source: test_float_equalities.p8:424 float @shared f5 = 1.0 - ; source: test_float_equalities.p8:420 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:421 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_float_equalities.p8:422 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_float_equalities.p8:423 float @shared f4 = 1.0 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_float_equalities.p8:424 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_float_equalities.p8:425 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:426 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:428 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne p8l_lbl1a - ; source: test_float_equalities.p8:430 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:431 lbl1a: fail_float(17,0.0) -p8l_lbl1a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:432 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:434 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:435 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:437 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:438 lbl1b: fail_float(18,0.0) -p8l_lbl1b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:439 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:441 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_39_afterif - ; source: test_float_equalities.p8:442 fail_float(19,0.0) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float -label_asm_39_afterif - ; source: test_float_equalities.p8:445 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_41_else - ; source: test_float_equalities.p8:446 fail_float(20,0.0) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - bra label_asm_40_afterif -label_asm_41_else - ; source: test_float_equalities.p8:448 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_float_equalities.p8:450 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:452 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne p8l_lbl2a - ; source: test_float_equalities.p8:454 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:455 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:456 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:458 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:459 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:461 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:462 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:463 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:465 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_42_afterif - ; source: test_float_equalities.p8:466 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_float_equalities.p8:469 if x==f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_44_else - ; source: test_float_equalities.p8:470 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_float_equalities.p8:472 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_float_equalities.p8:474 verify_success(4) - lda #4 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:419 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:476 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_float_equalities.p8:477 float @shared x - ; source: test_float_equalities.p8:480 float @shared f4 = 1.0 - ; source: test_float_equalities.p8:481 float @shared f5 = 1.0 - ; source: test_float_equalities.p8:477 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:478 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_float_equalities.p8:479 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_float_equalities.p8:480 float @shared f4 = 1.0 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_float_equalities.p8:481 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_float_equalities.p8:482 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:483 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:485 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq p8l_lbl1a - ; source: test_float_equalities.p8:487 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:488 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:489 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:491 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:492 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:494 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:495 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:496 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:498 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_45_afterif - ; source: test_float_equalities.p8:499 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_float_equalities.p8:502 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_47_else - ; source: test_float_equalities.p8:503 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_float_equalities.p8:505 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_float_equalities.p8:507 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:509 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - beq p8l_lbl2a - ; source: test_float_equalities.p8:511 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:512 lbl2a: fail_float(21,1234.56) -p8l_lbl2a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:513 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:515 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:516 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:518 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:519 lbl2b: fail_float(22,1234.56) -p8l_lbl2b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:520 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:522 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_48_afterif - ; source: test_float_equalities.p8:523 fail_float(23,1234.56) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float -label_asm_48_afterif - ; source: test_float_equalities.p8:526 if x!=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_0 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_50_else - ; source: test_float_equalities.p8:527 fail_float(24,1234.56) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - bra label_asm_49_afterif -label_asm_50_else - ; source: test_float_equalities.p8:529 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_float_equalities.p8:531 verify_success(4) - lda #4 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:476 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_equalities.p8:533 sub test_is_array() { - -p8s_test_is_array .proc -; statements - ; source: test_float_equalities.p8:534 float @shared x - ; source: test_float_equalities.p8:535 float[] values = [0, 0] - ; source: test_float_equalities.p8:536 float[] sources = [0, 0] - ; source: test_float_equalities.p8:534 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:537 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:538 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:539 sources[1]=0.0 - lda #1 - ldy #p8v_sources - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_equalities.p8:540 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_equalities.p8:542 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne p8l_lbl1a - ; source: test_float_equalities.p8:544 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:545 lbl1a: fail_float(25,0.0) -p8l_lbl1a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:546 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:548 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:549 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:551 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:552 lbl1b: fail_float(26,0.0) -p8l_lbl1b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:553 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:555 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_51_afterif - ; source: test_float_equalities.p8:556 fail_float(27,0.0) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float -label_asm_51_afterif - ; source: test_float_equalities.p8:559 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_53_else - ; source: test_float_equalities.p8:560 fail_float(28,0.0) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - bra label_asm_52_afterif -label_asm_53_else - ; source: test_float_equalities.p8:562 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_float_equalities.p8:565 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne p8l_lbl1c - ; source: test_float_equalities.p8:567 goto skip1c - bra p8l_skip1c - ; source: test_float_equalities.p8:568 lbl1c: fail_float(29,0.0) -p8l_lbl1c - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:569 skip1c: -p8l_skip1c - ; source: test_float_equalities.p8:571 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:572 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:574 goto skip1d - bra p8l_skip1d - ; source: test_float_equalities.p8:575 lbl1d: fail_float(30,0.0) -p8l_lbl1d - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:576 skip1d: -p8l_skip1d - ; source: test_float_equalities.p8:578 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq label_asm_54_afterif - ; source: test_float_equalities.p8:579 fail_float(31,0.0) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float -label_asm_54_afterif - ; source: test_float_equalities.p8:582 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq label_asm_56_else - ; source: test_float_equalities.p8:583 fail_float(32,0.0) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - stz p8b_main.p8s_fail_float.p8v_v1 - stz p8b_main.p8s_fail_float.p8v_v1+1 - stz p8b_main.p8s_fail_float.p8v_v1+2 - stz p8b_main.p8s_fail_float.p8v_v1+3 - stz p8b_main.p8s_fail_float.p8v_v1+4 - - jsr p8b_main.p8s_fail_float - bra label_asm_55_afterif -label_asm_56_else - ; source: test_float_equalities.p8:585 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_float_equalities.p8:587 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:588 sources[1]=1234.56 - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_sources - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_equalities.p8:589 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_equalities.p8:591 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne p8l_lbl2a - ; source: test_float_equalities.p8:593 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:594 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:595 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:597 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:598 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:600 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:601 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:602 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:604 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_57_afterif - ; source: test_float_equalities.p8:605 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_float_equalities.p8:608 if x==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq label_asm_59_else - ; source: test_float_equalities.p8:609 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_float_equalities.p8:611 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_float_equalities.p8:614 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne p8l_lbl2c - ; source: test_float_equalities.p8:616 goto skip2c - bra p8l_skip2c - ; source: test_float_equalities.p8:617 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:618 skip2c: -p8l_skip2c - ; source: test_float_equalities.p8:620 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:621 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:623 goto skip2d - bra p8l_skip2d - ; source: test_float_equalities.p8:624 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:625 skip2d: -p8l_skip2d - ; source: test_float_equalities.p8:627 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq label_asm_60_afterif - ; source: test_float_equalities.p8:628 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_float_equalities.p8:631 if sources[1]==values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq label_asm_62_else - ; source: test_float_equalities.p8:632 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_float_equalities.p8:634 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_float_equalities.p8:636 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:533 sub test_is_array() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS -; non-zeropage variables -p8v_sources - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@23c767e6 - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@feb098f -p8v_values - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@19e21f89 - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@31e739bf - .pend - ; source: test_float_equalities.p8:638 sub test_not_array() { - -p8s_test_not_array .proc -; statements - ; source: test_float_equalities.p8:639 float @shared x - ; source: test_float_equalities.p8:640 float[] values = [0, 0] - ; source: test_float_equalities.p8:641 float[] sources = [0, 0] - ; source: test_float_equalities.p8:639 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:642 success = 0 - stz p8b_main.p8v_success - ; source: test_float_equalities.p8:643 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_equalities.p8:644 sources[1]=0.0 - lda #1 - ldy #p8v_sources - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_equalities.p8:645 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_equalities.p8:647 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq p8l_lbl1a - ; source: test_float_equalities.p8:649 goto skip1a - bra p8l_skip1a - ; source: test_float_equalities.p8:650 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:651 skip1a: -p8l_skip1a - ; source: test_float_equalities.p8:653 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:654 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:656 goto skip1b - bra p8l_skip1b - ; source: test_float_equalities.p8:657 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:658 skip1b: -p8l_skip1b - ; source: test_float_equalities.p8:660 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_63_afterif - ; source: test_float_equalities.p8:661 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_float_equalities.p8:664 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_65_else - ; source: test_float_equalities.p8:665 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_float_equalities.p8:667 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_float_equalities.p8:670 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq p8l_lbl1c - ; source: test_float_equalities.p8:672 goto skip1c - bra p8l_skip1c - ; source: test_float_equalities.p8:673 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:674 skip1c: -p8l_skip1c - ; source: test_float_equalities.p8:676 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:677 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:679 goto skip1d - bra p8l_skip1d - ; source: test_float_equalities.p8:680 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_float_equalities.p8:681 skip1d: -p8l_skip1d - ; source: test_float_equalities.p8:683 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne label_asm_66_afterif - ; source: test_float_equalities.p8:684 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_float_equalities.p8:687 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne label_asm_68_else - ; source: test_float_equalities.p8:688 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_float_equalities.p8:690 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_float_equalities.p8:692 x=1234.56 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_equalities.p8:693 sources[1]=1234.56 - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_sources - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_equalities.p8:694 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_0 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_equalities.p8:696 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - beq p8l_lbl2a - ; source: test_float_equalities.p8:698 goto skip2a - bra p8l_skip2a - ; source: test_float_equalities.p8:699 lbl2a: fail_float(33,1234.56) -p8l_lbl2a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:700 skip2a: -p8l_skip2a - ; source: test_float_equalities.p8:702 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:703 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:705 goto skip2b - bra p8l_skip2b - ; source: test_float_equalities.p8:706 lbl2b: fail_float(34,1234.56) -p8l_lbl2b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:707 skip2b: -p8l_skip2b - ; source: test_float_equalities.p8:709 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_69_afterif - ; source: test_float_equalities.p8:710 fail_float(35,1234.56) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float -label_asm_69_afterif - ; source: test_float_equalities.p8:713 if x!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - jsr floats.MOVFM - lda #p8v_x - jsr floats.var_fac1_equal_f - bne label_asm_71_else - ; source: test_float_equalities.p8:714 fail_float(36,1234.56) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - bra label_asm_70_afterif -label_asm_71_else - ; source: test_float_equalities.p8:716 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_float_equalities.p8:719 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - beq p8l_lbl2c - ; source: test_float_equalities.p8:721 goto skip2c - bra p8l_skip2c - ; source: test_float_equalities.p8:722 lbl2c: fail_float(37,1234.56) -p8l_lbl2c - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:723 skip2c: -p8l_skip2c - ; source: test_float_equalities.p8:725 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_equalities.p8:726 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_equalities.p8:728 goto skip2d - bra p8l_skip2d - ; source: test_float_equalities.p8:729 lbl2d: fail_float(38,1234.56) -p8l_lbl2d - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - ; source: test_float_equalities.p8:730 skip2d: -p8l_skip2d - ; source: test_float_equalities.p8:732 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne label_asm_72_afterif - ; source: test_float_equalities.p8:733 fail_float(39,1234.56) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float -label_asm_72_afterif - ; source: test_float_equalities.p8:736 if sources[1]!=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #<(p8v_sources+5) - ldy #>(p8v_sources+5) - jsr floats.MOVFM - lda #prog8_float_eval_result1 - jsr floats.var_fac1_equal_f - bne label_asm_74_else - ; source: test_float_equalities.p8:737 fail_float(40,1234.56) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_float.p8v_idx - sty p8b_main.p8s_fail_float.p8v_idx+1 - - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8b_main.p8s_fail_float.p8v_v1 - jsr floats.copy_float - jsr p8b_main.p8s_fail_float - bra label_asm_73_afterif -label_asm_74_else - ; source: test_float_equalities.p8:739 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_float_equalities.p8:741 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_float_equalities.p8:638 sub test_not_array() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS -; non-zeropage variables -p8v_sources - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@7e7743ec - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@776015fc -p8v_values - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@7f42e06e - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@6ad179b4 - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $44, $41, $54, $41, $54, $59, $50, $45 - .byte $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[]: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[]: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 - - ; source: test_float_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ; source: test_float_equalities.p8:18 txt.print("==0: ") - ; source: test_float_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_float_equalities.p8:22 txt.print("\n==number: ") - ; source: test_float_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_float_equalities.p8:26 txt.print("\n==var: ") - ; source: test_float_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_float_equalities.p8:30 txt.print("\n==array[]: ") - ; source: test_float_equalities.p8:32 txt.print("\n!=array[]: ") - ; source: test_float_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_float_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_float_equalities.p8:45 txt.print(" **failed** ") - ; source: test_float_equalities.p8:47 txt.print(" success, expected ") - ; source: test_float_equalities.p8:53 txt.print(" **fail#") - ; source: test_float_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $8b, $1a, $51, $eb, $85 ; float 1234.56 -prog8_float_const_1 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_float_equalities.p8 b/compiler/test/comparisons/test_float_equalities.p8 deleted file mode 100644 index ff9a6823d..000000000 --- a/compiler/test/comparisons/test_float_equalities.p8 +++ /dev/null @@ -1,745 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "float" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[]: ") - test_is_array() - txt.print("\n!=array[]: ") - test_not_array() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx, byte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_b(v1) - txt.print(" **") - } - - sub fail_ubyte(uword idx, ubyte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_ub(v1) - txt.print(" **") - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - sub fail_float(uword idx, float v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - floats.print(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - float @shared x - success = 0 - - x=0.0 - ; direct jump - if x==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x==0 - success++ - - ; with else - if x==0 - success++ - else - cx16.r0L++ - - x = 1234.56 - ; direct jump - if x==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x==0 - success-- - - ; with else - if x==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - float @shared x - success = 0 - - x=1234.56 - ; direct jump - if x!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x!=0 - success++ - - ; with else - if x!=0 - success++ - else - cx16.r0L++ - - x = 0.0 - ; direct jump - if x!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x!=0 - success-- - - ; with else - if x!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - float @shared x - success = 0 - x=0.0 - ; direct jump - if x==1234.56 - goto lbl1a - goto skip1a -lbl1a: fail_float(1,0.0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==1234.56 - goto cx16.r3 - goto skip1b -lbl1b: fail_float(2,0.0) -skip1b: - ; no else - if x==1234.56 - fail_float(3,0.0) - - ; with else - if x==1234.56 - fail_float(4,0.0) - else - cx16.r0L++ - - x=1234.56 - ; direct jump - if x==1234.56 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==1234.56 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x==1234.56 - success++ - - ; with else - if x==1234.56 - success++ - else - cx16.r0L++ - - verify_success(4) -} - sub test_not_number() { - float @shared x - success = 0 - x=0.0 - ; direct jump - if x!=1234.56 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=1234.56 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=1234.56 - success++ - - ; with else - if x!=1234.56 - success++ - else - cx16.r0L++ - - x=1234.56 - ; direct jump - if x!=1234.56 - goto lbl2a - goto skip2a -lbl2a: fail_float(5,1234.56) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=1234.56 - goto cx16.r3 - goto skip2b -lbl2b: fail_float(6,1234.56) -skip2b: - ; no else - if x!=1234.56 - fail_float(7,1234.56) - - ; with else - if x!=1234.56 - fail_float(8,1234.56) - else - cx16.r0L++ - - verify_success(4) -} - sub test_is_var() { - float @shared x, value - success = 0 - x=0.0 - value=1234.56 - ; direct jump - if x==value - goto lbl1a - goto skip1a -lbl1a: fail_float(9,0.0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==value - goto cx16.r3 - goto skip1b -lbl1b: fail_float(10,0.0) -skip1b: - ; no else - if x==value - fail_float(11,0.0) - - ; with else - if x==value - fail_float(12,0.0) - else - cx16.r0L++ - - x=1234.56 - value=1234.56 - ; direct jump - if x==value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - verify_success(4) -} - sub test_not_var() { - float @shared x, value - success = 0 - x=0.0 - value=1234.56 - ; direct jump - if x!=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=1234.56 - value=1234.56 - ; direct jump - if x!=value - goto lbl2a - goto skip2a -lbl2a: fail_float(13,1234.56) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=value - goto cx16.r3 - goto skip2b -lbl2b: fail_float(14,1234.56) -skip2b: - ; no else - if x!=value - fail_float(15,1234.56) - - ; with else - if x!=value - fail_float(16,1234.56) - else - cx16.r0L++ - - verify_success(4) -} - sub test_is_expr() { - float @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0.0 - ; direct jump - if x==f4+1234.56-f5 - goto lbl1a - goto skip1a -lbl1a: fail_float(17,0.0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==f4+1234.56-f5 - goto cx16.r3 - goto skip1b -lbl1b: fail_float(18,0.0) -skip1b: - ; no else - if x==f4+1234.56-f5 - fail_float(19,0.0) - - ; with else - if x==f4+1234.56-f5 - fail_float(20,0.0) - else - cx16.r0L++ - - x=1234.56 - ; direct jump - if x==f4+1234.56-f5 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==f4+1234.56-f5 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x==f4+1234.56-f5 - success++ - - ; with else - if x==f4+1234.56-f5 - success++ - else - cx16.r0L++ - - verify_success(4) -} - sub test_not_expr() { - float @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0.0 - ; direct jump - if x!=f4+1234.56-f5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=f4+1234.56-f5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=f4+1234.56-f5 - success++ - - ; with else - if x!=f4+1234.56-f5 - success++ - else - cx16.r0L++ - - x=1234.56 - ; direct jump - if x!=f4+1234.56-f5 - goto lbl2a - goto skip2a -lbl2a: fail_float(21,1234.56) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=f4+1234.56-f5 - goto cx16.r3 - goto skip2b -lbl2b: fail_float(22,1234.56) -skip2b: - ; no else - if x!=f4+1234.56-f5 - fail_float(23,1234.56) - - ; with else - if x!=f4+1234.56-f5 - fail_float(24,1234.56) - else - cx16.r0L++ - - verify_success(4) -} - sub test_is_array() { - float @shared x - float[] values = [0, 0] - float[] sources = [0, 0] - success = 0 - x=0.0 - sources[1]=0.0 - values[1]=1234.56 - ; direct jump - if x==values[1] - goto lbl1a - goto skip1a -lbl1a: fail_float(25,0.0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_float(26,0.0) -skip1b: - ; no else - if x==values[1] - fail_float(27,0.0) - - ; with else - if x==values[1] - fail_float(28,0.0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: fail_float(29,0.0) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_float(30,0.0) -skip1d: - ; no else - if sources[1]==values[1] - fail_float(31,0.0) - - ; with else - if sources[1]==values[1] - fail_float(32,0.0) - else - cx16.r0L++ - - x=1234.56 - sources[1]=1234.56 - values[1]=1234.56 - ; direct jump - if x==values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_array() { - float @shared x - float[] values = [0, 0] - float[] sources = [0, 0] - success = 0 - x=0.0 - sources[1]=0.0 - values[1]=1234.56 - ; direct jump - if x!=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=1234.56 - sources[1]=1234.56 - values[1]=1234.56 - ; direct jump - if x!=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_float(33,1234.56) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_float(34,1234.56) -skip2b: - ; no else - if x!=values[1] - fail_float(35,1234.56) - - ; with else - if x!=values[1] - fail_float(36,1234.56) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: fail_float(37,1234.56) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_float(38,1234.56) -skip2d: - ; no else - if sources[1]!=values[1] - fail_float(39,1234.56) - - ; with else - if sources[1]!=values[1] - fail_float(40,1234.56) - else - cx16.r0L++ - - verify_success(8) -} - -} - diff --git a/compiler/test/comparisons/test_float_gt.asm b/compiler/test/comparisons/test_float_gt.asm deleted file mode 100644 index 307d053cf..000000000 --- a/compiler/test/comparisons/test_float_gt.asm +++ /dev/null @@ -1,8831 +0,0 @@ -; w65c02 assembly code for 'test_float_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_float_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"float" - .byte $46, $4c, $4f, $41, $54, $00 - - ; source: test_float_gt.p8:9 ubyte success = 0 - ; source: test_float_gt.p8:10 str datatype = "float" - ; source: test_float_gt.p8:11 uword @shared comparison - ; source: test_float_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_float_gt.p8:14 txt.print("\ngreater-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #number: ") - ldy #>prog8_interned_strings.string_2 - lda #var: ") - ldy #>prog8_interned_strings.string_3 - lda #array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl1a - ; source: test_float_gt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_float_gt.p8:79 lbl1a: fail_float(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:80 skip1a: -p8l_skip1a - ; source: test_float_gt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:83 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_float_gt.p8:86 lbl1b: fail_float(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:87 skip1b: -p8l_skip1b - ; source: test_float_gt.p8:89 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_3_afterif - ; source: test_float_gt.p8:90 fail_float(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_float -label_asm_3_afterif - ; source: test_float_gt.p8:93 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_5_else - ; source: test_float_gt.p8:94 fail_float(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_float - bra label_asm_4_afterif -label_asm_5_else - ; source: test_float_gt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_float_gt.p8:99 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl2a - ; source: test_float_gt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_float_gt.p8:102 lbl2a: fail_float(5) -p8l_lbl2a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:103 skip2a: -p8l_skip2a - ; source: test_float_gt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:106 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_float_gt.p8:109 lbl2b: fail_float(6) -p8l_lbl2b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:110 skip2b: -p8l_skip2b - ; source: test_float_gt.p8:112 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_6_afterif - ; source: test_float_gt.p8:113 fail_float(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_float -label_asm_6_afterif - ; source: test_float_gt.p8:116 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_8_else - ; source: test_float_gt.p8:117 fail_float(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_float - bra label_asm_7_afterif -label_asm_8_else - ; source: test_float_gt.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_float_gt.p8:121 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gt.p8:123 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl3a - ; source: test_float_gt.p8:125 goto skip3a - bra p8l_skip3a - ; source: test_float_gt.p8:126 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gt.p8:127 skip3a: -p8l_skip3a - ; source: test_float_gt.p8:129 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:130 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:132 goto skip3b - bra p8l_skip3b - ; source: test_float_gt.p8:133 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gt.p8:134 skip3b: -p8l_skip3b - ; source: test_float_gt.p8:136 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_9_afterif - ; source: test_float_gt.p8:137 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_float_gt.p8:140 if x>0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_11_else - ; source: test_float_gt.p8:141 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_float_gt.p8:143 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_float_gt.p8:146 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl4a - ; source: test_float_gt.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_float_gt.p8:149 lbl4a: fail_float(9) -p8l_lbl4a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:150 skip4a: -p8l_skip4a - ; source: test_float_gt.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:153 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_float_gt.p8:156 lbl4b: fail_float(10) -p8l_lbl4b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:157 skip4b: -p8l_skip4b - ; source: test_float_gt.p8:159 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_12_afterif - ; source: test_float_gt.p8:160 fail_float(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_float -label_asm_12_afterif - ; source: test_float_gt.p8:163 if x>1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_14_else - ; source: test_float_gt.p8:164 fail_float(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_float - bra label_asm_13_afterif -label_asm_14_else - ; source: test_float_gt.p8:166 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_float_gt.p8:168 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_gt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_gt.p8:170 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_float_gt.p8:171 float @shared x, value - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_gt.p8:172 success = 0 - stz p8b_main.p8v_success - ; source: test_float_gt.p8:173 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gt.p8:174 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_gt.p8:176 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl1a - ; source: test_float_gt.p8:178 goto skip1a - bra p8l_skip1a - ; source: test_float_gt.p8:179 lbl1a: fail_float(13) -p8l_lbl1a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:180 skip1a: -p8l_skip1a - ; source: test_float_gt.p8:182 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:183 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:185 goto skip1b - bra p8l_skip1b - ; source: test_float_gt.p8:186 lbl1b: fail_float(14) -p8l_lbl1b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:187 skip1b: -p8l_skip1b - ; source: test_float_gt.p8:189 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_15_afterif - ; source: test_float_gt.p8:190 fail_float(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_float -label_asm_15_afterif - ; source: test_float_gt.p8:193 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_17_else - ; source: test_float_gt.p8:194 fail_float(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_float - bra label_asm_16_afterif -label_asm_17_else - ; source: test_float_gt.p8:196 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_float_gt.p8:198 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_gt.p8:200 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl2a - ; source: test_float_gt.p8:202 goto skip2a - bra p8l_skip2a - ; source: test_float_gt.p8:203 lbl2a: fail_float(17) -p8l_lbl2a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:204 skip2a: -p8l_skip2a - ; source: test_float_gt.p8:206 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:207 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:209 goto skip2b - bra p8l_skip2b - ; source: test_float_gt.p8:210 lbl2b: fail_float(18) -p8l_lbl2b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:211 skip2b: -p8l_skip2b - ; source: test_float_gt.p8:213 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_18_afterif - ; source: test_float_gt.p8:214 fail_float(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_float -label_asm_18_afterif - ; source: test_float_gt.p8:217 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_20_else - ; source: test_float_gt.p8:218 fail_float(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_float - bra label_asm_19_afterif -label_asm_20_else - ; source: test_float_gt.p8:220 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_float_gt.p8:222 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gt.p8:223 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_gt.p8:225 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl3a - ; source: test_float_gt.p8:227 goto skip3a - bra p8l_skip3a - ; source: test_float_gt.p8:228 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gt.p8:229 skip3a: -p8l_skip3a - ; source: test_float_gt.p8:231 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:232 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:234 goto skip3b - bra p8l_skip3b - ; source: test_float_gt.p8:235 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gt.p8:236 skip3b: -p8l_skip3b - ; source: test_float_gt.p8:238 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_21_afterif - ; source: test_float_gt.p8:239 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_float_gt.p8:242 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_23_else - ; source: test_float_gt.p8:243 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_float_gt.p8:245 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_float_gt.p8:247 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_gt.p8:249 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl4a - ; source: test_float_gt.p8:251 goto skip4a - bra p8l_skip4a - ; source: test_float_gt.p8:252 lbl4a: fail_float(21) -p8l_lbl4a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:253 skip4a: -p8l_skip4a - ; source: test_float_gt.p8:255 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:256 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:258 goto skip4b - bra p8l_skip4b - ; source: test_float_gt.p8:259 lbl4b: fail_float(22) -p8l_lbl4b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:260 skip4b: -p8l_skip4b - ; source: test_float_gt.p8:262 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_24_afterif - ; source: test_float_gt.p8:263 fail_float(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_float -label_asm_24_afterif - ; source: test_float_gt.p8:266 if x>value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_26_else - ; source: test_float_gt.p8:267 fail_float(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_float - bra label_asm_25_afterif -label_asm_26_else - ; source: test_float_gt.p8:269 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_float_gt.p8:271 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_gt.p8:170 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_gt.p8:273 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_float_gt.p8:274 float @shared x - ; source: test_float_gt.p8:275 float[] values = [0, 0] - ; source: test_float_gt.p8:274 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gt.p8:276 success = 0 - stz p8b_main.p8v_success - ; source: test_float_gt.p8:277 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gt.p8:278 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_gt.p8:280 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl1a - ; source: test_float_gt.p8:282 goto skip1a - bra p8l_skip1a - ; source: test_float_gt.p8:283 lbl1a: fail_float(25) -p8l_lbl1a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:284 skip1a: -p8l_skip1a - ; source: test_float_gt.p8:286 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:287 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:289 goto skip1b - bra p8l_skip1b - ; source: test_float_gt.p8:290 lbl1b: fail_float(26) -p8l_lbl1b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:291 skip1b: -p8l_skip1b - ; source: test_float_gt.p8:293 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_27_afterif - ; source: test_float_gt.p8:294 fail_float(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_float -label_asm_27_afterif - ; source: test_float_gt.p8:297 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_29_else - ; source: test_float_gt.p8:298 fail_float(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_float - bra label_asm_28_afterif -label_asm_29_else - ; source: test_float_gt.p8:300 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_float_gt.p8:302 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_gt.p8:304 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl2a - ; source: test_float_gt.p8:306 goto skip2a - bra p8l_skip2a - ; source: test_float_gt.p8:307 lbl2a: fail_float(29) -p8l_lbl2a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:308 skip2a: -p8l_skip2a - ; source: test_float_gt.p8:310 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:311 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:313 goto skip2b - bra p8l_skip2b - ; source: test_float_gt.p8:314 lbl2b: fail_float(30) -p8l_lbl2b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:315 skip2b: -p8l_skip2b - ; source: test_float_gt.p8:317 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_30_afterif - ; source: test_float_gt.p8:318 fail_float(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_float -label_asm_30_afterif - ; source: test_float_gt.p8:321 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_32_else - ; source: test_float_gt.p8:322 fail_float(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_float - bra label_asm_31_afterif -label_asm_32_else - ; source: test_float_gt.p8:324 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_float_gt.p8:326 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gt.p8:327 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_gt.p8:329 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl3a - ; source: test_float_gt.p8:331 goto skip3a - bra p8l_skip3a - ; source: test_float_gt.p8:332 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gt.p8:333 skip3a: -p8l_skip3a - ; source: test_float_gt.p8:335 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:336 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:338 goto skip3b - bra p8l_skip3b - ; source: test_float_gt.p8:339 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gt.p8:340 skip3b: -p8l_skip3b - ; source: test_float_gt.p8:342 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_33_afterif - ; source: test_float_gt.p8:343 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_float_gt.p8:346 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_35_else - ; source: test_float_gt.p8:347 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_float_gt.p8:349 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_float_gt.p8:351 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_gt.p8:353 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl4a - ; source: test_float_gt.p8:355 goto skip4a - bra p8l_skip4a - ; source: test_float_gt.p8:356 lbl4a: fail_float(33) -p8l_lbl4a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:357 skip4a: -p8l_skip4a - ; source: test_float_gt.p8:359 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:360 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:362 goto skip4b - bra p8l_skip4b - ; source: test_float_gt.p8:363 lbl4b: fail_float(34) -p8l_lbl4b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:364 skip4b: -p8l_skip4b - ; source: test_float_gt.p8:366 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_36_afterif - ; source: test_float_gt.p8:367 fail_float(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_float -label_asm_36_afterif - ; source: test_float_gt.p8:370 if x>values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_38_else - ; source: test_float_gt.p8:371 fail_float(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_float - bra label_asm_37_afterif -label_asm_38_else - ; source: test_float_gt.p8:373 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_float_gt.p8:375 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_gt.p8:273 sub test_cmp_array() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS -; non-zeropage variables -p8v_values - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@587c5c1 - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@528c8c1 - .pend - ; source: test_float_gt.p8:377 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_float_gt.p8:378 float @shared x - ; source: test_float_gt.p8:381 float @shared f4 = 1.0 - ; source: test_float_gt.p8:382 float @shared f5 = 1.0 - ; source: test_float_gt.p8:378 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gt.p8:379 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_float_gt.p8:380 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_float_gt.p8:381 float @shared f4 = 1.0 - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_float_gt.p8:382 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_float_gt.p8:383 success = 0 - stz p8b_main.p8v_success - ; source: test_float_gt.p8:384 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gt.p8:386 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl1a - ; source: test_float_gt.p8:388 goto skip1a - bra p8l_skip1a - ; source: test_float_gt.p8:389 lbl1a: fail_float(37) -p8l_lbl1a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:390 skip1a: -p8l_skip1a - ; source: test_float_gt.p8:392 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:393 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:395 goto skip1b - bra p8l_skip1b - ; source: test_float_gt.p8:396 lbl1b: fail_float(38) -p8l_lbl1b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:397 skip1b: -p8l_skip1b - ; source: test_float_gt.p8:399 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_39_afterif - ; source: test_float_gt.p8:400 fail_float(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_float -label_asm_39_afterif - ; source: test_float_gt.p8:403 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_41_else - ; source: test_float_gt.p8:404 fail_float(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_float - bra label_asm_40_afterif -label_asm_41_else - ; source: test_float_gt.p8:406 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_float_gt.p8:409 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl2a - ; source: test_float_gt.p8:411 goto skip2a - bra p8l_skip2a - ; source: test_float_gt.p8:412 lbl2a: fail_float(41) -p8l_lbl2a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:413 skip2a: -p8l_skip2a - ; source: test_float_gt.p8:415 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:416 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:418 goto skip2b - bra p8l_skip2b - ; source: test_float_gt.p8:419 lbl2b: fail_float(42) -p8l_lbl2b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:420 skip2b: -p8l_skip2b - ; source: test_float_gt.p8:422 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_42_afterif - ; source: test_float_gt.p8:423 fail_float(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_float -label_asm_42_afterif - ; source: test_float_gt.p8:426 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_44_else - ; source: test_float_gt.p8:427 fail_float(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_float - bra label_asm_43_afterif -label_asm_44_else - ; source: test_float_gt.p8:429 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_float_gt.p8:431 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gt.p8:433 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl3a - ; source: test_float_gt.p8:435 goto skip3a - bra p8l_skip3a - ; source: test_float_gt.p8:436 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gt.p8:437 skip3a: -p8l_skip3a - ; source: test_float_gt.p8:439 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:440 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:442 goto skip3b - bra p8l_skip3b - ; source: test_float_gt.p8:443 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gt.p8:444 skip3b: -p8l_skip3b - ; source: test_float_gt.p8:446 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_45_afterif - ; source: test_float_gt.p8:447 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_float_gt.p8:450 if x>f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_47_else - ; source: test_float_gt.p8:451 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_float_gt.p8:453 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_float_gt.p8:456 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq p8l_lbl4a - ; source: test_float_gt.p8:458 goto skip4a - bra p8l_skip4a - ; source: test_float_gt.p8:459 lbl4a: fail_float(45) -p8l_lbl4a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:460 skip4a: -p8l_skip4a - ; source: test_float_gt.p8:462 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gt.p8:463 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gt.p8:465 goto skip4b - bra p8l_skip4b - ; source: test_float_gt.p8:466 lbl4b: fail_float(46) -p8l_lbl4b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_float - ; source: test_float_gt.p8:467 skip4b: -p8l_skip4b - ; source: test_float_gt.p8:469 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_48_afterif - ; source: test_float_gt.p8:470 fail_float(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_float -label_asm_48_afterif - ; source: test_float_gt.p8:473 if x>f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne label_asm_50_else - ; source: test_float_gt.p8:474 fail_float(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_float - bra label_asm_49_afterif -label_asm_50_else - ; source: test_float_gt.p8:476 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_float_gt.p8:478 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_gt.p8:377 sub test_cmp_expr() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .fill 5 - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>number: " - .byte $0d, $3e, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>var: " - .byte $0d, $3e, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>expr: " - .byte $0d, $3e, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_float_gt.p8:14 txt.print("\ngreater-than tests for: ") - ; source: test_float_gt.p8:18 txt.print("\n>number: ") - ; source: test_float_gt.p8:20 txt.print("\n>var: ") - ; source: test_float_gt.p8:22 txt.print("\n>array[]: ") - ; source: test_float_gt.p8:24 txt.print("\n>expr: ") - ; source: test_float_gt.p8:33 txt.print(" **failed** ") - ; source: test_float_gt.p8:35 txt.print(" success, expected ") - ; source: test_float_gt.p8:41 txt.print(" **fail#") - ; source: test_float_gt.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $00, $00, $00, $00, $00 ; float 0.0 -prog8_float_const_1 .byte $8b, $1a, $51, $eb, $85 ; float 1234.56 -prog8_float_const_2 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_float_gt.p8 b/compiler/test/comparisons/test_float_gt.p8 deleted file mode 100644 index c9a25d0b4..000000000 --- a/compiler/test/comparisons/test_float_gt.p8 +++ /dev/null @@ -1,482 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "float" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>number: ") - test_cmp_number() - txt.print("\n>var: ") - test_cmp_var() - txt.print("\n>array[]: ") - test_cmp_array() - txt.print("\n>expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - float @shared x - success = 0 - x=0.0 - ; direct jump - if x>0.0 - goto lbl1a - goto skip1a -lbl1a: fail_float(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>0.0 - goto cx16.r3 - goto skip1b -lbl1b: fail_float(2) -skip1b: - ; no else - if x>0.0 - fail_float(3) - - ; with else - if x>0.0 - fail_float(4) - else - success++ - - ; direct jump - if x>1234.56 - goto lbl2a - goto skip2a -lbl2a: fail_float(5) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>1234.56 - goto cx16.r3 - goto skip2b -lbl2b: fail_float(6) -skip2b: - ; no else - if x>1234.56 - fail_float(7) - - ; with else - if x>1234.56 - fail_float(8) - else - success++ - - x=1234.56 - ; direct jump - if x>0.0 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>0.0 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>0.0 - success++ - - ; with else - if x>0.0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1234.56 - goto lbl4a - goto skip4a -lbl4a: fail_float(9) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>1234.56 - goto cx16.r3 - goto skip4b -lbl4b: fail_float(10) -skip4b: - ; no else - if x>1234.56 - fail_float(11) - - ; with else - if x>1234.56 - fail_float(12) - else - success++ - - verify_success(7) -} - sub test_cmp_var() { - float @shared x, value - success = 0 - x=0.0 - value=0.0 - ; direct jump - if x>value - goto lbl1a - goto skip1a -lbl1a: fail_float(13) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>value - goto cx16.r3 - goto skip1b -lbl1b: fail_float(14) -skip1b: - ; no else - if x>value - fail_float(15) - - ; with else - if x>value - fail_float(16) - else - success++ - - value=1234.56 - ; direct jump - if x>value - goto lbl2a - goto skip2a -lbl2a: fail_float(17) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>value - goto cx16.r3 - goto skip2b -lbl2b: fail_float(18) -skip2b: - ; no else - if x>value - fail_float(19) - - ; with else - if x>value - fail_float(20) - else - success++ - - x=1234.56 - value=0.0 - ; direct jump - if x>value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1234.56 - ; direct jump - if x>value - goto lbl4a - goto skip4a -lbl4a: fail_float(21) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>value - goto cx16.r3 - goto skip4b -lbl4b: fail_float(22) -skip4b: - ; no else - if x>value - fail_float(23) - - ; with else - if x>value - fail_float(24) - else - success++ - - verify_success(7) -} - sub test_cmp_array() { - float @shared x - float[] values = [0, 0] - success = 0 - x=0.0 - values[1]=0.0 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_float(25) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_float(26) -skip1b: - ; no else - if x>values[1] - fail_float(27) - - ; with else - if x>values[1] - fail_float(28) - else - success++ - - values[1]=1234.56 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_float(29) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_float(30) -skip2b: - ; no else - if x>values[1] - fail_float(31) - - ; with else - if x>values[1] - fail_float(32) - else - success++ - - x=1234.56 - values[1]=0.0 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1234.56 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: fail_float(33) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_float(34) -skip4b: - ; no else - if x>values[1] - fail_float(35) - - ; with else - if x>values[1] - fail_float(36) - else - success++ - - verify_success(7) -} - sub test_cmp_expr() { - float @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0.0 - ; direct jump - if x>f4+0.0-f5 - goto lbl1a - goto skip1a -lbl1a: fail_float(37) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>f4+0.0-f5 - goto cx16.r3 - goto skip1b -lbl1b: fail_float(38) -skip1b: - ; no else - if x>f4+0.0-f5 - fail_float(39) - - ; with else - if x>f4+0.0-f5 - fail_float(40) - else - success++ - - ; direct jump - if x>f4+1234.56-f5 - goto lbl2a - goto skip2a -lbl2a: fail_float(41) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>f4+1234.56-f5 - goto cx16.r3 - goto skip2b -lbl2b: fail_float(42) -skip2b: - ; no else - if x>f4+1234.56-f5 - fail_float(43) - - ; with else - if x>f4+1234.56-f5 - fail_float(44) - else - success++ - - x=1234.56 - ; direct jump - if x>f4+0.0-f5 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>f4+0.0-f5 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>f4+0.0-f5 - success++ - - ; with else - if x>f4+0.0-f5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>f4+1234.56-f5 - goto lbl4a - goto skip4a -lbl4a: fail_float(45) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>f4+1234.56-f5 - goto cx16.r3 - goto skip4b -lbl4b: fail_float(46) -skip4b: - ; no else - if x>f4+1234.56-f5 - fail_float(47) - - ; with else - if x>f4+1234.56-f5 - fail_float(48) - else - success++ - - verify_success(7) -} - -} - diff --git a/compiler/test/comparisons/test_float_gte.asm b/compiler/test/comparisons/test_float_gte.asm deleted file mode 100644 index 4cc180f61..000000000 --- a/compiler/test/comparisons/test_float_gte.asm +++ /dev/null @@ -1,8767 +0,0 @@ -; w65c02 assembly code for 'test_float_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_float_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"float" - .byte $46, $4c, $4f, $41, $54, $00 - - ; source: test_float_gte.p8:9 ubyte success = 0 - ; source: test_float_gte.p8:10 str datatype = "float" - ; source: test_float_gte.p8:11 uword @shared comparison - ; source: test_float_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_float_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=number: ") - ldy #>prog8_interned_strings.string_2 - lda #=var: ") - ldy #>prog8_interned_strings.string_3 - lda #=array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #=expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl1a - ; source: test_float_gte.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_float_gte.p8:79 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:80 skip1a: -p8l_skip1a - ; source: test_float_gte.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:83 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_float_gte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:87 skip1b: -p8l_skip1b - ; source: test_float_gte.p8:89 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_3_afterif - ; source: test_float_gte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_float_gte.p8:93 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_5_else - ; source: test_float_gte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_float_gte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_float_gte.p8:99 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl2a - ; source: test_float_gte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_float_gte.p8:102 lbl2a: fail_float(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:103 skip2a: -p8l_skip2a - ; source: test_float_gte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:106 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_float_gte.p8:109 lbl2b: fail_float(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:110 skip2b: -p8l_skip2b - ; source: test_float_gte.p8:112 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_6_afterif - ; source: test_float_gte.p8:113 fail_float(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_float -label_asm_6_afterif - ; source: test_float_gte.p8:116 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_8_else - ; source: test_float_gte.p8:117 fail_float(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_float - bra label_asm_7_afterif -label_asm_8_else - ; source: test_float_gte.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_float_gte.p8:121 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gte.p8:123 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl3a - ; source: test_float_gte.p8:125 goto skip3a - bra p8l_skip3a - ; source: test_float_gte.p8:126 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:127 skip3a: -p8l_skip3a - ; source: test_float_gte.p8:129 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:130 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:132 goto skip3b - bra p8l_skip3b - ; source: test_float_gte.p8:133 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:134 skip3b: -p8l_skip3b - ; source: test_float_gte.p8:136 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_9_afterif - ; source: test_float_gte.p8:137 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_float_gte.p8:140 if x>=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_11_else - ; source: test_float_gte.p8:141 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_float_gte.p8:143 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_float_gte.p8:146 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl4a - ; source: test_float_gte.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_float_gte.p8:149 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:150 skip4a: -p8l_skip4a - ; source: test_float_gte.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:153 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_float_gte.p8:156 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:157 skip4b: -p8l_skip4b - ; source: test_float_gte.p8:159 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_12_afterif - ; source: test_float_gte.p8:160 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_float_gte.p8:163 if x>=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_14_else - ; source: test_float_gte.p8:164 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_float_gte.p8:166 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_float_gte.p8:168 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_gte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_gte.p8:170 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_float_gte.p8:171 float @shared x, value - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_gte.p8:172 success = 0 - stz p8b_main.p8v_success - ; source: test_float_gte.p8:173 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gte.p8:174 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_gte.p8:176 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl1a - ; source: test_float_gte.p8:178 goto skip1a - bra p8l_skip1a - ; source: test_float_gte.p8:179 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:180 skip1a: -p8l_skip1a - ; source: test_float_gte.p8:182 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:183 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:185 goto skip1b - bra p8l_skip1b - ; source: test_float_gte.p8:186 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:187 skip1b: -p8l_skip1b - ; source: test_float_gte.p8:189 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_15_afterif - ; source: test_float_gte.p8:190 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_float_gte.p8:193 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_17_else - ; source: test_float_gte.p8:194 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_float_gte.p8:196 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_float_gte.p8:198 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_gte.p8:200 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl2a - ; source: test_float_gte.p8:202 goto skip2a - bra p8l_skip2a - ; source: test_float_gte.p8:203 lbl2a: fail_float(5) -p8l_lbl2a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:204 skip2a: -p8l_skip2a - ; source: test_float_gte.p8:206 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:207 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:209 goto skip2b - bra p8l_skip2b - ; source: test_float_gte.p8:210 lbl2b: fail_float(6) -p8l_lbl2b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:211 skip2b: -p8l_skip2b - ; source: test_float_gte.p8:213 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_18_afterif - ; source: test_float_gte.p8:214 fail_float(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_float -label_asm_18_afterif - ; source: test_float_gte.p8:217 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_20_else - ; source: test_float_gte.p8:218 fail_float(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_float - bra label_asm_19_afterif -label_asm_20_else - ; source: test_float_gte.p8:220 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_float_gte.p8:222 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gte.p8:223 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_gte.p8:225 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl3a - ; source: test_float_gte.p8:227 goto skip3a - bra p8l_skip3a - ; source: test_float_gte.p8:228 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:229 skip3a: -p8l_skip3a - ; source: test_float_gte.p8:231 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:232 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:234 goto skip3b - bra p8l_skip3b - ; source: test_float_gte.p8:235 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:236 skip3b: -p8l_skip3b - ; source: test_float_gte.p8:238 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_21_afterif - ; source: test_float_gte.p8:239 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_float_gte.p8:242 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_23_else - ; source: test_float_gte.p8:243 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_float_gte.p8:245 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_float_gte.p8:247 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_gte.p8:249 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl4a - ; source: test_float_gte.p8:251 goto skip4a - bra p8l_skip4a - ; source: test_float_gte.p8:252 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:253 skip4a: -p8l_skip4a - ; source: test_float_gte.p8:255 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:256 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:258 goto skip4b - bra p8l_skip4b - ; source: test_float_gte.p8:259 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:260 skip4b: -p8l_skip4b - ; source: test_float_gte.p8:262 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_24_afterif - ; source: test_float_gte.p8:263 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_float_gte.p8:266 if x>=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_26_else - ; source: test_float_gte.p8:267 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_float_gte.p8:269 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_float_gte.p8:271 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_gte.p8:170 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_gte.p8:273 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_float_gte.p8:274 float @shared x - ; source: test_float_gte.p8:275 float[] values = [0, 0] - ; source: test_float_gte.p8:274 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gte.p8:276 success = 0 - stz p8b_main.p8v_success - ; source: test_float_gte.p8:277 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gte.p8:278 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_gte.p8:280 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl1a - ; source: test_float_gte.p8:282 goto skip1a - bra p8l_skip1a - ; source: test_float_gte.p8:283 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:284 skip1a: -p8l_skip1a - ; source: test_float_gte.p8:286 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:287 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:289 goto skip1b - bra p8l_skip1b - ; source: test_float_gte.p8:290 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:291 skip1b: -p8l_skip1b - ; source: test_float_gte.p8:293 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_27_afterif - ; source: test_float_gte.p8:294 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_float_gte.p8:297 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_29_else - ; source: test_float_gte.p8:298 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_float_gte.p8:300 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_float_gte.p8:302 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_gte.p8:304 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl2a - ; source: test_float_gte.p8:306 goto skip2a - bra p8l_skip2a - ; source: test_float_gte.p8:307 lbl2a: fail_float(9) -p8l_lbl2a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:308 skip2a: -p8l_skip2a - ; source: test_float_gte.p8:310 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:311 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:313 goto skip2b - bra p8l_skip2b - ; source: test_float_gte.p8:314 lbl2b: fail_float(10) -p8l_lbl2b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:315 skip2b: -p8l_skip2b - ; source: test_float_gte.p8:317 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_30_afterif - ; source: test_float_gte.p8:318 fail_float(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_float -label_asm_30_afterif - ; source: test_float_gte.p8:321 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_32_else - ; source: test_float_gte.p8:322 fail_float(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_float - bra label_asm_31_afterif -label_asm_32_else - ; source: test_float_gte.p8:324 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_float_gte.p8:326 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gte.p8:327 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_gte.p8:329 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl3a - ; source: test_float_gte.p8:331 goto skip3a - bra p8l_skip3a - ; source: test_float_gte.p8:332 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:333 skip3a: -p8l_skip3a - ; source: test_float_gte.p8:335 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:336 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:338 goto skip3b - bra p8l_skip3b - ; source: test_float_gte.p8:339 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:340 skip3b: -p8l_skip3b - ; source: test_float_gte.p8:342 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_33_afterif - ; source: test_float_gte.p8:343 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_float_gte.p8:346 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_35_else - ; source: test_float_gte.p8:347 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_float_gte.p8:349 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_float_gte.p8:351 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_gte.p8:353 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl4a - ; source: test_float_gte.p8:355 goto skip4a - bra p8l_skip4a - ; source: test_float_gte.p8:356 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:357 skip4a: -p8l_skip4a - ; source: test_float_gte.p8:359 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:360 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:362 goto skip4b - bra p8l_skip4b - ; source: test_float_gte.p8:363 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:364 skip4b: -p8l_skip4b - ; source: test_float_gte.p8:366 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_36_afterif - ; source: test_float_gte.p8:367 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_float_gte.p8:370 if x>=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_38_else - ; source: test_float_gte.p8:371 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_float_gte.p8:373 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_float_gte.p8:375 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_gte.p8:273 sub test_cmp_array() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS -; non-zeropage variables -p8v_values - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@7459a21e - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@7eeb38b2 - .pend - ; source: test_float_gte.p8:377 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_float_gte.p8:378 float @shared x - ; source: test_float_gte.p8:381 float @shared f4 = 1.0 - ; source: test_float_gte.p8:382 float @shared f5 = 1.0 - ; source: test_float_gte.p8:378 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gte.p8:379 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_float_gte.p8:380 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_float_gte.p8:381 float @shared f4 = 1.0 - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_float_gte.p8:382 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_float_gte.p8:383 success = 0 - stz p8b_main.p8v_success - ; source: test_float_gte.p8:384 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_gte.p8:386 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl1a - ; source: test_float_gte.p8:388 goto skip1a - bra p8l_skip1a - ; source: test_float_gte.p8:389 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:390 skip1a: -p8l_skip1a - ; source: test_float_gte.p8:392 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:393 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:395 goto skip1b - bra p8l_skip1b - ; source: test_float_gte.p8:396 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:397 skip1b: -p8l_skip1b - ; source: test_float_gte.p8:399 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_39_afterif - ; source: test_float_gte.p8:400 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_float_gte.p8:403 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_41_else - ; source: test_float_gte.p8:404 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_float_gte.p8:406 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_float_gte.p8:409 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl2a - ; source: test_float_gte.p8:411 goto skip2a - bra p8l_skip2a - ; source: test_float_gte.p8:412 lbl2a: fail_float(13) -p8l_lbl2a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:413 skip2a: -p8l_skip2a - ; source: test_float_gte.p8:415 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:416 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:418 goto skip2b - bra p8l_skip2b - ; source: test_float_gte.p8:419 lbl2b: fail_float(14) -p8l_lbl2b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_float - ; source: test_float_gte.p8:420 skip2b: -p8l_skip2b - ; source: test_float_gte.p8:422 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_42_afterif - ; source: test_float_gte.p8:423 fail_float(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_float -label_asm_42_afterif - ; source: test_float_gte.p8:426 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_44_else - ; source: test_float_gte.p8:427 fail_float(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_float - bra label_asm_43_afterif -label_asm_44_else - ; source: test_float_gte.p8:429 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_float_gte.p8:431 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_gte.p8:433 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl3a - ; source: test_float_gte.p8:435 goto skip3a - bra p8l_skip3a - ; source: test_float_gte.p8:436 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:437 skip3a: -p8l_skip3a - ; source: test_float_gte.p8:439 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:440 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:442 goto skip3b - bra p8l_skip3b - ; source: test_float_gte.p8:443 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:444 skip3b: -p8l_skip3b - ; source: test_float_gte.p8:446 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_45_afterif - ; source: test_float_gte.p8:447 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_float_gte.p8:450 if x>=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_47_else - ; source: test_float_gte.p8:451 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_float_gte.p8:453 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_float_gte.p8:456 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq p8l_lbl4a - ; source: test_float_gte.p8:458 goto skip4a - bra p8l_skip4a - ; source: test_float_gte.p8:459 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_gte.p8:460 skip4a: -p8l_skip4a - ; source: test_float_gte.p8:462 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_gte.p8:463 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne + - jmp (cx16.r3) -+ - ; source: test_float_gte.p8:465 goto skip4b - bra p8l_skip4b - ; source: test_float_gte.p8:466 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_gte.p8:467 skip4b: -p8l_skip4b - ; source: test_float_gte.p8:469 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_48_afterif - ; source: test_float_gte.p8:470 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_float_gte.p8:473 if x>=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne label_asm_50_else - ; source: test_float_gte.p8:474 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_float_gte.p8:476 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_float_gte.p8:478 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_gte.p8:377 sub test_cmp_expr() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .fill 5 - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $54 - .byte $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>=number: " - .byte $0d, $3e, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>=var: " - .byte $0d, $3e, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>=expr: " - .byte $0d, $3e, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_float_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ; source: test_float_gte.p8:18 txt.print("\n>=number: ") - ; source: test_float_gte.p8:20 txt.print("\n>=var: ") - ; source: test_float_gte.p8:22 txt.print("\n>=array[]: ") - ; source: test_float_gte.p8:24 txt.print("\n>=expr: ") - ; source: test_float_gte.p8:33 txt.print(" **failed** ") - ; source: test_float_gte.p8:35 txt.print(" success, expected ") - ; source: test_float_gte.p8:41 txt.print(" **fail#") - ; source: test_float_gte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $00, $00, $00, $00, $00 ; float 0.0 -prog8_float_const_1 .byte $8b, $1a, $51, $eb, $85 ; float 1234.56 -prog8_float_const_2 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_float_gte.p8 b/compiler/test/comparisons/test_float_gte.p8 deleted file mode 100644 index 384453dde..000000000 --- a/compiler/test/comparisons/test_float_gte.p8 +++ /dev/null @@ -1,482 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "float" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=number: ") - test_cmp_number() - txt.print("\n>=var: ") - test_cmp_var() - txt.print("\n>=array[]: ") - test_cmp_array() - txt.print("\n>=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - float @shared x - success = 0 - x=0.0 - ; direct jump - if x>=0.0 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=0.0 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=0.0 - success++ - - ; with else - if x>=0.0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1234.56 - goto lbl2a - goto skip2a -lbl2a: fail_float(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=1234.56 - goto cx16.r3 - goto skip2b -lbl2b: fail_float(2) -skip2b: - ; no else - if x>=1234.56 - fail_float(3) - - ; with else - if x>=1234.56 - fail_float(4) - else - success++ - - x=1234.56 - ; direct jump - if x>=0.0 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=0.0 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>=0.0 - success++ - - ; with else - if x>=0.0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1234.56 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=1234.56 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=1234.56 - success++ - - ; with else - if x>=1234.56 - success++ - else - cx16.r0L++ - - verify_success(13) -} - sub test_cmp_var() { - float @shared x, value - success = 0 - x=0.0 - value=0.0 - ; direct jump - if x>=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1234.56 - ; direct jump - if x>=value - goto lbl2a - goto skip2a -lbl2a: fail_float(5) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=value - goto cx16.r3 - goto skip2b -lbl2b: fail_float(6) -skip2b: - ; no else - if x>=value - fail_float(7) - - ; with else - if x>=value - fail_float(8) - else - success++ - - x=1234.56 - value=0.0 - ; direct jump - if x>=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1234.56 - ; direct jump - if x>=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - verify_success(13) -} - sub test_cmp_array() { - float @shared x - float[] values = [0, 0] - success = 0 - x=0.0 - values[1]=0.0 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1234.56 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_float(9) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_float(10) -skip2b: - ; no else - if x>=values[1] - fail_float(11) - - ; with else - if x>=values[1] - fail_float(12) - else - success++ - - x=1234.56 - values[1]=0.0 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1234.56 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - verify_success(13) -} - sub test_cmp_expr() { - float @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0.0 - ; direct jump - if x>=f4+0.0-f5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=f4+0.0-f5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=f4+0.0-f5 - success++ - - ; with else - if x>=f4+0.0-f5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=f4+1234.56-f5 - goto lbl2a - goto skip2a -lbl2a: fail_float(13) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=f4+1234.56-f5 - goto cx16.r3 - goto skip2b -lbl2b: fail_float(14) -skip2b: - ; no else - if x>=f4+1234.56-f5 - fail_float(15) - - ; with else - if x>=f4+1234.56-f5 - fail_float(16) - else - success++ - - x=1234.56 - ; direct jump - if x>=f4+0.0-f5 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=f4+0.0-f5 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x>=f4+0.0-f5 - success++ - - ; with else - if x>=f4+0.0-f5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=f4+1234.56-f5 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=f4+1234.56-f5 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=f4+1234.56-f5 - success++ - - ; with else - if x>=f4+1234.56-f5 - success++ - else - cx16.r0L++ - - verify_success(13) -} - -} - diff --git a/compiler/test/comparisons/test_float_lt.asm b/compiler/test/comparisons/test_float_lt.asm deleted file mode 100644 index ccbb5d5af..000000000 --- a/compiler/test/comparisons/test_float_lt.asm +++ /dev/null @@ -1,8831 +0,0 @@ -; w65c02 assembly code for 'test_float_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_float_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"float" - .byte $46, $4c, $4f, $41, $54, $00 - - ; source: test_float_lt.p8:9 ubyte success = 0 - ; source: test_float_lt.p8:10 str datatype = "float" - ; source: test_float_lt.p8:11 uword @shared comparison - ; source: test_float_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_float_lt.p8:14 txt.print("\nless-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl1a - ; source: test_float_lt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_float_lt.p8:79 lbl1a: fail_float(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:80 skip1a: -p8l_skip1a - ; source: test_float_lt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:83 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_float_lt.p8:86 lbl1b: fail_float(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:87 skip1b: -p8l_skip1b - ; source: test_float_lt.p8:89 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_3_afterif - ; source: test_float_lt.p8:90 fail_float(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_float -label_asm_3_afterif - ; source: test_float_lt.p8:93 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_5_else - ; source: test_float_lt.p8:94 fail_float(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_float - bra label_asm_4_afterif -label_asm_5_else - ; source: test_float_lt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_float_lt.p8:99 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl2a - ; source: test_float_lt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_float_lt.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lt.p8:103 skip2a: -p8l_skip2a - ; source: test_float_lt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:106 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_float_lt.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lt.p8:110 skip2b: -p8l_skip2b - ; source: test_float_lt.p8:112 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_6_afterif - ; source: test_float_lt.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_float_lt.p8:116 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_8_else - ; source: test_float_lt.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_float_lt.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_float_lt.p8:121 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lt.p8:123 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl3a - ; source: test_float_lt.p8:125 goto skip3a - bra p8l_skip3a - ; source: test_float_lt.p8:126 lbl3a: fail_float(5) -p8l_lbl3a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:127 skip3a: -p8l_skip3a - ; source: test_float_lt.p8:129 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:130 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:132 goto skip3b - bra p8l_skip3b - ; source: test_float_lt.p8:133 lbl3b: fail_float(6) -p8l_lbl3b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:134 skip3b: -p8l_skip3b - ; source: test_float_lt.p8:136 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_9_afterif - ; source: test_float_lt.p8:137 fail_float(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_float -label_asm_9_afterif - ; source: test_float_lt.p8:140 if x<0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_11_else - ; source: test_float_lt.p8:141 fail_float(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_float - bra label_asm_10_afterif -label_asm_11_else - ; source: test_float_lt.p8:143 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_float_lt.p8:146 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl4a - ; source: test_float_lt.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_float_lt.p8:149 lbl4a: fail_float(9) -p8l_lbl4a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:150 skip4a: -p8l_skip4a - ; source: test_float_lt.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:153 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_float_lt.p8:156 lbl4b: fail_float(10) -p8l_lbl4b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:157 skip4b: -p8l_skip4b - ; source: test_float_lt.p8:159 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_12_afterif - ; source: test_float_lt.p8:160 fail_float(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_float -label_asm_12_afterif - ; source: test_float_lt.p8:163 if x<1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_14_else - ; source: test_float_lt.p8:164 fail_float(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_float - bra label_asm_13_afterif -label_asm_14_else - ; source: test_float_lt.p8:166 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_float_lt.p8:168 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_lt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_lt.p8:170 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_float_lt.p8:171 float @shared x, value - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_lt.p8:172 success = 0 - stz p8b_main.p8v_success - ; source: test_float_lt.p8:173 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lt.p8:174 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_lt.p8:176 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl1a - ; source: test_float_lt.p8:178 goto skip1a - bra p8l_skip1a - ; source: test_float_lt.p8:179 lbl1a: fail_float(13) -p8l_lbl1a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:180 skip1a: -p8l_skip1a - ; source: test_float_lt.p8:182 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:183 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:185 goto skip1b - bra p8l_skip1b - ; source: test_float_lt.p8:186 lbl1b: fail_float(14) -p8l_lbl1b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:187 skip1b: -p8l_skip1b - ; source: test_float_lt.p8:189 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_15_afterif - ; source: test_float_lt.p8:190 fail_float(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_float -label_asm_15_afterif - ; source: test_float_lt.p8:193 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_17_else - ; source: test_float_lt.p8:194 fail_float(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_float - bra label_asm_16_afterif -label_asm_17_else - ; source: test_float_lt.p8:196 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_float_lt.p8:198 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_lt.p8:200 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl2a - ; source: test_float_lt.p8:202 goto skip2a - bra p8l_skip2a - ; source: test_float_lt.p8:203 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lt.p8:204 skip2a: -p8l_skip2a - ; source: test_float_lt.p8:206 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:207 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:209 goto skip2b - bra p8l_skip2b - ; source: test_float_lt.p8:210 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lt.p8:211 skip2b: -p8l_skip2b - ; source: test_float_lt.p8:213 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_18_afterif - ; source: test_float_lt.p8:214 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_float_lt.p8:217 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_20_else - ; source: test_float_lt.p8:218 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_float_lt.p8:220 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_float_lt.p8:222 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lt.p8:223 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_lt.p8:225 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl3a - ; source: test_float_lt.p8:227 goto skip3a - bra p8l_skip3a - ; source: test_float_lt.p8:228 lbl3a: fail_float(17) -p8l_lbl3a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:229 skip3a: -p8l_skip3a - ; source: test_float_lt.p8:231 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:232 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:234 goto skip3b - bra p8l_skip3b - ; source: test_float_lt.p8:235 lbl3b: fail_float(18) -p8l_lbl3b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:236 skip3b: -p8l_skip3b - ; source: test_float_lt.p8:238 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_21_afterif - ; source: test_float_lt.p8:239 fail_float(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_float -label_asm_21_afterif - ; source: test_float_lt.p8:242 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_23_else - ; source: test_float_lt.p8:243 fail_float(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_float - bra label_asm_22_afterif -label_asm_23_else - ; source: test_float_lt.p8:245 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_float_lt.p8:247 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_lt.p8:249 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl4a - ; source: test_float_lt.p8:251 goto skip4a - bra p8l_skip4a - ; source: test_float_lt.p8:252 lbl4a: fail_float(21) -p8l_lbl4a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:253 skip4a: -p8l_skip4a - ; source: test_float_lt.p8:255 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:256 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:258 goto skip4b - bra p8l_skip4b - ; source: test_float_lt.p8:259 lbl4b: fail_float(22) -p8l_lbl4b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:260 skip4b: -p8l_skip4b - ; source: test_float_lt.p8:262 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_24_afterif - ; source: test_float_lt.p8:263 fail_float(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_float -label_asm_24_afterif - ; source: test_float_lt.p8:266 if xp8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_26_else - ; source: test_float_lt.p8:267 fail_float(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_float - bra label_asm_25_afterif -label_asm_26_else - ; source: test_float_lt.p8:269 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_float_lt.p8:271 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_lt.p8:170 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_lt.p8:273 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_float_lt.p8:274 float @shared x - ; source: test_float_lt.p8:275 float[] values = [0, 0] - ; source: test_float_lt.p8:274 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lt.p8:276 success = 0 - stz p8b_main.p8v_success - ; source: test_float_lt.p8:277 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lt.p8:278 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_lt.p8:280 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl1a - ; source: test_float_lt.p8:282 goto skip1a - bra p8l_skip1a - ; source: test_float_lt.p8:283 lbl1a: fail_float(25) -p8l_lbl1a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:284 skip1a: -p8l_skip1a - ; source: test_float_lt.p8:286 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:287 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:289 goto skip1b - bra p8l_skip1b - ; source: test_float_lt.p8:290 lbl1b: fail_float(26) -p8l_lbl1b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:291 skip1b: -p8l_skip1b - ; source: test_float_lt.p8:293 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_27_afterif - ; source: test_float_lt.p8:294 fail_float(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_float -label_asm_27_afterif - ; source: test_float_lt.p8:297 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_29_else - ; source: test_float_lt.p8:298 fail_float(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_float - bra label_asm_28_afterif -label_asm_29_else - ; source: test_float_lt.p8:300 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_float_lt.p8:302 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_lt.p8:304 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl2a - ; source: test_float_lt.p8:306 goto skip2a - bra p8l_skip2a - ; source: test_float_lt.p8:307 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lt.p8:308 skip2a: -p8l_skip2a - ; source: test_float_lt.p8:310 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:311 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:313 goto skip2b - bra p8l_skip2b - ; source: test_float_lt.p8:314 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lt.p8:315 skip2b: -p8l_skip2b - ; source: test_float_lt.p8:317 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_30_afterif - ; source: test_float_lt.p8:318 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_float_lt.p8:321 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_32_else - ; source: test_float_lt.p8:322 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_float_lt.p8:324 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_float_lt.p8:326 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lt.p8:327 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_lt.p8:329 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl3a - ; source: test_float_lt.p8:331 goto skip3a - bra p8l_skip3a - ; source: test_float_lt.p8:332 lbl3a: fail_float(29) -p8l_lbl3a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:333 skip3a: -p8l_skip3a - ; source: test_float_lt.p8:335 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:336 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:338 goto skip3b - bra p8l_skip3b - ; source: test_float_lt.p8:339 lbl3b: fail_float(30) -p8l_lbl3b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:340 skip3b: -p8l_skip3b - ; source: test_float_lt.p8:342 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_33_afterif - ; source: test_float_lt.p8:343 fail_float(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_float -label_asm_33_afterif - ; source: test_float_lt.p8:346 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_35_else - ; source: test_float_lt.p8:347 fail_float(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_float - bra label_asm_34_afterif -label_asm_35_else - ; source: test_float_lt.p8:349 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_float_lt.p8:351 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_lt.p8:353 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl4a - ; source: test_float_lt.p8:355 goto skip4a - bra p8l_skip4a - ; source: test_float_lt.p8:356 lbl4a: fail_float(33) -p8l_lbl4a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:357 skip4a: -p8l_skip4a - ; source: test_float_lt.p8:359 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:360 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:362 goto skip4b - bra p8l_skip4b - ; source: test_float_lt.p8:363 lbl4b: fail_float(34) -p8l_lbl4b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:364 skip4b: -p8l_skip4b - ; source: test_float_lt.p8:366 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_36_afterif - ; source: test_float_lt.p8:367 fail_float(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_float -label_asm_36_afterif - ; source: test_float_lt.p8:370 if x(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_38_else - ; source: test_float_lt.p8:371 fail_float(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_float - bra label_asm_37_afterif -label_asm_38_else - ; source: test_float_lt.p8:373 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_float_lt.p8:375 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_lt.p8:273 sub test_cmp_array() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS -; non-zeropage variables -p8v_values - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@281b2dfd - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@492be039 - .pend - ; source: test_float_lt.p8:377 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_float_lt.p8:378 float @shared x - ; source: test_float_lt.p8:381 float @shared f4 = 1.0 - ; source: test_float_lt.p8:382 float @shared f5 = 1.0 - ; source: test_float_lt.p8:378 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lt.p8:379 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_float_lt.p8:380 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_float_lt.p8:381 float @shared f4 = 1.0 - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_float_lt.p8:382 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_float_lt.p8:383 success = 0 - stz p8b_main.p8v_success - ; source: test_float_lt.p8:384 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lt.p8:386 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl1a - ; source: test_float_lt.p8:388 goto skip1a - bra p8l_skip1a - ; source: test_float_lt.p8:389 lbl1a: fail_float(37) -p8l_lbl1a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:390 skip1a: -p8l_skip1a - ; source: test_float_lt.p8:392 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:393 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:395 goto skip1b - bra p8l_skip1b - ; source: test_float_lt.p8:396 lbl1b: fail_float(38) -p8l_lbl1b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:397 skip1b: -p8l_skip1b - ; source: test_float_lt.p8:399 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_39_afterif - ; source: test_float_lt.p8:400 fail_float(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_float -label_asm_39_afterif - ; source: test_float_lt.p8:403 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_41_else - ; source: test_float_lt.p8:404 fail_float(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_float - bra label_asm_40_afterif -label_asm_41_else - ; source: test_float_lt.p8:406 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_float_lt.p8:409 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl2a - ; source: test_float_lt.p8:411 goto skip2a - bra p8l_skip2a - ; source: test_float_lt.p8:412 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lt.p8:413 skip2a: -p8l_skip2a - ; source: test_float_lt.p8:415 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:416 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:418 goto skip2b - bra p8l_skip2b - ; source: test_float_lt.p8:419 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lt.p8:420 skip2b: -p8l_skip2b - ; source: test_float_lt.p8:422 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_42_afterif - ; source: test_float_lt.p8:423 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_float_lt.p8:426 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_44_else - ; source: test_float_lt.p8:427 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_float_lt.p8:429 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_float_lt.p8:431 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lt.p8:433 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl3a - ; source: test_float_lt.p8:435 goto skip3a - bra p8l_skip3a - ; source: test_float_lt.p8:436 lbl3a: fail_float(41) -p8l_lbl3a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:437 skip3a: -p8l_skip3a - ; source: test_float_lt.p8:439 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:440 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:442 goto skip3b - bra p8l_skip3b - ; source: test_float_lt.p8:443 lbl3b: fail_float(42) -p8l_lbl3b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:444 skip3b: -p8l_skip3b - ; source: test_float_lt.p8:446 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_45_afterif - ; source: test_float_lt.p8:447 fail_float(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_float -label_asm_45_afterif - ; source: test_float_lt.p8:450 if xp8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_47_else - ; source: test_float_lt.p8:451 fail_float(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_float - bra label_asm_46_afterif -label_asm_47_else - ; source: test_float_lt.p8:453 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_float_lt.p8:456 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - bne p8l_lbl4a - ; source: test_float_lt.p8:458 goto skip4a - bra p8l_skip4a - ; source: test_float_lt.p8:459 lbl4a: fail_float(45) -p8l_lbl4a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:460 skip4a: -p8l_skip4a - ; source: test_float_lt.p8:462 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lt.p8:463 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lt.p8:465 goto skip4b - bra p8l_skip4b - ; source: test_float_lt.p8:466 lbl4b: fail_float(46) -p8l_lbl4b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_float - ; source: test_float_lt.p8:467 skip4b: -p8l_skip4b - ; source: test_float_lt.p8:469 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_48_afterif - ; source: test_float_lt.p8:470 fail_float(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_float -label_asm_48_afterif - ; source: test_float_lt.p8:473 if xp8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_less_f - beq label_asm_50_else - ; source: test_float_lt.p8:474 fail_float(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_float - bra label_asm_49_afterif -label_asm_50_else - ; source: test_float_lt.p8:476 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_float_lt.p8:478 verify_success(7) - lda #7 - jmp p8b_main.p8s_verify_success - ; source: test_float_lt.p8:377 sub test_cmp_expr() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .fill 5 - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $54, $45, $53, $54, $53 - .byte $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $00, $00, $00, $00, $00 ; float 0.0 -prog8_float_const_1 .byte $8b, $1a, $51, $eb, $85 ; float 1234.56 -prog8_float_const_2 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_float_lt.p8 b/compiler/test/comparisons/test_float_lt.p8 deleted file mode 100644 index 1d4455294..000000000 --- a/compiler/test/comparisons/test_float_lt.p8 +++ /dev/null @@ -1,482 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "float" - uword @shared comparison - - sub start() { - txt.print("\nless-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_float_lte.p8:14 txt.print("\nless-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl1a - ; source: test_float_lte.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_float_lte.p8:79 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:80 skip1a: -p8l_skip1a - ; source: test_float_lte.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:83 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_float_lte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:87 skip1b: -p8l_skip1b - ; source: test_float_lte.p8:89 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_3_afterif - ; source: test_float_lte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_float_lte.p8:93 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_5_else - ; source: test_float_lte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_float_lte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_float_lte.p8:99 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl2a - ; source: test_float_lte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_float_lte.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:103 skip2a: -p8l_skip2a - ; source: test_float_lte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:106 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_float_lte.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:110 skip2b: -p8l_skip2b - ; source: test_float_lte.p8:112 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_6_afterif - ; source: test_float_lte.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_float_lte.p8:116 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_8_else - ; source: test_float_lte.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_float_lte.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_float_lte.p8:121 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lte.p8:123 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl3a - ; source: test_float_lte.p8:125 goto skip3a - bra p8l_skip3a - ; source: test_float_lte.p8:126 lbl3a: fail_float(1) -p8l_lbl3a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:127 skip3a: -p8l_skip3a - ; source: test_float_lte.p8:129 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:130 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:132 goto skip3b - bra p8l_skip3b - ; source: test_float_lte.p8:133 lbl3b: fail_float(2) -p8l_lbl3b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:134 skip3b: -p8l_skip3b - ; source: test_float_lte.p8:136 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_9_afterif - ; source: test_float_lte.p8:137 fail_float(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_float -label_asm_9_afterif - ; source: test_float_lte.p8:140 if x<=0.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_11_else - ; source: test_float_lte.p8:141 fail_float(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_float - bra label_asm_10_afterif -label_asm_11_else - ; source: test_float_lte.p8:143 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_float_lte.p8:146 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl4a - ; source: test_float_lte.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_float_lte.p8:149 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:150 skip4a: -p8l_skip4a - ; source: test_float_lte.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:153 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_float_lte.p8:156 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:157 skip4b: -p8l_skip4b - ; source: test_float_lte.p8:159 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_12_afterif - ; source: test_float_lte.p8:160 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_float_lte.p8:163 if x<=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_14_else - ; source: test_float_lte.p8:164 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_float_lte.p8:166 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_float_lte.p8:168 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_lte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_lte.p8:170 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_float_lte.p8:171 float @shared x, value - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - lda #p8v_x - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_lte.p8:172 success = 0 - stz p8b_main.p8v_success - ; source: test_float_lte.p8:173 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lte.p8:174 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_lte.p8:176 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl1a - ; source: test_float_lte.p8:178 goto skip1a - bra p8l_skip1a - ; source: test_float_lte.p8:179 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:180 skip1a: -p8l_skip1a - ; source: test_float_lte.p8:182 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:183 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:185 goto skip1b - bra p8l_skip1b - ; source: test_float_lte.p8:186 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:187 skip1b: -p8l_skip1b - ; source: test_float_lte.p8:189 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_15_afterif - ; source: test_float_lte.p8:190 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_float_lte.p8:193 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_17_else - ; source: test_float_lte.p8:194 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_float_lte.p8:196 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_float_lte.p8:198 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_lte.p8:200 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl2a - ; source: test_float_lte.p8:202 goto skip2a - bra p8l_skip2a - ; source: test_float_lte.p8:203 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:204 skip2a: -p8l_skip2a - ; source: test_float_lte.p8:206 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:207 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:209 goto skip2b - bra p8l_skip2b - ; source: test_float_lte.p8:210 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:211 skip2b: -p8l_skip2b - ; source: test_float_lte.p8:213 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_18_afterif - ; source: test_float_lte.p8:214 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_float_lte.p8:217 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_20_else - ; source: test_float_lte.p8:218 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_float_lte.p8:220 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_float_lte.p8:222 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lte.p8:223 value=0.0 - stz p8v_value - stz p8v_value+1 - stz p8v_value+2 - stz p8v_value+3 - stz p8v_value+4 - - ; source: test_float_lte.p8:225 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl3a - ; source: test_float_lte.p8:227 goto skip3a - bra p8l_skip3a - ; source: test_float_lte.p8:228 lbl3a: fail_float(5) -p8l_lbl3a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:229 skip3a: -p8l_skip3a - ; source: test_float_lte.p8:231 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:232 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:234 goto skip3b - bra p8l_skip3b - ; source: test_float_lte.p8:235 lbl3b: fail_float(6) -p8l_lbl3b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:236 skip3b: -p8l_skip3b - ; source: test_float_lte.p8:238 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_21_afterif - ; source: test_float_lte.p8:239 fail_float(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_float -label_asm_21_afterif - ; source: test_float_lte.p8:242 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_23_else - ; source: test_float_lte.p8:243 fail_float(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_float - bra label_asm_22_afterif -label_asm_23_else - ; source: test_float_lte.p8:245 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_float_lte.p8:247 value=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_value - jsr floats.copy_float - ; source: test_float_lte.p8:249 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl4a - ; source: test_float_lte.p8:251 goto skip4a - bra p8l_skip4a - ; source: test_float_lte.p8:252 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:253 skip4a: -p8l_skip4a - ; source: test_float_lte.p8:255 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:256 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:258 goto skip4b - bra p8l_skip4b - ; source: test_float_lte.p8:259 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:260 skip4b: -p8l_skip4b - ; source: test_float_lte.p8:262 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_24_afterif - ; source: test_float_lte.p8:263 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_float_lte.p8:266 if x<=value - lda #p8v_value - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_26_else - ; source: test_float_lte.p8:267 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_float_lte.p8:269 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_float_lte.p8:271 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_lte.p8:170 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .fill 5 -p8v_x .fill 5 - .send BSS - .pend - ; source: test_float_lte.p8:273 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_float_lte.p8:274 float @shared x - ; source: test_float_lte.p8:275 float[] values = [0, 0] - ; source: test_float_lte.p8:274 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lte.p8:276 success = 0 - stz p8b_main.p8v_success - ; source: test_float_lte.p8:277 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lte.p8:278 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_lte.p8:280 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl1a - ; source: test_float_lte.p8:282 goto skip1a - bra p8l_skip1a - ; source: test_float_lte.p8:283 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:284 skip1a: -p8l_skip1a - ; source: test_float_lte.p8:286 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:287 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:289 goto skip1b - bra p8l_skip1b - ; source: test_float_lte.p8:290 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:291 skip1b: -p8l_skip1b - ; source: test_float_lte.p8:293 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_27_afterif - ; source: test_float_lte.p8:294 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_float_lte.p8:297 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_29_else - ; source: test_float_lte.p8:298 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_float_lte.p8:300 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_float_lte.p8:302 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_lte.p8:304 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl2a - ; source: test_float_lte.p8:306 goto skip2a - bra p8l_skip2a - ; source: test_float_lte.p8:307 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:308 skip2a: -p8l_skip2a - ; source: test_float_lte.p8:310 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:311 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:313 goto skip2b - bra p8l_skip2b - ; source: test_float_lte.p8:314 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:315 skip2b: -p8l_skip2b - ; source: test_float_lte.p8:317 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_30_afterif - ; source: test_float_lte.p8:318 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_float_lte.p8:321 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_32_else - ; source: test_float_lte.p8:322 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_float_lte.p8:324 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_float_lte.p8:326 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lte.p8:327 values[1]=0.0 - lda #1 - ldy #p8v_values - sty P8ZP_SCRATCH_W1+1 - jsr floats.set_0_array_float - ; source: test_float_lte.p8:329 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl3a - ; source: test_float_lte.p8:331 goto skip3a - bra p8l_skip3a - ; source: test_float_lte.p8:332 lbl3a: fail_float(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:333 skip3a: -p8l_skip3a - ; source: test_float_lte.p8:335 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:336 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:338 goto skip3b - bra p8l_skip3b - ; source: test_float_lte.p8:339 lbl3b: fail_float(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:340 skip3b: -p8l_skip3b - ; source: test_float_lte.p8:342 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_33_afterif - ; source: test_float_lte.p8:343 fail_float(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_float -label_asm_33_afterif - ; source: test_float_lte.p8:346 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_35_else - ; source: test_float_lte.p8:347 fail_float(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_float - bra label_asm_34_afterif -label_asm_35_else - ; source: test_float_lte.p8:349 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_float_lte.p8:351 values[1]=1234.56 - lda #1 - ldy #prog8_float_const_1 - sty P8ZP_SCRATCH_W1+1 - ldy #p8v_values - sty P8ZP_SCRATCH_W2+1 - jsr floats.set_array_float - - ; source: test_float_lte.p8:353 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl4a - ; source: test_float_lte.p8:355 goto skip4a - bra p8l_skip4a - ; source: test_float_lte.p8:356 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:357 skip4a: -p8l_skip4a - ; source: test_float_lte.p8:359 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:360 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:362 goto skip4b - bra p8l_skip4b - ; source: test_float_lte.p8:363 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:364 skip4b: -p8l_skip4b - ; source: test_float_lte.p8:366 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_36_afterif - ; source: test_float_lte.p8:367 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_float_lte.p8:370 if x<=values[1] - lda #<(p8v_values+5) - ldy #>(p8v_values+5) - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #prog8_float_eval_result1 - jsr floats.copy_float - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_38_else - ; source: test_float_lte.p8:371 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_float_lte.p8:373 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_float_lte.p8:375 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_lte.p8:273 sub test_cmp_array() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .fill 5 - .send BSS -; non-zeropage variables -p8v_values - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@5b2b8d86 - .byte $00, $00, $00, $00, $00 ; float prog8.code.StArrayElement@7fef0b40 - .pend - ; source: test_float_lte.p8:377 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_float_lte.p8:378 float @shared x - ; source: test_float_lte.p8:381 float @shared f4 = 1.0 - ; source: test_float_lte.p8:382 float @shared f5 = 1.0 - ; source: test_float_lte.p8:378 float @shared x - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lte.p8:379 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_float_lte.p8:380 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_float_lte.p8:381 float @shared f4 = 1.0 - lda #prog8_float_const_2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_float_lte.p8:382 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_float_lte.p8:383 success = 0 - stz p8b_main.p8v_success - ; source: test_float_lte.p8:384 x=0.0 - stz p8v_x - stz p8v_x+1 - stz p8v_x+2 - stz p8v_x+3 - stz p8v_x+4 - - ; source: test_float_lte.p8:386 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl1a - ; source: test_float_lte.p8:388 goto skip1a - bra p8l_skip1a - ; source: test_float_lte.p8:389 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:390 skip1a: -p8l_skip1a - ; source: test_float_lte.p8:392 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:393 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:395 goto skip1b - bra p8l_skip1b - ; source: test_float_lte.p8:396 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:397 skip1b: -p8l_skip1b - ; source: test_float_lte.p8:399 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_39_afterif - ; source: test_float_lte.p8:400 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_float_lte.p8:403 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_41_else - ; source: test_float_lte.p8:404 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_float_lte.p8:406 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_float_lte.p8:409 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl2a - ; source: test_float_lte.p8:411 goto skip2a - bra p8l_skip2a - ; source: test_float_lte.p8:412 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:413 skip2a: -p8l_skip2a - ; source: test_float_lte.p8:415 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:416 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:418 goto skip2b - bra p8l_skip2b - ; source: test_float_lte.p8:419 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:420 skip2b: -p8l_skip2b - ; source: test_float_lte.p8:422 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_42_afterif - ; source: test_float_lte.p8:423 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_float_lte.p8:426 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_44_else - ; source: test_float_lte.p8:427 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_float_lte.p8:429 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_float_lte.p8:431 x=1234.56 - lda #prog8_float_const_1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_x - jsr floats.copy_float - ; source: test_float_lte.p8:433 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl3a - ; source: test_float_lte.p8:435 goto skip3a - bra p8l_skip3a - ; source: test_float_lte.p8:436 lbl3a: fail_float(13) -p8l_lbl3a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:437 skip3a: -p8l_skip3a - ; source: test_float_lte.p8:439 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:440 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:442 goto skip3b - bra p8l_skip3b - ; source: test_float_lte.p8:443 lbl3b: fail_float(14) -p8l_lbl3b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_float - ; source: test_float_lte.p8:444 skip3b: -p8l_skip3b - ; source: test_float_lte.p8:446 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_45_afterif - ; source: test_float_lte.p8:447 fail_float(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_float -label_asm_45_afterif - ; source: test_float_lte.p8:450 if x<=f4+0.0-f5 - lda #p8v_f5 - jsr floats.MOVFM - lda #p8v_f4 - jsr floats.CONUPK - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_47_else - ; source: test_float_lte.p8:451 fail_float(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_float - bra label_asm_46_afterif -label_asm_47_else - ; source: test_float_lte.p8:453 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_float_lte.p8:456 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - bne p8l_lbl4a - ; source: test_float_lte.p8:458 goto skip4a - bra p8l_skip4a - ; source: test_float_lte.p8:459 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_float_lte.p8:460 skip4a: -p8l_skip4a - ; source: test_float_lte.p8:462 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_float_lte.p8:463 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq + - jmp (cx16.r3) -+ - ; source: test_float_lte.p8:465 goto skip4b - bra p8l_skip4b - ; source: test_float_lte.p8:466 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_float_lte.p8:467 skip4b: -p8l_skip4b - ; source: test_float_lte.p8:469 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_48_afterif - ; source: test_float_lte.p8:470 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_float_lte.p8:473 if x<=f4+1234.56-f5 - lda #p8v_f5 - jsr floats.MOVFM - jsr floats.pushFAC1 - lda #p8v_f4 - jsr floats.MOVFM - lda #prog8_float_const_1 - jsr floats.CONUPK - jsr floats.FADDT - jsr floats.MOVAF - clc - jsr floats.popFAC - jsr floats.FSUBT - ldx #prog8_float_eval_result1 - jsr floats.MOVMF - - lda #prog8_float_eval_result1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #p8v_x -jsr floats.vars_lesseq_f - beq label_asm_50_else - ; source: test_float_lte.p8:474 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_float_lte.p8:476 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_float_lte.p8:478 verify_success(13) - lda #13 - jmp p8b_main.p8s_verify_success - ; source: test_float_lte.p8:377 sub test_cmp_expr() { -; variables - .section BSS -prog8_float_eval_result1 .fill 5 - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .fill 5 - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $54, $45, $53, $54 - .byte $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n<=number: " - .byte $0d, $3c, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n<=var: " - .byte $0d, $3c, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n<=expr: " - .byte $0d, $3c, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_float_lte.p8:14 txt.print("\nless-equal tests for: ") - ; source: test_float_lte.p8:18 txt.print("\n<=number: ") - ; source: test_float_lte.p8:20 txt.print("\n<=var: ") - ; source: test_float_lte.p8:22 txt.print("\n<=array[]: ") - ; source: test_float_lte.p8:24 txt.print("\n<=expr: ") - ; source: test_float_lte.p8:33 txt.print(" **failed** ") - ; source: test_float_lte.p8:35 txt.print(" success, expected ") - ; source: test_float_lte.p8:41 txt.print(" **fail#") - ; source: test_float_lte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $00, $00, $00, $00, $00 ; float 0.0 -prog8_float_const_1 .byte $8b, $1a, $51, $eb, $85 ; float 1234.56 -prog8_float_const_2 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_float_lte.p8 b/compiler/test/comparisons/test_float_lte.p8 deleted file mode 100644 index 1def91257..000000000 --- a/compiler/test/comparisons/test_float_lte.p8 +++ /dev/null @@ -1,482 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "float" - uword @shared comparison - - sub start() { - txt.print("\nless-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=number: ") - test_cmp_number() - txt.print("\n<=var: ") - test_cmp_var() - txt.print("\n<=array[]: ") - test_cmp_array() - txt.print("\n<=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - float @shared x - success = 0 - x=0.0 - ; direct jump - if x<=0.0 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=0.0 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=0.0 - success++ - - ; with else - if x<=0.0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1234.56 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=1234.56 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=1234.56 - success++ - - ; with else - if x<=1234.56 - success++ - else - cx16.r0L++ - - x=1234.56 - ; direct jump - if x<=0.0 - goto lbl3a - goto skip3a -lbl3a: fail_float(1) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=0.0 - goto cx16.r3 - goto skip3b -lbl3b: fail_float(2) -skip3b: - ; no else - if x<=0.0 - fail_float(3) - - ; with else - if x<=0.0 - fail_float(4) - else - success++ - - ; direct jump - if x<=1234.56 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=1234.56 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=1234.56 - success++ - - ; with else - if x<=1234.56 - success++ - else - cx16.r0L++ - - verify_success(13) -} - sub test_cmp_var() { - float @shared x, value - success = 0 - x=0.0 - value=0.0 - ; direct jump - if x<=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1234.56 - ; direct jump - if x<=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=1234.56 - value=0.0 - ; direct jump - if x<=value - goto lbl3a - goto skip3a -lbl3a: fail_float(5) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=value - goto cx16.r3 - goto skip3b -lbl3b: fail_float(6) -skip3b: - ; no else - if x<=value - fail_float(7) - - ; with else - if x<=value - fail_float(8) - else - success++ - - value=1234.56 - ; direct jump - if x<=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - verify_success(13) -} - sub test_cmp_array() { - float @shared x - float[] values = [0, 0] - success = 0 - x=0.0 - values[1]=0.0 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1234.56 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=1234.56 - values[1]=0.0 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_float(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_float(10) -skip3b: - ; no else - if x<=values[1] - fail_float(11) - - ; with else - if x<=values[1] - fail_float(12) - else - success++ - - values[1]=1234.56 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - verify_success(13) -} - sub test_cmp_expr() { - float @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0.0 - ; direct jump - if x<=f4+0.0-f5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=f4+0.0-f5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=f4+0.0-f5 - success++ - - ; with else - if x<=f4+0.0-f5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=f4+1234.56-f5 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=f4+1234.56-f5 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=f4+1234.56-f5 - success++ - - ; with else - if x<=f4+1234.56-f5 - success++ - else - cx16.r0L++ - - x=1234.56 - ; direct jump - if x<=f4+0.0-f5 - goto lbl3a - goto skip3a -lbl3a: fail_float(13) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=f4+0.0-f5 - goto cx16.r3 - goto skip3b -lbl3b: fail_float(14) -skip3b: - ; no else - if x<=f4+0.0-f5 - fail_float(15) - - ; with else - if x<=f4+0.0-f5 - fail_float(16) - else - success++ - - ; direct jump - if x<=f4+1234.56-f5 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=f4+1234.56-f5 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=f4+1234.56-f5 - success++ - - ; with else - if x<=f4+1234.56-f5 - success++ - else - cx16.r0L++ - - verify_success(13) -} - -} - diff --git a/compiler/test/comparisons/test_ubyte_equalities.asm b/compiler/test/comparisons/test_ubyte_equalities.asm deleted file mode 100644 index 188381116..000000000 --- a/compiler/test/comparisons/test_ubyte_equalities.asm +++ /dev/null @@ -1,11535 +0,0 @@ -; w65c02 assembly code for 'test_ubyte_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_ubyte_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"ubyte" - .byte $55, $42, $59, $54, $45, $00 - - ; source: test_ubyte_equalities.p8:9 ubyte success = 0 - ; source: test_ubyte_equalities.p8:10 str datatype = "ubyte" - ; source: test_ubyte_equalities.p8:11 uword @shared comparison - ; source: test_ubyte_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_ubyte_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:107 if x==0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:109 goto skip2 - bra p8l_skip2 - ; source: test_ubyte_equalities.p8:110 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:111 skip2: -p8l_skip2 - ; source: test_ubyte_equalities.p8:113 if x==0 - lda p8v_x - bne label_asm_3_afterif - ; source: test_ubyte_equalities.p8:114 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_ubyte_equalities.p8:117 if x==0 - lda p8v_x - bne label_asm_5_else - ; source: test_ubyte_equalities.p8:118 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_ubyte_equalities.p8:120 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_ubyte_equalities.p8:122 x = 100 - lda #$64 - sta p8v_x - ; source: test_ubyte_equalities.p8:124 if x==0 - beq p8l_skip3 - ; source: test_ubyte_equalities.p8:126 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:127 skip3: -p8l_skip3 - ; source: test_ubyte_equalities.p8:129 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:130 if x==0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:132 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:133 skip4: -p8l_skip4 - ; source: test_ubyte_equalities.p8:135 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:136 if x==0 - lda p8v_x - bne label_asm_6_afterif - ; source: test_ubyte_equalities.p8:137 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_ubyte_equalities.p8:140 if x==0 - lda p8v_x - bne label_asm_8_else - ; source: test_ubyte_equalities.p8:141 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_ubyte_equalities.p8:143 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_ubyte_equalities.p8:145 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:94 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:149 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_ubyte_equalities.p8:150 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:151 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:153 x=100 - lda #$64 - sta p8v_x - ; source: test_ubyte_equalities.p8:155 if x!=0 - bne p8l_lbl1 - ; source: test_ubyte_equalities.p8:157 goto skip1 - bra p8l_skip1 - ; source: test_ubyte_equalities.p8:158 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:159 skip1: -p8l_skip1 - ; source: test_ubyte_equalities.p8:161 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:162 if x!=0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:164 goto skip2 - bra p8l_skip2 - ; source: test_ubyte_equalities.p8:165 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:166 skip2: -p8l_skip2 - ; source: test_ubyte_equalities.p8:168 if x!=0 - lda p8v_x - beq label_asm_9_afterif - ; source: test_ubyte_equalities.p8:169 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_ubyte_equalities.p8:172 if x!=0 - lda p8v_x - beq label_asm_11_else - ; source: test_ubyte_equalities.p8:173 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_ubyte_equalities.p8:175 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_ubyte_equalities.p8:177 x = 0 - stz p8v_x - ; source: test_ubyte_equalities.p8:179 if x!=0 - lda p8v_x - bne p8l_skip3 - ; source: test_ubyte_equalities.p8:181 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:182 skip3: -p8l_skip3 - ; source: test_ubyte_equalities.p8:184 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:185 if x!=0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:187 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:188 skip4: -p8l_skip4 - ; source: test_ubyte_equalities.p8:190 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:191 if x!=0 - lda p8v_x - beq label_asm_12_afterif - ; source: test_ubyte_equalities.p8:192 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_ubyte_equalities.p8:195 if x!=0 - lda p8v_x - beq label_asm_14_else - ; source: test_ubyte_equalities.p8:196 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_ubyte_equalities.p8:198 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_ubyte_equalities.p8:200 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:149 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:203 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_ubyte_equalities.p8:204 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:205 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:206 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:208 if x==1 - lda p8v_x - cmp #1 - beq p8l_lbl1a - ; source: test_ubyte_equalities.p8:210 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:211 lbl1a: fail_ubyte(1,0) -p8l_lbl1a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:212 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:214 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:215 if x==1 - lda p8v_x - cmp #1 - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:217 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:218 lbl1b: fail_ubyte(2,0) -p8l_lbl1b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:219 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:221 if x==1 - lda p8v_x - cmp #1 - bne label_asm_15_afterif - ; source: test_ubyte_equalities.p8:222 fail_ubyte(3,0) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_15_afterif - ; source: test_ubyte_equalities.p8:225 if x==1 - lda p8v_x - cmp #1 - bne label_asm_17_else - ; source: test_ubyte_equalities.p8:226 fail_ubyte(4,0) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_16_afterif -label_asm_17_else - ; source: test_ubyte_equalities.p8:228 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_ubyte_equalities.p8:231 if x==255 - lda p8v_x - cmp #255 - beq p8l_lbl2a - ; source: test_ubyte_equalities.p8:233 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:234 lbl2a: fail_ubyte(5,0) -p8l_lbl2a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:235 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:237 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:238 if x==255 - lda p8v_x - cmp #255 - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:240 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:241 lbl2b: fail_ubyte(6,0) -p8l_lbl2b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:242 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:244 if x==255 - lda p8v_x - cmp #255 - bne label_asm_18_afterif - ; source: test_ubyte_equalities.p8:245 fail_ubyte(7,0) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_18_afterif - ; source: test_ubyte_equalities.p8:248 if x==255 - lda p8v_x - cmp #255 - bne label_asm_20_else - ; source: test_ubyte_equalities.p8:249 fail_ubyte(8,0) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_19_afterif -label_asm_20_else - ; source: test_ubyte_equalities.p8:251 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_ubyte_equalities.p8:253 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:255 if x==1 - cmp #1 - beq p8l_lbl3a - ; source: test_ubyte_equalities.p8:257 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:258 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:259 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:261 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:262 if x==1 - lda p8v_x - cmp #1 - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:264 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:265 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:266 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:268 if x==1 - lda p8v_x - cmp #1 - bne label_asm_21_afterif - ; source: test_ubyte_equalities.p8:269 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_ubyte_equalities.p8:272 if x==1 - lda p8v_x - cmp #1 - bne label_asm_23_else - ; source: test_ubyte_equalities.p8:273 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_ubyte_equalities.p8:275 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_ubyte_equalities.p8:278 if x==255 - lda p8v_x - cmp #255 - beq p8l_lbl4a - ; source: test_ubyte_equalities.p8:280 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:281 lbl4a: fail_ubyte(9,1) -p8l_lbl4a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:282 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:284 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:285 if x==255 - lda p8v_x - cmp #255 - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:287 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:288 lbl4b: fail_ubyte(10,1) -p8l_lbl4b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:289 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:291 if x==255 - lda p8v_x - cmp #255 - bne label_asm_24_afterif - ; source: test_ubyte_equalities.p8:292 fail_ubyte(11,1) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_24_afterif - ; source: test_ubyte_equalities.p8:295 if x==255 - lda p8v_x - cmp #255 - bne label_asm_26_else - ; source: test_ubyte_equalities.p8:296 fail_ubyte(12,1) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_25_afterif -label_asm_26_else - ; source: test_ubyte_equalities.p8:298 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_ubyte_equalities.p8:300 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:302 if x==1 - cmp #1 - beq p8l_lbl5a - ; source: test_ubyte_equalities.p8:304 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:305 lbl5a: fail_ubyte(13,255) -p8l_lbl5a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:306 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:308 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:309 if x==1 - lda p8v_x - cmp #1 - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:311 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:312 lbl5b: fail_ubyte(14,255) -p8l_lbl5b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:313 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:315 if x==1 - lda p8v_x - cmp #1 - bne label_asm_27_afterif - ; source: test_ubyte_equalities.p8:316 fail_ubyte(15,255) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_27_afterif - ; source: test_ubyte_equalities.p8:319 if x==1 - lda p8v_x - cmp #1 - bne label_asm_29_else - ; source: test_ubyte_equalities.p8:320 fail_ubyte(16,255) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_28_afterif -label_asm_29_else - ; source: test_ubyte_equalities.p8:322 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_ubyte_equalities.p8:325 if x==255 - lda p8v_x - cmp #255 - beq p8l_lbl6a - ; source: test_ubyte_equalities.p8:327 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:328 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:329 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:331 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:332 if x==255 - lda p8v_x - cmp #255 - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:334 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:335 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:336 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:338 if x==255 - lda p8v_x - cmp #255 - bne label_asm_30_afterif - ; source: test_ubyte_equalities.p8:339 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_ubyte_equalities.p8:342 if x==255 - lda p8v_x - cmp #255 - bne label_asm_32_else - ; source: test_ubyte_equalities.p8:343 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_ubyte_equalities.p8:345 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_ubyte_equalities.p8:347 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:203 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:349 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_ubyte_equalities.p8:350 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:351 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:352 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:354 if x!=1 - lda p8v_x - cmp #1 - bne p8l_lbl1a - ; source: test_ubyte_equalities.p8:356 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:357 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:358 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:360 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:361 if x!=1 - lda p8v_x - cmp #1 - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:363 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:364 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:365 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:367 if x!=1 - lda p8v_x - cmp #1 - beq label_asm_33_afterif - ; source: test_ubyte_equalities.p8:368 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_ubyte_equalities.p8:371 if x!=1 - lda p8v_x - cmp #1 - beq label_asm_35_else - ; source: test_ubyte_equalities.p8:372 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_ubyte_equalities.p8:374 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_ubyte_equalities.p8:377 if x!=255 - lda p8v_x - cmp #255 - bne p8l_lbl2a - ; source: test_ubyte_equalities.p8:379 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:380 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:381 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:383 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:384 if x!=255 - lda p8v_x - cmp #255 - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:386 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:387 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:388 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:390 if x!=255 - lda p8v_x - cmp #255 - beq label_asm_36_afterif - ; source: test_ubyte_equalities.p8:391 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_ubyte_equalities.p8:394 if x!=255 - lda p8v_x - cmp #255 - beq label_asm_38_else - ; source: test_ubyte_equalities.p8:395 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_ubyte_equalities.p8:397 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_ubyte_equalities.p8:399 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:401 if x!=1 - cmp #1 - bne p8l_lbl3a - ; source: test_ubyte_equalities.p8:403 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:404 lbl3a: fail_ubyte(17,1) -p8l_lbl3a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:405 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:407 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:408 if x!=1 - lda p8v_x - cmp #1 - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:410 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:411 lbl3b: fail_ubyte(18,1) -p8l_lbl3b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:412 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:414 if x!=1 - lda p8v_x - cmp #1 - beq label_asm_39_afterif - ; source: test_ubyte_equalities.p8:415 fail_ubyte(19,1) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_39_afterif - ; source: test_ubyte_equalities.p8:418 if x!=1 - lda p8v_x - cmp #1 - beq label_asm_41_else - ; source: test_ubyte_equalities.p8:419 fail_ubyte(20,1) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_40_afterif -label_asm_41_else - ; source: test_ubyte_equalities.p8:421 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_ubyte_equalities.p8:424 if x!=255 - lda p8v_x - cmp #255 - bne p8l_lbl4a - ; source: test_ubyte_equalities.p8:426 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:427 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:428 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:430 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:431 if x!=255 - lda p8v_x - cmp #255 - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:433 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:434 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:435 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:437 if x!=255 - lda p8v_x - cmp #255 - beq label_asm_42_afterif - ; source: test_ubyte_equalities.p8:438 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_ubyte_equalities.p8:441 if x!=255 - lda p8v_x - cmp #255 - beq label_asm_44_else - ; source: test_ubyte_equalities.p8:442 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_ubyte_equalities.p8:444 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_ubyte_equalities.p8:446 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:448 if x!=1 - cmp #1 - bne p8l_lbl5a - ; source: test_ubyte_equalities.p8:450 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:451 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:452 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:454 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:455 if x!=1 - lda p8v_x - cmp #1 - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:457 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:458 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:459 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:461 if x!=1 - lda p8v_x - cmp #1 - beq label_asm_45_afterif - ; source: test_ubyte_equalities.p8:462 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_ubyte_equalities.p8:465 if x!=1 - lda p8v_x - cmp #1 - beq label_asm_47_else - ; source: test_ubyte_equalities.p8:466 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_ubyte_equalities.p8:468 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_ubyte_equalities.p8:471 if x!=255 - lda p8v_x - cmp #255 - bne p8l_lbl6a - ; source: test_ubyte_equalities.p8:473 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:474 lbl6a: fail_ubyte(21,255) -p8l_lbl6a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:475 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:477 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:478 if x!=255 - lda p8v_x - cmp #255 - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:480 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:481 lbl6b: fail_ubyte(22,255) -p8l_lbl6b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:482 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:484 if x!=255 - lda p8v_x - cmp #255 - beq label_asm_48_afterif - ; source: test_ubyte_equalities.p8:485 fail_ubyte(23,255) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_48_afterif - ; source: test_ubyte_equalities.p8:488 if x!=255 - lda p8v_x - cmp #255 - beq label_asm_50_else - ; source: test_ubyte_equalities.p8:489 fail_ubyte(24,255) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_49_afterif -label_asm_50_else - ; source: test_ubyte_equalities.p8:491 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_ubyte_equalities.p8:493 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:349 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:495 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_ubyte_equalities.p8:496 ubyte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_ubyte_equalities.p8:497 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:498 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:499 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_equalities.p8:501 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl1a - ; source: test_ubyte_equalities.p8:503 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:504 lbl1a: fail_ubyte(25,0) -p8l_lbl1a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:505 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:507 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:508 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:510 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:511 lbl1b: fail_ubyte(26,0) -p8l_lbl1b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:512 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:514 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_51_afterif - ; source: test_ubyte_equalities.p8:515 fail_ubyte(27,0) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_51_afterif - ; source: test_ubyte_equalities.p8:518 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_53_else - ; source: test_ubyte_equalities.p8:519 fail_ubyte(28,0) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_52_afterif -label_asm_53_else - ; source: test_ubyte_equalities.p8:521 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_ubyte_equalities.p8:523 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_equalities.p8:525 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl2a - ; source: test_ubyte_equalities.p8:527 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:528 lbl2a: fail_ubyte(29,0) -p8l_lbl2a - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:529 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:531 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:532 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:534 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:535 lbl2b: fail_ubyte(30,0) -p8l_lbl2b - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:536 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:538 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_54_afterif - ; source: test_ubyte_equalities.p8:539 fail_ubyte(31,0) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_54_afterif - ; source: test_ubyte_equalities.p8:542 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_56_else - ; source: test_ubyte_equalities.p8:543 fail_ubyte(32,0) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_55_afterif -label_asm_56_else - ; source: test_ubyte_equalities.p8:545 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_ubyte_equalities.p8:547 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:548 value=1 - sta p8v_value - ; source: test_ubyte_equalities.p8:550 if x==value - cmp p8v_value - beq p8l_lbl3a - ; source: test_ubyte_equalities.p8:552 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:553 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:554 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:556 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:557 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:559 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:560 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:561 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:563 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_57_afterif - ; source: test_ubyte_equalities.p8:564 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_ubyte_equalities.p8:567 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_59_else - ; source: test_ubyte_equalities.p8:568 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_ubyte_equalities.p8:570 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_ubyte_equalities.p8:572 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_equalities.p8:574 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl4a - ; source: test_ubyte_equalities.p8:576 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:577 lbl4a: fail_ubyte(33,1) -p8l_lbl4a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:578 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:580 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:581 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:583 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:584 lbl4b: fail_ubyte(34,1) -p8l_lbl4b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:585 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:587 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_60_afterif - ; source: test_ubyte_equalities.p8:588 fail_ubyte(35,1) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_60_afterif - ; source: test_ubyte_equalities.p8:591 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_62_else - ; source: test_ubyte_equalities.p8:592 fail_ubyte(36,1) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_61_afterif -label_asm_62_else - ; source: test_ubyte_equalities.p8:594 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_ubyte_equalities.p8:596 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:597 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_equalities.p8:599 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl5a - ; source: test_ubyte_equalities.p8:601 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:602 lbl5a: fail_ubyte(37,255) -p8l_lbl5a - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:603 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:605 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:606 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:608 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:609 lbl5b: fail_ubyte(38,255) -p8l_lbl5b - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:610 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:612 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_63_afterif - ; source: test_ubyte_equalities.p8:613 fail_ubyte(39,255) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_63_afterif - ; source: test_ubyte_equalities.p8:616 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_65_else - ; source: test_ubyte_equalities.p8:617 fail_ubyte(40,255) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_64_afterif -label_asm_65_else - ; source: test_ubyte_equalities.p8:619 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_ubyte_equalities.p8:621 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_equalities.p8:623 if x==value - lda p8v_x - cmp p8v_value - beq p8l_lbl6a - ; source: test_ubyte_equalities.p8:625 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:626 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:627 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:629 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:630 if x==value - lda p8v_x - cmp p8v_value - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:632 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:633 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:634 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:636 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_66_afterif - ; source: test_ubyte_equalities.p8:637 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_ubyte_equalities.p8:640 if x==value - lda p8v_x - cmp p8v_value - bne label_asm_68_else - ; source: test_ubyte_equalities.p8:641 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_ubyte_equalities.p8:643 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_ubyte_equalities.p8:645 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:495 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .byte ? -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:647 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_ubyte_equalities.p8:648 ubyte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_ubyte_equalities.p8:649 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:650 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:651 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_equalities.p8:653 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl1a - ; source: test_ubyte_equalities.p8:655 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:656 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:657 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:659 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:660 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:662 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:663 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:664 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:666 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_69_afterif - ; source: test_ubyte_equalities.p8:667 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_ubyte_equalities.p8:670 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_71_else - ; source: test_ubyte_equalities.p8:671 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_ubyte_equalities.p8:673 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_ubyte_equalities.p8:675 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_equalities.p8:677 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl2a - ; source: test_ubyte_equalities.p8:679 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:680 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:681 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:683 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:684 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:686 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:687 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:688 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:690 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_72_afterif - ; source: test_ubyte_equalities.p8:691 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_ubyte_equalities.p8:694 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_74_else - ; source: test_ubyte_equalities.p8:695 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_ubyte_equalities.p8:697 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_ubyte_equalities.p8:699 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:700 value=1 - sta p8v_value - ; source: test_ubyte_equalities.p8:702 if x!=value - cmp p8v_value - bne p8l_lbl3a - ; source: test_ubyte_equalities.p8:704 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:705 lbl3a: fail_ubyte(41,1) -p8l_lbl3a - lda #<$29 - ldy #>$29 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:706 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:708 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:709 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:711 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:712 lbl3b: fail_ubyte(42,1) -p8l_lbl3b - lda #<$2a - ldy #>$2a - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:713 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:715 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_75_afterif - ; source: test_ubyte_equalities.p8:716 fail_ubyte(43,1) - lda #<$2b - ldy #>$2b - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_75_afterif - ; source: test_ubyte_equalities.p8:719 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_77_else - ; source: test_ubyte_equalities.p8:720 fail_ubyte(44,1) - lda #<$2c - ldy #>$2c - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_76_afterif -label_asm_77_else - ; source: test_ubyte_equalities.p8:722 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_ubyte_equalities.p8:724 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_equalities.p8:726 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl4a - ; source: test_ubyte_equalities.p8:728 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:729 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:730 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:732 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:733 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:735 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:736 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:737 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:739 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_78_afterif - ; source: test_ubyte_equalities.p8:740 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_ubyte_equalities.p8:743 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_80_else - ; source: test_ubyte_equalities.p8:744 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_ubyte_equalities.p8:746 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_ubyte_equalities.p8:748 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:749 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_equalities.p8:751 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl5a - ; source: test_ubyte_equalities.p8:753 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:754 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:755 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:757 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:758 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:760 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:761 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:762 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:764 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_81_afterif - ; source: test_ubyte_equalities.p8:765 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_ubyte_equalities.p8:768 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_83_else - ; source: test_ubyte_equalities.p8:769 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_ubyte_equalities.p8:771 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_ubyte_equalities.p8:773 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_equalities.p8:775 if x!=value - lda p8v_x - cmp p8v_value - bne p8l_lbl6a - ; source: test_ubyte_equalities.p8:777 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:778 lbl6a: fail_ubyte(45,255) -p8l_lbl6a - lda #<$2d - ldy #>$2d - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:779 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:781 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:782 if x!=value - lda p8v_x - cmp p8v_value - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:784 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:785 lbl6b: fail_ubyte(46,255) -p8l_lbl6b - lda #<$2e - ldy #>$2e - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:786 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:788 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_84_afterif - ; source: test_ubyte_equalities.p8:789 fail_ubyte(47,255) - lda #<$2f - ldy #>$2f - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_84_afterif - ; source: test_ubyte_equalities.p8:792 if x!=value - lda p8v_x - cmp p8v_value - beq label_asm_86_else - ; source: test_ubyte_equalities.p8:793 fail_ubyte(48,255) - lda #<$30 - ldy #>$30 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_85_afterif -label_asm_86_else - ; source: test_ubyte_equalities.p8:795 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_ubyte_equalities.p8:797 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:647 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .byte ? -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:799 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_ubyte_equalities.p8:800 ubyte @shared x - ; source: test_ubyte_equalities.p8:803 float @shared f4 = 1.0 - ; source: test_ubyte_equalities.p8:804 float @shared f5 = 1.0 - ; source: test_ubyte_equalities.p8:800 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:801 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_ubyte_equalities.p8:802 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_ubyte_equalities.p8:803 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_ubyte_equalities.p8:804 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_ubyte_equalities.p8:805 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:806 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:808 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq p8l_lbl1a - ; source: test_ubyte_equalities.p8:810 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:811 lbl1a: fail_ubyte(49,0) -p8l_lbl1a - lda #<$31 - ldy #>$31 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:812 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:814 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:815 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:817 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:818 lbl1b: fail_ubyte(50,0) -p8l_lbl1b - lda #<$32 - ldy #>$32 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:819 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:821 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_87_afterif - ; source: test_ubyte_equalities.p8:822 fail_ubyte(51,0) - lda #<$33 - ldy #>$33 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_87_afterif - ; source: test_ubyte_equalities.p8:825 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_89_else - ; source: test_ubyte_equalities.p8:826 fail_ubyte(52,0) - lda #<$34 - ldy #>$34 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_88_afterif -label_asm_89_else - ; source: test_ubyte_equalities.p8:828 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_ubyte_equalities.p8:831 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq p8l_lbl2a - ; source: test_ubyte_equalities.p8:833 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:834 lbl2a: fail_ubyte(53,0) -p8l_lbl2a - lda #<$35 - ldy #>$35 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:835 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:837 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:838 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:840 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:841 lbl2b: fail_ubyte(54,0) -p8l_lbl2b - lda #<$36 - ldy #>$36 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:842 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:844 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_90_afterif - ; source: test_ubyte_equalities.p8:845 fail_ubyte(55,0) - lda #<$37 - ldy #>$37 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_90_afterif - ; source: test_ubyte_equalities.p8:848 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_92_else - ; source: test_ubyte_equalities.p8:849 fail_ubyte(56,0) - lda #<$38 - ldy #>$38 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_91_afterif -label_asm_92_else - ; source: test_ubyte_equalities.p8:851 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_ubyte_equalities.p8:853 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:855 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq p8l_lbl3a - ; source: test_ubyte_equalities.p8:857 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:858 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:859 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:861 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:862 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:864 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:865 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:866 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:868 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_93_afterif - ; source: test_ubyte_equalities.p8:869 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_ubyte_equalities.p8:872 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_95_else - ; source: test_ubyte_equalities.p8:873 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_ubyte_equalities.p8:875 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_ubyte_equalities.p8:878 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq p8l_lbl4a - ; source: test_ubyte_equalities.p8:880 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:881 lbl4a: fail_ubyte(57,1) -p8l_lbl4a - lda #<$39 - ldy #>$39 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:882 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:884 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:885 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:887 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:888 lbl4b: fail_ubyte(58,1) -p8l_lbl4b - lda #<$3a - ldy #>$3a - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:889 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:891 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_96_afterif - ; source: test_ubyte_equalities.p8:892 fail_ubyte(59,1) - lda #<$3b - ldy #>$3b - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_96_afterif - ; source: test_ubyte_equalities.p8:895 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_98_else - ; source: test_ubyte_equalities.p8:896 fail_ubyte(60,1) - lda #<$3c - ldy #>$3c - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_97_afterif -label_asm_98_else - ; source: test_ubyte_equalities.p8:898 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_ubyte_equalities.p8:900 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:902 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq p8l_lbl5a - ; source: test_ubyte_equalities.p8:904 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:905 lbl5a: fail_ubyte(61,255) -p8l_lbl5a - lda #<$3d - ldy #>$3d - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:906 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:908 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:909 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:911 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:912 lbl5b: fail_ubyte(62,255) -p8l_lbl5b - lda #<$3e - ldy #>$3e - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:913 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:915 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_99_afterif - ; source: test_ubyte_equalities.p8:916 fail_ubyte(63,255) - lda #<$3f - ldy #>$3f - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_99_afterif - ; source: test_ubyte_equalities.p8:919 if x==cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_101_else - ; source: test_ubyte_equalities.p8:920 fail_ubyte(64,255) - lda #<$40 - ldy #>$40 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_100_afterif -label_asm_101_else - ; source: test_ubyte_equalities.p8:922 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_ubyte_equalities.p8:925 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq p8l_lbl6a - ; source: test_ubyte_equalities.p8:927 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:928 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:929 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:931 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:932 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:934 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:935 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:936 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:938 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_102_afterif - ; source: test_ubyte_equalities.p8:939 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_ubyte_equalities.p8:942 if x==cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne label_asm_104_else - ; source: test_ubyte_equalities.p8:943 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_ubyte_equalities.p8:945 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_ubyte_equalities.p8:947 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:799 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:949 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_ubyte_equalities.p8:950 ubyte @shared x - ; source: test_ubyte_equalities.p8:953 float @shared f4 = 1.0 - ; source: test_ubyte_equalities.p8:954 float @shared f5 = 1.0 - ; source: test_ubyte_equalities.p8:950 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:951 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_ubyte_equalities.p8:952 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_ubyte_equalities.p8:953 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_ubyte_equalities.p8:954 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_ubyte_equalities.p8:955 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:956 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:958 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne p8l_lbl1a - ; source: test_ubyte_equalities.p8:960 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:961 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:962 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:964 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:965 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:967 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:968 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:969 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:971 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_105_afterif - ; source: test_ubyte_equalities.p8:972 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_ubyte_equalities.p8:975 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_107_else - ; source: test_ubyte_equalities.p8:976 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_ubyte_equalities.p8:978 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_ubyte_equalities.p8:981 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne p8l_lbl2a - ; source: test_ubyte_equalities.p8:983 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:984 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:985 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:987 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:988 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:990 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:991 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:992 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:994 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_108_afterif - ; source: test_ubyte_equalities.p8:995 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_ubyte_equalities.p8:998 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_110_else - ; source: test_ubyte_equalities.p8:999 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_ubyte_equalities.p8:1001 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_ubyte_equalities.p8:1003 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:1005 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne p8l_lbl3a - ; source: test_ubyte_equalities.p8:1007 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:1008 lbl3a: fail_ubyte(65,1) -p8l_lbl3a - lda #<$41 - ldy #>$41 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1009 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:1011 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1012 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1014 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:1015 lbl3b: fail_ubyte(66,1) -p8l_lbl3b - lda #<$42 - ldy #>$42 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1016 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:1018 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_111_afterif - ; source: test_ubyte_equalities.p8:1019 fail_ubyte(67,1) - lda #<$43 - ldy #>$43 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_111_afterif - ; source: test_ubyte_equalities.p8:1022 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_113_else - ; source: test_ubyte_equalities.p8:1023 fail_ubyte(68,1) - lda #<$44 - ldy #>$44 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_112_afterif -label_asm_113_else - ; source: test_ubyte_equalities.p8:1025 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_ubyte_equalities.p8:1028 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne p8l_lbl4a - ; source: test_ubyte_equalities.p8:1030 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:1031 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1032 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:1034 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1035 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1037 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:1038 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1039 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:1041 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_114_afterif - ; source: test_ubyte_equalities.p8:1042 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_ubyte_equalities.p8:1045 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_116_else - ; source: test_ubyte_equalities.p8:1046 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_ubyte_equalities.p8:1048 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_ubyte_equalities.p8:1050 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:1052 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bne p8l_lbl5a - ; source: test_ubyte_equalities.p8:1054 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:1055 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1056 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:1058 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1059 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1061 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:1062 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1063 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:1065 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_117_afterif - ; source: test_ubyte_equalities.p8:1066 success++ - inc p8b_main.p8v_success -label_asm_117_afterif - ; source: test_ubyte_equalities.p8:1069 if x!=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_119_else - ; source: test_ubyte_equalities.p8:1070 success++ - inc p8b_main.p8v_success - bra label_asm_118_afterif -label_asm_119_else - ; source: test_ubyte_equalities.p8:1072 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_ubyte_equalities.p8:1075 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bne p8l_lbl6a - ; source: test_ubyte_equalities.p8:1077 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:1078 lbl6a: fail_ubyte(69,255) -p8l_lbl6a - lda #<$45 - ldy #>$45 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1079 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:1081 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1082 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1084 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:1085 lbl6b: fail_ubyte(70,255) -p8l_lbl6b - lda #<$46 - ldy #>$46 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1086 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:1088 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_120_afterif - ; source: test_ubyte_equalities.p8:1089 fail_ubyte(71,255) - lda #<$47 - ldy #>$47 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_120_afterif - ; source: test_ubyte_equalities.p8:1092 if x!=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - beq label_asm_122_else - ; source: test_ubyte_equalities.p8:1093 fail_ubyte(72,255) - lda #<$48 - ldy #>$48 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_121_afterif -label_asm_122_else - ; source: test_ubyte_equalities.p8:1095 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_ubyte_equalities.p8:1097 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:949 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_equalities.p8:1099 sub test_is_array() { - -p8s_test_is_array .proc -; statements - ; source: test_ubyte_equalities.p8:1100 ubyte @shared x - ; source: test_ubyte_equalities.p8:1101 ubyte[] values = [0, 0] - ; source: test_ubyte_equalities.p8:1102 ubyte[] sources = [0, 0] - ; source: test_ubyte_equalities.p8:1100 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:1103 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1104 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:1105 sources[1]=0 - stz p8v_sources+1 - ; source: test_ubyte_equalities.p8:1106 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1108 if x==values[1] - cmp p8v_x - beq p8l_lbl1a - ; source: test_ubyte_equalities.p8:1110 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:1111 lbl1a: fail_ubyte(73,0) -p8l_lbl1a - lda #<$49 - ldy #>$49 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1112 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:1114 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1115 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1117 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:1118 lbl1b: fail_ubyte(74,0) -p8l_lbl1b - lda #<$4a - ldy #>$4a - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1119 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:1121 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_123_afterif - ; source: test_ubyte_equalities.p8:1122 fail_ubyte(75,0) - lda #<$4b - ldy #>$4b - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_123_afterif - ; source: test_ubyte_equalities.p8:1125 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_125_else - ; source: test_ubyte_equalities.p8:1126 fail_ubyte(76,0) - lda #<$4c - ldy #>$4c - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_124_afterif -label_asm_125_else - ; source: test_ubyte_equalities.p8:1128 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_ubyte_equalities.p8:1131 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl1c - ; source: test_ubyte_equalities.p8:1133 goto skip1c - bra p8l_skip1c - ; source: test_ubyte_equalities.p8:1134 lbl1c: fail_ubyte(77,0) -p8l_lbl1c - lda #<$4d - ldy #>$4d - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1135 skip1c: -p8l_skip1c - ; source: test_ubyte_equalities.p8:1137 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1138 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1140 goto skip1d - bra p8l_skip1d - ; source: test_ubyte_equalities.p8:1141 lbl1d: fail_ubyte(78,0) -p8l_lbl1d - lda #<$4e - ldy #>$4e - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1142 skip1d: -p8l_skip1d - ; source: test_ubyte_equalities.p8:1144 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_126_afterif - ; source: test_ubyte_equalities.p8:1145 fail_ubyte(79,0) - lda #<$4f - ldy #>$4f - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_126_afterif - ; source: test_ubyte_equalities.p8:1148 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_128_else - ; source: test_ubyte_equalities.p8:1149 fail_ubyte(80,0) - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_127_afterif -label_asm_128_else - ; source: test_ubyte_equalities.p8:1151 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_ubyte_equalities.p8:1153 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1155 if x==values[1] - cmp p8v_x - beq p8l_lbl2a - ; source: test_ubyte_equalities.p8:1157 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:1158 lbl2a: fail_ubyte(81,0) -p8l_lbl2a - lda #<$51 - ldy #>$51 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1159 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:1161 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1162 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1164 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:1165 lbl2b: fail_ubyte(82,0) -p8l_lbl2b - lda #<$52 - ldy #>$52 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1166 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:1168 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_129_afterif - ; source: test_ubyte_equalities.p8:1169 fail_ubyte(83,0) - lda #<$53 - ldy #>$53 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_129_afterif - ; source: test_ubyte_equalities.p8:1172 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_131_else - ; source: test_ubyte_equalities.p8:1173 fail_ubyte(84,0) - lda #<$54 - ldy #>$54 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_130_afterif -label_asm_131_else - ; source: test_ubyte_equalities.p8:1175 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_ubyte_equalities.p8:1178 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl2c - ; source: test_ubyte_equalities.p8:1180 goto skip2c - bra p8l_skip2c - ; source: test_ubyte_equalities.p8:1181 lbl2c: fail_ubyte(85,0) -p8l_lbl2c - lda #<$55 - ldy #>$55 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1182 skip2c: -p8l_skip2c - ; source: test_ubyte_equalities.p8:1184 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1185 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1187 goto skip2d - bra p8l_skip2d - ; source: test_ubyte_equalities.p8:1188 lbl2d: fail_ubyte(86,0) -p8l_lbl2d - lda #<$56 - ldy #>$56 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1189 skip2d: -p8l_skip2d - ; source: test_ubyte_equalities.p8:1191 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_132_afterif - ; source: test_ubyte_equalities.p8:1192 fail_ubyte(87,0) - lda #<$57 - ldy #>$57 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_132_afterif - ; source: test_ubyte_equalities.p8:1195 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_134_else - ; source: test_ubyte_equalities.p8:1196 fail_ubyte(88,0) - lda #<$58 - ldy #>$58 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - stz p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_133_afterif -label_asm_134_else - ; source: test_ubyte_equalities.p8:1198 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_ubyte_equalities.p8:1200 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:1201 sources[1]=1 - sta p8v_sources+1 - ; source: test_ubyte_equalities.p8:1202 values[1]=1 - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1204 if x==values[1] - cmp p8v_x - beq p8l_lbl3a - ; source: test_ubyte_equalities.p8:1206 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:1207 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1208 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:1210 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1211 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1213 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:1214 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1215 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:1217 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_135_afterif - ; source: test_ubyte_equalities.p8:1218 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_ubyte_equalities.p8:1221 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_137_else - ; source: test_ubyte_equalities.p8:1222 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_ubyte_equalities.p8:1224 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_ubyte_equalities.p8:1227 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl3c - ; source: test_ubyte_equalities.p8:1229 goto skip3c - bra p8l_skip3c - ; source: test_ubyte_equalities.p8:1230 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1231 skip3c: -p8l_skip3c - ; source: test_ubyte_equalities.p8:1233 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1234 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1236 goto skip3d - bra p8l_skip3d - ; source: test_ubyte_equalities.p8:1237 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1238 skip3d: -p8l_skip3d - ; source: test_ubyte_equalities.p8:1240 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_138_afterif - ; source: test_ubyte_equalities.p8:1241 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_ubyte_equalities.p8:1244 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_140_else - ; source: test_ubyte_equalities.p8:1245 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_ubyte_equalities.p8:1247 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_ubyte_equalities.p8:1249 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1251 if x==values[1] - cmp p8v_x - beq p8l_lbl4a - ; source: test_ubyte_equalities.p8:1253 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:1254 lbl4a: fail_ubyte(89,1) -p8l_lbl4a - lda #<$59 - ldy #>$59 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1255 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:1257 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1258 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1260 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:1261 lbl4b: fail_ubyte(90,1) -p8l_lbl4b - lda #<$5a - ldy #>$5a - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1262 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:1264 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_141_afterif - ; source: test_ubyte_equalities.p8:1265 fail_ubyte(91,1) - lda #<$5b - ldy #>$5b - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_141_afterif - ; source: test_ubyte_equalities.p8:1268 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_143_else - ; source: test_ubyte_equalities.p8:1269 fail_ubyte(92,1) - lda #<$5c - ldy #>$5c - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_142_afterif -label_asm_143_else - ; source: test_ubyte_equalities.p8:1271 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_ubyte_equalities.p8:1274 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl4c - ; source: test_ubyte_equalities.p8:1276 goto skip4c - bra p8l_skip4c - ; source: test_ubyte_equalities.p8:1277 lbl4c: fail_ubyte(93,1) -p8l_lbl4c - lda #<$5d - ldy #>$5d - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1278 skip4c: -p8l_skip4c - ; source: test_ubyte_equalities.p8:1280 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1281 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1283 goto skip4d - bra p8l_skip4d - ; source: test_ubyte_equalities.p8:1284 lbl4d: fail_ubyte(94,1) -p8l_lbl4d - lda #<$5e - ldy #>$5e - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1285 skip4d: -p8l_skip4d - ; source: test_ubyte_equalities.p8:1287 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_144_afterif - ; source: test_ubyte_equalities.p8:1288 fail_ubyte(95,1) - lda #<$5f - ldy #>$5f - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_144_afterif - ; source: test_ubyte_equalities.p8:1291 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_146_else - ; source: test_ubyte_equalities.p8:1292 fail_ubyte(96,1) - lda #<$60 - ldy #>$60 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_145_afterif -label_asm_146_else - ; source: test_ubyte_equalities.p8:1294 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_ubyte_equalities.p8:1296 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:1297 sources[1]=255 - sta p8v_sources+1 - ; source: test_ubyte_equalities.p8:1298 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1300 if x==values[1] - cmp p8v_x - beq p8l_lbl5a - ; source: test_ubyte_equalities.p8:1302 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:1303 lbl5a: fail_ubyte(97,255) -p8l_lbl5a - lda #<$61 - ldy #>$61 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1304 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:1306 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1307 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1309 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:1310 lbl5b: fail_ubyte(98,255) -p8l_lbl5b - lda #<$62 - ldy #>$62 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1311 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:1313 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_147_afterif - ; source: test_ubyte_equalities.p8:1314 fail_ubyte(99,255) - lda #<$63 - ldy #>$63 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_147_afterif - ; source: test_ubyte_equalities.p8:1317 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_149_else - ; source: test_ubyte_equalities.p8:1318 fail_ubyte(100,255) - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_148_afterif -label_asm_149_else - ; source: test_ubyte_equalities.p8:1320 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_ubyte_equalities.p8:1323 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl5c - ; source: test_ubyte_equalities.p8:1325 goto skip5c - bra p8l_skip5c - ; source: test_ubyte_equalities.p8:1326 lbl5c: fail_ubyte(101,255) -p8l_lbl5c - lda #<$65 - ldy #>$65 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1327 skip5c: -p8l_skip5c - ; source: test_ubyte_equalities.p8:1329 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1330 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1332 goto skip5d - bra p8l_skip5d - ; source: test_ubyte_equalities.p8:1333 lbl5d: fail_ubyte(102,255) -p8l_lbl5d - lda #<$66 - ldy #>$66 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1334 skip5d: -p8l_skip5d - ; source: test_ubyte_equalities.p8:1336 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_150_afterif - ; source: test_ubyte_equalities.p8:1337 fail_ubyte(103,255) - lda #<$67 - ldy #>$67 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_150_afterif - ; source: test_ubyte_equalities.p8:1340 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_152_else - ; source: test_ubyte_equalities.p8:1341 fail_ubyte(104,255) - lda #<$68 - ldy #>$68 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_151_afterif -label_asm_152_else - ; source: test_ubyte_equalities.p8:1343 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_ubyte_equalities.p8:1345 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1347 if x==values[1] - cmp p8v_x - beq p8l_lbl6a - ; source: test_ubyte_equalities.p8:1349 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:1350 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1351 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:1353 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1354 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1356 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:1357 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1358 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:1360 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_153_afterif - ; source: test_ubyte_equalities.p8:1361 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_ubyte_equalities.p8:1364 if x==values[1] - lda p8v_values+1 - cmp p8v_x - bne label_asm_155_else - ; source: test_ubyte_equalities.p8:1365 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_ubyte_equalities.p8:1367 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_ubyte_equalities.p8:1370 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq p8l_lbl6c - ; source: test_ubyte_equalities.p8:1372 goto skip6c - bra p8l_skip6c - ; source: test_ubyte_equalities.p8:1373 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1374 skip6c: -p8l_skip6c - ; source: test_ubyte_equalities.p8:1376 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1377 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1379 goto skip6d - bra p8l_skip6d - ; source: test_ubyte_equalities.p8:1380 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1381 skip6d: -p8l_skip6d - ; source: test_ubyte_equalities.p8:1383 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_156_afterif - ; source: test_ubyte_equalities.p8:1384 success++ - inc p8b_main.p8v_success -label_asm_156_afterif - ; source: test_ubyte_equalities.p8:1387 if sources[1]==values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne label_asm_158_else - ; source: test_ubyte_equalities.p8:1388 success++ - inc p8b_main.p8v_success - bra label_asm_157_afterif -label_asm_158_else - ; source: test_ubyte_equalities.p8:1390 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_ubyte_equalities.p8:1392 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:1099 sub test_is_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS -; non-zeropage variables -p8v_sources .byte $00, $00 -p8v_values .byte $00, $00 - .pend - ; source: test_ubyte_equalities.p8:1394 sub test_not_array() { - -p8s_test_not_array .proc -; statements - ; source: test_ubyte_equalities.p8:1395 ubyte @shared x - ; source: test_ubyte_equalities.p8:1396 ubyte[] values = [0, 0] - ; source: test_ubyte_equalities.p8:1397 ubyte[] sources = [0, 0] - ; source: test_ubyte_equalities.p8:1395 ubyte @shared x - stz p8v_x - ; source: test_ubyte_equalities.p8:1398 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1399 x=0 - stz p8v_x - ; source: test_ubyte_equalities.p8:1400 sources[1]=0 - stz p8v_sources+1 - ; source: test_ubyte_equalities.p8:1401 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1403 if x!=values[1] - cmp p8v_x - bne p8l_lbl1a - ; source: test_ubyte_equalities.p8:1405 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_equalities.p8:1406 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1407 skip1a: -p8l_skip1a - ; source: test_ubyte_equalities.p8:1409 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1410 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1412 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_equalities.p8:1413 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1414 skip1b: -p8l_skip1b - ; source: test_ubyte_equalities.p8:1416 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_159_afterif - ; source: test_ubyte_equalities.p8:1417 success++ - inc p8b_main.p8v_success -label_asm_159_afterif - ; source: test_ubyte_equalities.p8:1420 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_161_else - ; source: test_ubyte_equalities.p8:1421 success++ - inc p8b_main.p8v_success - bra label_asm_160_afterif -label_asm_161_else - ; source: test_ubyte_equalities.p8:1423 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_ubyte_equalities.p8:1426 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl1c - ; source: test_ubyte_equalities.p8:1428 goto skip1c - bra p8l_skip1c - ; source: test_ubyte_equalities.p8:1429 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1430 skip1c: -p8l_skip1c - ; source: test_ubyte_equalities.p8:1432 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1433 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1435 goto skip1d - bra p8l_skip1d - ; source: test_ubyte_equalities.p8:1436 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1437 skip1d: -p8l_skip1d - ; source: test_ubyte_equalities.p8:1439 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_162_afterif - ; source: test_ubyte_equalities.p8:1440 success++ - inc p8b_main.p8v_success -label_asm_162_afterif - ; source: test_ubyte_equalities.p8:1443 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_164_else - ; source: test_ubyte_equalities.p8:1444 success++ - inc p8b_main.p8v_success - bra label_asm_163_afterif -label_asm_164_else - ; source: test_ubyte_equalities.p8:1446 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_ubyte_equalities.p8:1448 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1450 if x!=values[1] - cmp p8v_x - bne p8l_lbl2a - ; source: test_ubyte_equalities.p8:1452 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_equalities.p8:1453 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1454 skip2a: -p8l_skip2a - ; source: test_ubyte_equalities.p8:1456 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1457 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1459 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_equalities.p8:1460 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1461 skip2b: -p8l_skip2b - ; source: test_ubyte_equalities.p8:1463 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_165_afterif - ; source: test_ubyte_equalities.p8:1464 success++ - inc p8b_main.p8v_success -label_asm_165_afterif - ; source: test_ubyte_equalities.p8:1467 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_167_else - ; source: test_ubyte_equalities.p8:1468 success++ - inc p8b_main.p8v_success - bra label_asm_166_afterif -label_asm_167_else - ; source: test_ubyte_equalities.p8:1470 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_ubyte_equalities.p8:1473 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl2c - ; source: test_ubyte_equalities.p8:1475 goto skip2c - bra p8l_skip2c - ; source: test_ubyte_equalities.p8:1476 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1477 skip2c: -p8l_skip2c - ; source: test_ubyte_equalities.p8:1479 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1480 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1482 goto skip2d - bra p8l_skip2d - ; source: test_ubyte_equalities.p8:1483 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1484 skip2d: -p8l_skip2d - ; source: test_ubyte_equalities.p8:1486 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_168_afterif - ; source: test_ubyte_equalities.p8:1487 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_ubyte_equalities.p8:1490 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_170_else - ; source: test_ubyte_equalities.p8:1491 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_ubyte_equalities.p8:1493 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_ubyte_equalities.p8:1495 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_equalities.p8:1496 sources[1]=1 - sta p8v_sources+1 - ; source: test_ubyte_equalities.p8:1497 values[1]=1 - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1499 if x!=values[1] - cmp p8v_x - bne p8l_lbl3a - ; source: test_ubyte_equalities.p8:1501 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_equalities.p8:1502 lbl3a: fail_ubyte(105,1) -p8l_lbl3a - lda #<$69 - ldy #>$69 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1503 skip3a: -p8l_skip3a - ; source: test_ubyte_equalities.p8:1505 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1506 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1508 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_equalities.p8:1509 lbl3b: fail_ubyte(106,1) -p8l_lbl3b - lda #<$6a - ldy #>$6a - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1510 skip3b: -p8l_skip3b - ; source: test_ubyte_equalities.p8:1512 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_171_afterif - ; source: test_ubyte_equalities.p8:1513 fail_ubyte(107,1) - lda #<$6b - ldy #>$6b - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_171_afterif - ; source: test_ubyte_equalities.p8:1516 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_173_else - ; source: test_ubyte_equalities.p8:1517 fail_ubyte(108,1) - lda #<$6c - ldy #>$6c - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_172_afterif -label_asm_173_else - ; source: test_ubyte_equalities.p8:1519 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_ubyte_equalities.p8:1522 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl3c - ; source: test_ubyte_equalities.p8:1524 goto skip3c - bra p8l_skip3c - ; source: test_ubyte_equalities.p8:1525 lbl3c: fail_ubyte(109,1) -p8l_lbl3c - lda #<$6d - ldy #>$6d - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1526 skip3c: -p8l_skip3c - ; source: test_ubyte_equalities.p8:1528 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1529 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1531 goto skip3d - bra p8l_skip3d - ; source: test_ubyte_equalities.p8:1532 lbl3d: fail_ubyte(110,1) -p8l_lbl3d - lda #<$6e - ldy #>$6e - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1533 skip3d: -p8l_skip3d - ; source: test_ubyte_equalities.p8:1535 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_174_afterif - ; source: test_ubyte_equalities.p8:1536 fail_ubyte(111,1) - lda #<$6f - ldy #>$6f - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_174_afterif - ; source: test_ubyte_equalities.p8:1539 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_176_else - ; source: test_ubyte_equalities.p8:1540 fail_ubyte(112,1) - lda #<$70 - ldy #>$70 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #1 - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_175_afterif -label_asm_176_else - ; source: test_ubyte_equalities.p8:1542 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_ubyte_equalities.p8:1544 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1546 if x!=values[1] - cmp p8v_x - bne p8l_lbl4a - ; source: test_ubyte_equalities.p8:1548 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_equalities.p8:1549 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1550 skip4a: -p8l_skip4a - ; source: test_ubyte_equalities.p8:1552 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1553 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1555 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_equalities.p8:1556 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1557 skip4b: -p8l_skip4b - ; source: test_ubyte_equalities.p8:1559 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_177_afterif - ; source: test_ubyte_equalities.p8:1560 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_ubyte_equalities.p8:1563 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_179_else - ; source: test_ubyte_equalities.p8:1564 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_ubyte_equalities.p8:1566 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_ubyte_equalities.p8:1569 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl4c - ; source: test_ubyte_equalities.p8:1571 goto skip4c - bra p8l_skip4c - ; source: test_ubyte_equalities.p8:1572 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1573 skip4c: -p8l_skip4c - ; source: test_ubyte_equalities.p8:1575 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1576 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1578 goto skip4d - bra p8l_skip4d - ; source: test_ubyte_equalities.p8:1579 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1580 skip4d: -p8l_skip4d - ; source: test_ubyte_equalities.p8:1582 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_180_afterif - ; source: test_ubyte_equalities.p8:1583 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_ubyte_equalities.p8:1586 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_182_else - ; source: test_ubyte_equalities.p8:1587 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_ubyte_equalities.p8:1589 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_ubyte_equalities.p8:1591 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_equalities.p8:1592 sources[1]=255 - sta p8v_sources+1 - ; source: test_ubyte_equalities.p8:1593 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1595 if x!=values[1] - cmp p8v_x - bne p8l_lbl5a - ; source: test_ubyte_equalities.p8:1597 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_equalities.p8:1598 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1599 skip5a: -p8l_skip5a - ; source: test_ubyte_equalities.p8:1601 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1602 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1604 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_equalities.p8:1605 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1606 skip5b: -p8l_skip5b - ; source: test_ubyte_equalities.p8:1608 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_183_afterif - ; source: test_ubyte_equalities.p8:1609 success++ - inc p8b_main.p8v_success -label_asm_183_afterif - ; source: test_ubyte_equalities.p8:1612 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_185_else - ; source: test_ubyte_equalities.p8:1613 success++ - inc p8b_main.p8v_success - bra label_asm_184_afterif -label_asm_185_else - ; source: test_ubyte_equalities.p8:1615 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_ubyte_equalities.p8:1618 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl5c - ; source: test_ubyte_equalities.p8:1620 goto skip5c - bra p8l_skip5c - ; source: test_ubyte_equalities.p8:1621 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1622 skip5c: -p8l_skip5c - ; source: test_ubyte_equalities.p8:1624 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1625 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1627 goto skip5d - bra p8l_skip5d - ; source: test_ubyte_equalities.p8:1628 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - ; source: test_ubyte_equalities.p8:1629 skip5d: -p8l_skip5d - ; source: test_ubyte_equalities.p8:1631 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_186_afterif - ; source: test_ubyte_equalities.p8:1632 success++ - inc p8b_main.p8v_success -label_asm_186_afterif - ; source: test_ubyte_equalities.p8:1635 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_188_else - ; source: test_ubyte_equalities.p8:1636 success++ - inc p8b_main.p8v_success - bra label_asm_187_afterif -label_asm_188_else - ; source: test_ubyte_equalities.p8:1638 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_ubyte_equalities.p8:1640 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_equalities.p8:1642 if x!=values[1] - cmp p8v_x - bne p8l_lbl6a - ; source: test_ubyte_equalities.p8:1644 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_equalities.p8:1645 lbl6a: fail_ubyte(113,255) -p8l_lbl6a - lda #<$71 - ldy #>$71 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1646 skip6a: -p8l_skip6a - ; source: test_ubyte_equalities.p8:1648 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1649 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1651 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_equalities.p8:1652 lbl6b: fail_ubyte(114,255) -p8l_lbl6b - lda #<$72 - ldy #>$72 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1653 skip6b: -p8l_skip6b - ; source: test_ubyte_equalities.p8:1655 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_189_afterif - ; source: test_ubyte_equalities.p8:1656 fail_ubyte(115,255) - lda #<$73 - ldy #>$73 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_189_afterif - ; source: test_ubyte_equalities.p8:1659 if x!=values[1] - lda p8v_values+1 - cmp p8v_x - beq label_asm_191_else - ; source: test_ubyte_equalities.p8:1660 fail_ubyte(116,255) - lda #<$74 - ldy #>$74 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_190_afterif -label_asm_191_else - ; source: test_ubyte_equalities.p8:1662 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_ubyte_equalities.p8:1665 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - bne p8l_lbl6c - ; source: test_ubyte_equalities.p8:1667 goto skip6c - bra p8l_skip6c - ; source: test_ubyte_equalities.p8:1668 lbl6c: fail_ubyte(117,255) -p8l_lbl6c - lda #<$75 - ldy #>$75 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1669 skip6c: -p8l_skip6c - ; source: test_ubyte_equalities.p8:1671 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_equalities.p8:1672 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_equalities.p8:1674 goto skip6d - bra p8l_skip6d - ; source: test_ubyte_equalities.p8:1675 lbl6d: fail_ubyte(118,255) -p8l_lbl6d - lda #<$76 - ldy #>$76 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_equalities.p8:1676 skip6d: -p8l_skip6d - ; source: test_ubyte_equalities.p8:1678 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_192_afterif - ; source: test_ubyte_equalities.p8:1679 fail_ubyte(119,255) - lda #<$77 - ldy #>$77 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte -label_asm_192_afterif - ; source: test_ubyte_equalities.p8:1682 if sources[1]!=values[1] - lda p8v_sources+1 - ldy #1 - cmp p8v_values,y - beq label_asm_194_else - ; source: test_ubyte_equalities.p8:1683 fail_ubyte(120,255) - lda #<$78 - ldy #>$78 - sta p8b_main.p8s_fail_ubyte.p8v_idx - sty p8b_main.p8s_fail_ubyte.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_ubyte.p8v_v1 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_193_afterif -label_asm_194_else - ; source: test_ubyte_equalities.p8:1685 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_ubyte_equalities.p8:1687 verify_success(32) - lda #$20 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_equalities.p8:1394 sub test_not_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS -; non-zeropage variables -p8v_sources .byte $00, $00 -p8v_values .byte $00, $00 - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $44, $41, $54, $41, $54, $59, $50, $45 - .byte $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[]: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[]: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 - - ; source: test_ubyte_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ; source: test_ubyte_equalities.p8:18 txt.print("==0: ") - ; source: test_ubyte_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_ubyte_equalities.p8:22 txt.print("\n==number: ") - ; source: test_ubyte_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_ubyte_equalities.p8:26 txt.print("\n==var: ") - ; source: test_ubyte_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_ubyte_equalities.p8:30 txt.print("\n==array[]: ") - ; source: test_ubyte_equalities.p8:32 txt.print("\n!=array[]: ") - ; source: test_ubyte_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_ubyte_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_ubyte_equalities.p8:45 txt.print(" **failed** ") - ; source: test_ubyte_equalities.p8:47 txt.print(" success, expected ") - ; source: test_ubyte_equalities.p8:53 txt.print(" **fail#") - ; source: test_ubyte_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_ubyte_equalities.p8 b/compiler/test/comparisons/test_ubyte_equalities.p8 deleted file mode 100644 index fe324dc93..000000000 --- a/compiler/test/comparisons/test_ubyte_equalities.p8 +++ /dev/null @@ -1,1691 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "ubyte" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[]: ") - test_is_array() - txt.print("\n!=array[]: ") - test_not_array() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx, byte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_b(v1) - txt.print(" **") - } - - sub fail_ubyte(uword idx, ubyte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_ub(v1) - txt.print(" **") - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - sub fail_float(uword idx, float v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - floats.print(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - ubyte @shared x - success = 0 - - x=0 - ; direct jump - if x==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x==0 - success++ - - ; with else - if x==0 - success++ - else - cx16.r0L++ - - x = 100 - ; direct jump - if x==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x==0 - success-- - - ; with else - if x==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - ubyte @shared x - success = 0 - - x=100 - ; direct jump - if x!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x!=0 - success++ - - ; with else - if x!=0 - success++ - else - cx16.r0L++ - - x = 0 - ; direct jump - if x!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x!=0 - success-- - - ; with else - if x!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - ubyte @shared x - success = 0 - x=0 - ; direct jump - if x==1 - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(1,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==1 - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(2,0) -skip1b: - ; no else - if x==1 - fail_ubyte(3,0) - - ; with else - if x==1 - fail_ubyte(4,0) - else - cx16.r0L++ - - ; direct jump - if x==255 - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(5,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==255 - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(6,0) -skip2b: - ; no else - if x==255 - fail_ubyte(7,0) - - ; with else - if x==255 - fail_ubyte(8,0) - else - cx16.r0L++ - - x=1 - ; direct jump - if x==1 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==1 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x==1 - success++ - - ; with else - if x==1 - success++ - else - cx16.r0L++ - - ; direct jump - if x==255 - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(9,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==255 - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(10,1) -skip4b: - ; no else - if x==255 - fail_ubyte(11,1) - - ; with else - if x==255 - fail_ubyte(12,1) - else - cx16.r0L++ - - x=255 - ; direct jump - if x==1 - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(13,255) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==1 - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(14,255) -skip5b: - ; no else - if x==1 - fail_ubyte(15,255) - - ; with else - if x==1 - fail_ubyte(16,255) - else - cx16.r0L++ - - ; direct jump - if x==255 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==255 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==255 - success++ - - ; with else - if x==255 - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_number() { - ubyte @shared x - success = 0 - x=0 - ; direct jump - if x!=1 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=1 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=1 - success++ - - ; with else - if x!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=255 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=255 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=255 - success++ - - ; with else - if x!=255 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x!=1 - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(17,1) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=1 - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(18,1) -skip3b: - ; no else - if x!=1 - fail_ubyte(19,1) - - ; with else - if x!=1 - fail_ubyte(20,1) - else - cx16.r0L++ - - ; direct jump - if x!=255 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=255 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=255 - success++ - - ; with else - if x!=255 - success++ - else - cx16.r0L++ - - x=255 - ; direct jump - if x!=1 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=1 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=1 - success++ - - ; with else - if x!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=255 - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(21,255) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=255 - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(22,255) -skip6b: - ; no else - if x!=255 - fail_ubyte(23,255) - - ; with else - if x!=255 - fail_ubyte(24,255) - else - cx16.r0L++ - - verify_success(16) -} - sub test_is_var() { - ubyte @shared x, value - success = 0 - x=0 - value=1 - ; direct jump - if x==value - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(25,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==value - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(26,0) -skip1b: - ; no else - if x==value - fail_ubyte(27,0) - - ; with else - if x==value - fail_ubyte(28,0) - else - cx16.r0L++ - - value=255 - ; direct jump - if x==value - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(29,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==value - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(30,0) -skip2b: - ; no else - if x==value - fail_ubyte(31,0) - - ; with else - if x==value - fail_ubyte(32,0) - else - cx16.r0L++ - - x=1 - value=1 - ; direct jump - if x==value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x==value - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(33,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==value - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(34,1) -skip4b: - ; no else - if x==value - fail_ubyte(35,1) - - ; with else - if x==value - fail_ubyte(36,1) - else - cx16.r0L++ - - x=255 - value=1 - ; direct jump - if x==value - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(37,255) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==value - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(38,255) -skip5b: - ; no else - if x==value - fail_ubyte(39,255) - - ; with else - if x==value - fail_ubyte(40,255) - else - cx16.r0L++ - - value=255 - ; direct jump - if x==value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_var() { - ubyte @shared x, value - success = 0 - x=0 - value=1 - ; direct jump - if x!=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x!=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=1 - value=1 - ; direct jump - if x!=value - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(41,1) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=value - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(42,1) -skip3b: - ; no else - if x!=value - fail_ubyte(43,1) - - ; with else - if x!=value - fail_ubyte(44,1) - else - cx16.r0L++ - - value=255 - ; direct jump - if x!=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=255 - value=1 - ; direct jump - if x!=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x!=value - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(45,255) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=value - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(46,255) -skip6b: - ; no else - if x!=value - fail_ubyte(47,255) - - ; with else - if x!=value - fail_ubyte(48,255) - else - cx16.r0L++ - - verify_success(16) -} - sub test_is_expr() { - ubyte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x==cx16.r4L+1-cx16.r5L - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(49,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(50,0) -skip1b: - ; no else - if x==cx16.r4L+1-cx16.r5L - fail_ubyte(51,0) - - ; with else - if x==cx16.r4L+1-cx16.r5L - fail_ubyte(52,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4L+255-cx16.r5L - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(53,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(54,0) -skip2b: - ; no else - if x==cx16.r4L+255-cx16.r5L - fail_ubyte(55,0) - - ; with else - if x==cx16.r4L+255-cx16.r5L - fail_ubyte(56,0) - else - cx16.r0L++ - - x=1 - ; direct jump - if x==cx16.r4L+1-cx16.r5L - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x==cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x==cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4L+255-cx16.r5L - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(57,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(58,1) -skip4b: - ; no else - if x==cx16.r4L+255-cx16.r5L - fail_ubyte(59,1) - - ; with else - if x==cx16.r4L+255-cx16.r5L - fail_ubyte(60,1) - else - cx16.r0L++ - - x=255 - ; direct jump - if x==cx16.r4L+1-cx16.r5L - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(61,255) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(62,255) -skip5b: - ; no else - if x==cx16.r4L+1-cx16.r5L - fail_ubyte(63,255) - - ; with else - if x==cx16.r4L+1-cx16.r5L - fail_ubyte(64,255) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4L+255-cx16.r5L - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x==cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - verify_success(8) -} - sub test_not_expr() { - ubyte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x!=cx16.r4L+1-cx16.r5L - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x!=cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4L+255-cx16.r5L - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x!=cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x!=cx16.r4L+1-cx16.r5L - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(65,1) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(66,1) -skip3b: - ; no else - if x!=cx16.r4L+1-cx16.r5L - fail_ubyte(67,1) - - ; with else - if x!=cx16.r4L+1-cx16.r5L - fail_ubyte(68,1) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4L+255-cx16.r5L - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x!=cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - x=255 - ; direct jump - if x!=cx16.r4L+1-cx16.r5L - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x!=cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4L+255-cx16.r5L - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(69,255) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(70,255) -skip6b: - ; no else - if x!=cx16.r4L+255-cx16.r5L - fail_ubyte(71,255) - - ; with else - if x!=cx16.r4L+255-cx16.r5L - fail_ubyte(72,255) - else - cx16.r0L++ - - verify_success(16) -} - sub test_is_array() { - ubyte @shared x - ubyte[] values = [0, 0] - ubyte[] sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(73,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(74,0) -skip1b: - ; no else - if x==values[1] - fail_ubyte(75,0) - - ; with else - if x==values[1] - fail_ubyte(76,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: fail_ubyte(77,0) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_ubyte(78,0) -skip1d: - ; no else - if sources[1]==values[1] - fail_ubyte(79,0) - - ; with else - if sources[1]==values[1] - fail_ubyte(80,0) - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(81,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(82,0) -skip2b: - ; no else - if x==values[1] - fail_ubyte(83,0) - - ; with else - if x==values[1] - fail_ubyte(84,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: fail_ubyte(85,0) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_ubyte(86,0) -skip2d: - ; no else - if sources[1]==values[1] - fail_ubyte(87,0) - - ; with else - if sources[1]==values[1] - fail_ubyte(88,0) - else - cx16.r0L++ - - x=1 - sources[1]=1 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]==values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x==values[1] - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(89,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(90,1) -skip4b: - ; no else - if x==values[1] - fail_ubyte(91,1) - - ; with else - if x==values[1] - fail_ubyte(92,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl4c - goto skip4c -lbl4c: fail_ubyte(93,1) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]==values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_ubyte(94,1) -skip4d: - ; no else - if sources[1]==values[1] - fail_ubyte(95,1) - - ; with else - if sources[1]==values[1] - fail_ubyte(96,1) - else - cx16.r0L++ - - x=255 - sources[1]=255 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(97,255) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(98,255) -skip5b: - ; no else - if x==values[1] - fail_ubyte(99,255) - - ; with else - if x==values[1] - fail_ubyte(100,255) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl5c - goto skip5c -lbl5c: fail_ubyte(101,255) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]==values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_ubyte(102,255) -skip5d: - ; no else - if sources[1]==values[1] - fail_ubyte(103,255) - - ; with else - if sources[1]==values[1] - fail_ubyte(104,255) - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x==values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]==values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_array() { - ubyte @shared x - ubyte[] values = [0, 0] - ubyte[] sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=1 - sources[1]=1 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(105,1) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(106,1) -skip3b: - ; no else - if x!=values[1] - fail_ubyte(107,1) - - ; with else - if x!=values[1] - fail_ubyte(108,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl3c - goto skip3c -lbl3c: fail_ubyte(109,1) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]!=values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_ubyte(110,1) -skip3d: - ; no else - if sources[1]!=values[1] - fail_ubyte(111,1) - - ; with else - if sources[1]!=values[1] - fail_ubyte(112,1) - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x!=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]!=values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=255 - sources[1]=255 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]!=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x!=values[1] - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(113,255) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(114,255) -skip6b: - ; no else - if x!=values[1] - fail_ubyte(115,255) - - ; with else - if x!=values[1] - fail_ubyte(116,255) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl6c - goto skip6c -lbl6c: fail_ubyte(117,255) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]!=values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_ubyte(118,255) -skip6d: - ; no else - if sources[1]!=values[1] - fail_ubyte(119,255) - - ; with else - if sources[1]!=values[1] - fail_ubyte(120,255) - else - cx16.r0L++ - - verify_success(32) -} - -} - diff --git a/compiler/test/comparisons/test_ubyte_gt.asm b/compiler/test/comparisons/test_ubyte_gt.asm deleted file mode 100644 index 3a9913527..000000000 --- a/compiler/test/comparisons/test_ubyte_gt.asm +++ /dev/null @@ -1,9511 +0,0 @@ -; w65c02 assembly code for 'test_ubyte_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_ubyte_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"ubyte" - .byte $55, $42, $59, $54, $45, $00 - - ; source: test_ubyte_gt.p8:9 ubyte success = 0 - ; source: test_ubyte_gt.p8:10 str datatype = "ubyte" - ; source: test_ubyte_gt.p8:11 uword @shared comparison - ; source: test_ubyte_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_ubyte_gt.p8:14 txt.print("\ngreater-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #number: ") - ldy #>prog8_interned_strings.string_2 - lda #var: ") - ldy #>prog8_interned_strings.string_3 - lda #array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #0 - lda p8v_x - bne p8l_lbl1a - ; source: test_ubyte_gt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gt.p8:79 lbl1a: fail_ubyte(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:80 skip1a: -p8l_skip1a - ; source: test_ubyte_gt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:83 if x>0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gt.p8:86 lbl1b: fail_ubyte(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:87 skip1b: -p8l_skip1b - ; source: test_ubyte_gt.p8:89 if x>0 - lda p8v_x - beq label_asm_3_afterif - ; source: test_ubyte_gt.p8:90 fail_ubyte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_ubyte -label_asm_3_afterif - ; source: test_ubyte_gt.p8:93 if x>0 - lda p8v_x - beq label_asm_5_else - ; source: test_ubyte_gt.p8:94 fail_ubyte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_4_afterif -label_asm_5_else - ; source: test_ubyte_gt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_ubyte_gt.p8:99 if x>1 - lda p8v_x - cmp #2 - bcs p8l_lbl2a - ; source: test_ubyte_gt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gt.p8:102 lbl2a: fail_ubyte(5) -p8l_lbl2a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:103 skip2a: -p8l_skip2a - ; source: test_ubyte_gt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:106 if x>1 - lda p8v_x - cmp #2 - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gt.p8:109 lbl2b: fail_ubyte(6) -p8l_lbl2b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:110 skip2b: -p8l_skip2b - ; source: test_ubyte_gt.p8:112 if x>1 - lda p8v_x - cmp #2 - bcc label_asm_6_afterif - ; source: test_ubyte_gt.p8:113 fail_ubyte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_ubyte -label_asm_6_afterif - ; source: test_ubyte_gt.p8:116 if x>1 - lda p8v_x - cmp #2 - bcc label_asm_8_else - ; source: test_ubyte_gt.p8:117 fail_ubyte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_7_afterif -label_asm_8_else - ; source: test_ubyte_gt.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_ubyte_gt.p8:122 if x>255 - lda p8v_x - cmp #255 - beq + - bcs p8l_lbl3a -+ - ; source: test_ubyte_gt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gt.p8:125 lbl3a: fail_ubyte(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:126 skip3a: -p8l_skip3a - ; source: test_ubyte_gt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:129 if x>255 - lda #255 - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gt.p8:132 lbl3b: fail_ubyte(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:133 skip3b: -p8l_skip3b - ; source: test_ubyte_gt.p8:135 if x>255 - lda #255 - cmp p8v_x - bcs label_asm_9_afterif - ; source: test_ubyte_gt.p8:136 fail_ubyte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_ubyte -label_asm_9_afterif - ; source: test_ubyte_gt.p8:139 if x>255 - lda #255 - cmp p8v_x - bcs label_asm_11_else - ; source: test_ubyte_gt.p8:140 fail_ubyte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_10_afterif -label_asm_11_else - ; source: test_ubyte_gt.p8:142 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_ubyte_gt.p8:144 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gt.p8:146 if x>0 - bne p8l_lbl4a - ; source: test_ubyte_gt.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gt.p8:149 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:150 skip4a: -p8l_skip4a - ; source: test_ubyte_gt.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:153 if x>0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gt.p8:156 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:157 skip4b: -p8l_skip4b - ; source: test_ubyte_gt.p8:159 if x>0 - lda p8v_x - beq label_asm_12_afterif - ; source: test_ubyte_gt.p8:160 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_ubyte_gt.p8:163 if x>0 - lda p8v_x - beq label_asm_14_else - ; source: test_ubyte_gt.p8:164 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_ubyte_gt.p8:166 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_ubyte_gt.p8:169 if x>1 - lda p8v_x - cmp #2 - bcs p8l_lbl5a - ; source: test_ubyte_gt.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gt.p8:172 lbl5a: fail_ubyte(13) -p8l_lbl5a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:173 skip5a: -p8l_skip5a - ; source: test_ubyte_gt.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:176 if x>1 - lda p8v_x - cmp #2 - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gt.p8:179 lbl5b: fail_ubyte(14) -p8l_lbl5b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:180 skip5b: -p8l_skip5b - ; source: test_ubyte_gt.p8:182 if x>1 - lda p8v_x - cmp #2 - bcc label_asm_15_afterif - ; source: test_ubyte_gt.p8:183 fail_ubyte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_ubyte -label_asm_15_afterif - ; source: test_ubyte_gt.p8:186 if x>1 - lda p8v_x - cmp #2 - bcc label_asm_17_else - ; source: test_ubyte_gt.p8:187 fail_ubyte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_16_afterif -label_asm_17_else - ; source: test_ubyte_gt.p8:189 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_ubyte_gt.p8:192 if x>255 - lda p8v_x - cmp #255 - beq + - bcs p8l_lbl6a -+ - ; source: test_ubyte_gt.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gt.p8:195 lbl6a: fail_ubyte(17) -p8l_lbl6a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:196 skip6a: -p8l_skip6a - ; source: test_ubyte_gt.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:199 if x>255 - lda #255 - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gt.p8:202 lbl6b: fail_ubyte(18) -p8l_lbl6b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:203 skip6b: -p8l_skip6b - ; source: test_ubyte_gt.p8:205 if x>255 - lda #255 - cmp p8v_x - bcs label_asm_18_afterif - ; source: test_ubyte_gt.p8:206 fail_ubyte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_ubyte -label_asm_18_afterif - ; source: test_ubyte_gt.p8:209 if x>255 - lda #255 - cmp p8v_x - bcs label_asm_20_else - ; source: test_ubyte_gt.p8:210 fail_ubyte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_19_afterif -label_asm_20_else - ; source: test_ubyte_gt.p8:212 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_ubyte_gt.p8:214 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gt.p8:216 if x>0 - bne p8l_lbl7a - ; source: test_ubyte_gt.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gt.p8:219 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:220 skip7a: -p8l_skip7a - ; source: test_ubyte_gt.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:223 if x>0 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gt.p8:226 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:227 skip7b: -p8l_skip7b - ; source: test_ubyte_gt.p8:229 if x>0 - lda p8v_x - beq label_asm_21_afterif - ; source: test_ubyte_gt.p8:230 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_ubyte_gt.p8:233 if x>0 - lda p8v_x - beq label_asm_23_else - ; source: test_ubyte_gt.p8:234 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_ubyte_gt.p8:236 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_ubyte_gt.p8:239 if x>1 - lda p8v_x - cmp #2 - bcs p8l_lbl8a - ; source: test_ubyte_gt.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gt.p8:242 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:243 skip8a: -p8l_skip8a - ; source: test_ubyte_gt.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:246 if x>1 - lda p8v_x - cmp #2 - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gt.p8:249 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:250 skip8b: -p8l_skip8b - ; source: test_ubyte_gt.p8:252 if x>1 - lda p8v_x - cmp #2 - bcc label_asm_24_afterif - ; source: test_ubyte_gt.p8:253 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_ubyte_gt.p8:256 if x>1 - lda p8v_x - cmp #2 - bcc label_asm_26_else - ; source: test_ubyte_gt.p8:257 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_ubyte_gt.p8:259 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_ubyte_gt.p8:262 if x>255 - lda p8v_x - cmp #255 - beq + - bcs p8l_lbl9a -+ - ; source: test_ubyte_gt.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gt.p8:265 lbl9a: fail_ubyte(21) -p8l_lbl9a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:266 skip9a: -p8l_skip9a - ; source: test_ubyte_gt.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:269 if x>255 - lda #255 - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gt.p8:272 lbl9b: fail_ubyte(22) -p8l_lbl9b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:273 skip9b: -p8l_skip9b - ; source: test_ubyte_gt.p8:275 if x>255 - lda #255 - cmp p8v_x - bcs label_asm_27_afterif - ; source: test_ubyte_gt.p8:276 fail_ubyte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_ubyte -label_asm_27_afterif - ; source: test_ubyte_gt.p8:279 if x>255 - lda #255 - cmp p8v_x - bcs label_asm_29_else - ; source: test_ubyte_gt.p8:280 fail_ubyte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_28_afterif -label_asm_29_else - ; source: test_ubyte_gt.p8:282 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_ubyte_gt.p8:284 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_gt.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_ubyte_gt.p8:287 ubyte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_ubyte_gt.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_gt.p8:289 x=0 - stz p8v_x - ; source: test_ubyte_gt.p8:290 value=0 - stz p8v_value - ; source: test_ubyte_gt.p8:292 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl1a -+ - ; source: test_ubyte_gt.p8:294 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gt.p8:295 lbl1a: fail_ubyte(25) -p8l_lbl1a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:296 skip1a: -p8l_skip1a - ; source: test_ubyte_gt.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:299 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:301 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gt.p8:302 lbl1b: fail_ubyte(26) -p8l_lbl1b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:303 skip1b: -p8l_skip1b - ; source: test_ubyte_gt.p8:305 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_30_afterif - ; source: test_ubyte_gt.p8:306 fail_ubyte(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_ubyte -label_asm_30_afterif - ; source: test_ubyte_gt.p8:309 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_32_else - ; source: test_ubyte_gt.p8:310 fail_ubyte(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_31_afterif -label_asm_32_else - ; source: test_ubyte_gt.p8:312 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_ubyte_gt.p8:314 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_gt.p8:316 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl2a -+ - ; source: test_ubyte_gt.p8:318 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gt.p8:319 lbl2a: fail_ubyte(29) -p8l_lbl2a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:320 skip2a: -p8l_skip2a - ; source: test_ubyte_gt.p8:322 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:323 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:325 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gt.p8:326 lbl2b: fail_ubyte(30) -p8l_lbl2b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:327 skip2b: -p8l_skip2b - ; source: test_ubyte_gt.p8:329 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_33_afterif - ; source: test_ubyte_gt.p8:330 fail_ubyte(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_ubyte -label_asm_33_afterif - ; source: test_ubyte_gt.p8:333 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_35_else - ; source: test_ubyte_gt.p8:334 fail_ubyte(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_34_afterif -label_asm_35_else - ; source: test_ubyte_gt.p8:336 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_ubyte_gt.p8:338 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_gt.p8:340 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl3a -+ - ; source: test_ubyte_gt.p8:342 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gt.p8:343 lbl3a: fail_ubyte(33) -p8l_lbl3a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:344 skip3a: -p8l_skip3a - ; source: test_ubyte_gt.p8:346 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:347 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:349 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gt.p8:350 lbl3b: fail_ubyte(34) -p8l_lbl3b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:351 skip3b: -p8l_skip3b - ; source: test_ubyte_gt.p8:353 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_36_afterif - ; source: test_ubyte_gt.p8:354 fail_ubyte(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_ubyte -label_asm_36_afterif - ; source: test_ubyte_gt.p8:357 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_38_else - ; source: test_ubyte_gt.p8:358 fail_ubyte(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_37_afterif -label_asm_38_else - ; source: test_ubyte_gt.p8:360 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_ubyte_gt.p8:362 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gt.p8:363 value=0 - stz p8v_value - ; source: test_ubyte_gt.p8:365 if x>value - cmp p8v_value - beq + - bcs p8l_lbl4a -+ - ; source: test_ubyte_gt.p8:367 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gt.p8:368 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:369 skip4a: -p8l_skip4a - ; source: test_ubyte_gt.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:372 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:374 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gt.p8:375 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:376 skip4b: -p8l_skip4b - ; source: test_ubyte_gt.p8:378 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_39_afterif - ; source: test_ubyte_gt.p8:379 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_ubyte_gt.p8:382 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_41_else - ; source: test_ubyte_gt.p8:383 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_ubyte_gt.p8:385 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_ubyte_gt.p8:387 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_gt.p8:389 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl5a -+ - ; source: test_ubyte_gt.p8:391 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gt.p8:392 lbl5a: fail_ubyte(37) -p8l_lbl5a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:393 skip5a: -p8l_skip5a - ; source: test_ubyte_gt.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:396 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:398 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gt.p8:399 lbl5b: fail_ubyte(38) -p8l_lbl5b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:400 skip5b: -p8l_skip5b - ; source: test_ubyte_gt.p8:402 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_42_afterif - ; source: test_ubyte_gt.p8:403 fail_ubyte(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_ubyte -label_asm_42_afterif - ; source: test_ubyte_gt.p8:406 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_44_else - ; source: test_ubyte_gt.p8:407 fail_ubyte(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_43_afterif -label_asm_44_else - ; source: test_ubyte_gt.p8:409 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_ubyte_gt.p8:411 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_gt.p8:413 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl6a -+ - ; source: test_ubyte_gt.p8:415 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gt.p8:416 lbl6a: fail_ubyte(41) -p8l_lbl6a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:417 skip6a: -p8l_skip6a - ; source: test_ubyte_gt.p8:419 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:420 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:422 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gt.p8:423 lbl6b: fail_ubyte(42) -p8l_lbl6b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:424 skip6b: -p8l_skip6b - ; source: test_ubyte_gt.p8:426 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_45_afterif - ; source: test_ubyte_gt.p8:427 fail_ubyte(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_ubyte -label_asm_45_afterif - ; source: test_ubyte_gt.p8:430 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_47_else - ; source: test_ubyte_gt.p8:431 fail_ubyte(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_46_afterif -label_asm_47_else - ; source: test_ubyte_gt.p8:433 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_ubyte_gt.p8:435 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gt.p8:436 value=0 - stz p8v_value - ; source: test_ubyte_gt.p8:438 if x>value - cmp p8v_value - beq + - bcs p8l_lbl7a -+ - ; source: test_ubyte_gt.p8:440 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gt.p8:441 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:442 skip7a: -p8l_skip7a - ; source: test_ubyte_gt.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:445 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:447 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gt.p8:448 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:449 skip7b: -p8l_skip7b - ; source: test_ubyte_gt.p8:451 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_48_afterif - ; source: test_ubyte_gt.p8:452 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_ubyte_gt.p8:455 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_50_else - ; source: test_ubyte_gt.p8:456 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_ubyte_gt.p8:458 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_ubyte_gt.p8:460 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_gt.p8:462 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl8a -+ - ; source: test_ubyte_gt.p8:464 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gt.p8:465 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:466 skip8a: -p8l_skip8a - ; source: test_ubyte_gt.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:469 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:471 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gt.p8:472 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:473 skip8b: -p8l_skip8b - ; source: test_ubyte_gt.p8:475 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_51_afterif - ; source: test_ubyte_gt.p8:476 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_ubyte_gt.p8:479 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_53_else - ; source: test_ubyte_gt.p8:480 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_ubyte_gt.p8:482 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_ubyte_gt.p8:484 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_gt.p8:486 if x>value - lda p8v_x - cmp p8v_value - beq + - bcs p8l_lbl9a -+ - ; source: test_ubyte_gt.p8:488 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gt.p8:489 lbl9a: fail_ubyte(45) -p8l_lbl9a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:490 skip9a: -p8l_skip9a - ; source: test_ubyte_gt.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:493 if x>value - lda p8v_value - cmp p8v_x - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:495 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gt.p8:496 lbl9b: fail_ubyte(46) -p8l_lbl9b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:497 skip9b: -p8l_skip9b - ; source: test_ubyte_gt.p8:499 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_54_afterif - ; source: test_ubyte_gt.p8:500 fail_ubyte(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_ubyte -label_asm_54_afterif - ; source: test_ubyte_gt.p8:503 if x>value - lda p8v_value - cmp p8v_x - bcs label_asm_56_else - ; source: test_ubyte_gt.p8:504 fail_ubyte(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_55_afterif -label_asm_56_else - ; source: test_ubyte_gt.p8:506 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_ubyte_gt.p8:508 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gt.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .byte ? -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_gt.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_ubyte_gt.p8:511 ubyte @shared x - ; source: test_ubyte_gt.p8:512 ubyte[] values = [0, 0] - ; source: test_ubyte_gt.p8:511 ubyte @shared x - stz p8v_x - ; source: test_ubyte_gt.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_gt.p8:514 x=0 - stz p8v_x - ; source: test_ubyte_gt.p8:515 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_gt.p8:517 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl1a -+ - ; source: test_ubyte_gt.p8:519 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gt.p8:520 lbl1a: fail_ubyte(49) -p8l_lbl1a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:521 skip1a: -p8l_skip1a - ; source: test_ubyte_gt.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:524 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:526 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gt.p8:527 lbl1b: fail_ubyte(50) -p8l_lbl1b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:528 skip1b: -p8l_skip1b - ; source: test_ubyte_gt.p8:530 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_57_afterif - beq label_asm_57_afterif - ; source: test_ubyte_gt.p8:531 fail_ubyte(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_ubyte -label_asm_57_afterif - ; source: test_ubyte_gt.p8:534 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_59_else - beq label_asm_59_else - ; source: test_ubyte_gt.p8:535 fail_ubyte(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_58_afterif -label_asm_59_else - ; source: test_ubyte_gt.p8:537 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_ubyte_gt.p8:539 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_gt.p8:541 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl2a -+ - ; source: test_ubyte_gt.p8:543 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gt.p8:544 lbl2a: fail_ubyte(53) -p8l_lbl2a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:545 skip2a: -p8l_skip2a - ; source: test_ubyte_gt.p8:547 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:548 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:550 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gt.p8:551 lbl2b: fail_ubyte(54) -p8l_lbl2b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:552 skip2b: -p8l_skip2b - ; source: test_ubyte_gt.p8:554 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_60_afterif - beq label_asm_60_afterif - ; source: test_ubyte_gt.p8:555 fail_ubyte(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_ubyte -label_asm_60_afterif - ; source: test_ubyte_gt.p8:558 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_62_else - beq label_asm_62_else - ; source: test_ubyte_gt.p8:559 fail_ubyte(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_61_afterif -label_asm_62_else - ; source: test_ubyte_gt.p8:561 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_ubyte_gt.p8:563 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_gt.p8:565 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl3a -+ - ; source: test_ubyte_gt.p8:567 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gt.p8:568 lbl3a: fail_ubyte(57) -p8l_lbl3a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:569 skip3a: -p8l_skip3a - ; source: test_ubyte_gt.p8:571 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:572 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:574 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gt.p8:575 lbl3b: fail_ubyte(58) -p8l_lbl3b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:576 skip3b: -p8l_skip3b - ; source: test_ubyte_gt.p8:578 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_63_afterif - beq label_asm_63_afterif - ; source: test_ubyte_gt.p8:579 fail_ubyte(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_ubyte -label_asm_63_afterif - ; source: test_ubyte_gt.p8:582 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_65_else - beq label_asm_65_else - ; source: test_ubyte_gt.p8:583 fail_ubyte(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_64_afterif -label_asm_65_else - ; source: test_ubyte_gt.p8:585 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_ubyte_gt.p8:587 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gt.p8:588 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_gt.p8:590 if x>values[1] - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl4a -+ - ; source: test_ubyte_gt.p8:592 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gt.p8:593 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:594 skip4a: -p8l_skip4a - ; source: test_ubyte_gt.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:597 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:599 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gt.p8:600 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:601 skip4b: -p8l_skip4b - ; source: test_ubyte_gt.p8:603 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_66_afterif - beq label_asm_66_afterif - ; source: test_ubyte_gt.p8:604 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_ubyte_gt.p8:607 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_68_else - beq label_asm_68_else - ; source: test_ubyte_gt.p8:608 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_ubyte_gt.p8:610 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_ubyte_gt.p8:612 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_gt.p8:614 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl5a -+ - ; source: test_ubyte_gt.p8:616 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gt.p8:617 lbl5a: fail_ubyte(61) -p8l_lbl5a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:618 skip5a: -p8l_skip5a - ; source: test_ubyte_gt.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:621 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:623 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gt.p8:624 lbl5b: fail_ubyte(62) -p8l_lbl5b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:625 skip5b: -p8l_skip5b - ; source: test_ubyte_gt.p8:627 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_69_afterif - beq label_asm_69_afterif - ; source: test_ubyte_gt.p8:628 fail_ubyte(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_ubyte -label_asm_69_afterif - ; source: test_ubyte_gt.p8:631 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_71_else - beq label_asm_71_else - ; source: test_ubyte_gt.p8:632 fail_ubyte(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_70_afterif -label_asm_71_else - ; source: test_ubyte_gt.p8:634 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_ubyte_gt.p8:636 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_gt.p8:638 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl6a -+ - ; source: test_ubyte_gt.p8:640 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gt.p8:641 lbl6a: fail_ubyte(65) -p8l_lbl6a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:642 skip6a: -p8l_skip6a - ; source: test_ubyte_gt.p8:644 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:645 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:647 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gt.p8:648 lbl6b: fail_ubyte(66) -p8l_lbl6b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:649 skip6b: -p8l_skip6b - ; source: test_ubyte_gt.p8:651 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_72_afterif - beq label_asm_72_afterif - ; source: test_ubyte_gt.p8:652 fail_ubyte(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_ubyte -label_asm_72_afterif - ; source: test_ubyte_gt.p8:655 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_74_else - beq label_asm_74_else - ; source: test_ubyte_gt.p8:656 fail_ubyte(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_73_afterif -label_asm_74_else - ; source: test_ubyte_gt.p8:658 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_ubyte_gt.p8:660 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gt.p8:661 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_gt.p8:663 if x>values[1] - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl7a -+ - ; source: test_ubyte_gt.p8:665 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gt.p8:666 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:667 skip7a: -p8l_skip7a - ; source: test_ubyte_gt.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:670 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:672 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gt.p8:673 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:674 skip7b: -p8l_skip7b - ; source: test_ubyte_gt.p8:676 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_75_afterif - beq label_asm_75_afterif - ; source: test_ubyte_gt.p8:677 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_ubyte_gt.p8:680 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_77_else - beq label_asm_77_else - ; source: test_ubyte_gt.p8:681 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_ubyte_gt.p8:683 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_ubyte_gt.p8:685 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_gt.p8:687 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl8a -+ - ; source: test_ubyte_gt.p8:689 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gt.p8:690 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:691 skip8a: -p8l_skip8a - ; source: test_ubyte_gt.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:694 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:696 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gt.p8:697 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:698 skip8b: -p8l_skip8b - ; source: test_ubyte_gt.p8:700 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_78_afterif - beq label_asm_78_afterif - ; source: test_ubyte_gt.p8:701 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_ubyte_gt.p8:704 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_80_else - beq label_asm_80_else - ; source: test_ubyte_gt.p8:705 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_ubyte_gt.p8:707 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_ubyte_gt.p8:709 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_gt.p8:711 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - beq + - bcs p8l_lbl9a -+ - ; source: test_ubyte_gt.p8:713 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gt.p8:714 lbl9a: fail_ubyte(69) -p8l_lbl9a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:715 skip9a: -p8l_skip9a - ; source: test_ubyte_gt.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:718 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:720 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gt.p8:721 lbl9b: fail_ubyte(70) -p8l_lbl9b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:722 skip9b: -p8l_skip9b - ; source: test_ubyte_gt.p8:724 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_81_afterif - beq label_asm_81_afterif - ; source: test_ubyte_gt.p8:725 fail_ubyte(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_ubyte -label_asm_81_afterif - ; source: test_ubyte_gt.p8:728 if x>values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_83_else - beq label_asm_83_else - ; source: test_ubyte_gt.p8:729 fail_ubyte(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_82_afterif -label_asm_83_else - ; source: test_ubyte_gt.p8:731 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_ubyte_gt.p8:733 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gt.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS -; non-zeropage variables -p8v_values .byte $00, $00 - .pend - ; source: test_ubyte_gt.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_ubyte_gt.p8:736 ubyte @shared x - ; source: test_ubyte_gt.p8:739 float @shared f4 = 1.0 - ; source: test_ubyte_gt.p8:740 float @shared f5 = 1.0 - ; source: test_ubyte_gt.p8:736 ubyte @shared x - stz p8v_x - ; source: test_ubyte_gt.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_ubyte_gt.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_ubyte_gt.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_ubyte_gt.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_ubyte_gt.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_gt.p8:742 x=0 - stz p8v_x - ; source: test_ubyte_gt.p8:744 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl1a -+ - ; source: test_ubyte_gt.p8:746 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gt.p8:747 lbl1a: fail_ubyte(73) -p8l_lbl1a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:748 skip1a: -p8l_skip1a - ; source: test_ubyte_gt.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:751 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:753 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gt.p8:754 lbl1b: fail_ubyte(74) -p8l_lbl1b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:755 skip1b: -p8l_skip1b - ; source: test_ubyte_gt.p8:757 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_84_afterif - beq label_asm_84_afterif - ; source: test_ubyte_gt.p8:758 fail_ubyte(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_ubyte -label_asm_84_afterif - ; source: test_ubyte_gt.p8:761 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_86_else - beq label_asm_86_else - ; source: test_ubyte_gt.p8:762 fail_ubyte(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_85_afterif -label_asm_86_else - ; source: test_ubyte_gt.p8:764 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_ubyte_gt.p8:767 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl2a -+ - ; source: test_ubyte_gt.p8:769 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gt.p8:770 lbl2a: fail_ubyte(77) -p8l_lbl2a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:771 skip2a: -p8l_skip2a - ; source: test_ubyte_gt.p8:773 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:774 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:776 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gt.p8:777 lbl2b: fail_ubyte(78) -p8l_lbl2b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:778 skip2b: -p8l_skip2b - ; source: test_ubyte_gt.p8:780 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_87_afterif - beq label_asm_87_afterif - ; source: test_ubyte_gt.p8:781 fail_ubyte(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_ubyte -label_asm_87_afterif - ; source: test_ubyte_gt.p8:784 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_89_else - beq label_asm_89_else - ; source: test_ubyte_gt.p8:785 fail_ubyte(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_88_afterif -label_asm_89_else - ; source: test_ubyte_gt.p8:787 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_ubyte_gt.p8:790 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl3a -+ - ; source: test_ubyte_gt.p8:792 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gt.p8:793 lbl3a: fail_ubyte(81) -p8l_lbl3a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:794 skip3a: -p8l_skip3a - ; source: test_ubyte_gt.p8:796 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:797 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:799 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gt.p8:800 lbl3b: fail_ubyte(82) -p8l_lbl3b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:801 skip3b: -p8l_skip3b - ; source: test_ubyte_gt.p8:803 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_90_afterif - beq label_asm_90_afterif - ; source: test_ubyte_gt.p8:804 fail_ubyte(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_ubyte -label_asm_90_afterif - ; source: test_ubyte_gt.p8:807 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_92_else - beq label_asm_92_else - ; source: test_ubyte_gt.p8:808 fail_ubyte(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_91_afterif -label_asm_92_else - ; source: test_ubyte_gt.p8:810 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_ubyte_gt.p8:812 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gt.p8:814 if x>cx16.r4L+0-cx16.r5L - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl4a -+ - ; source: test_ubyte_gt.p8:816 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gt.p8:817 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:818 skip4a: -p8l_skip4a - ; source: test_ubyte_gt.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:821 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:823 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gt.p8:824 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:825 skip4b: -p8l_skip4b - ; source: test_ubyte_gt.p8:827 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_93_afterif - beq label_asm_93_afterif - ; source: test_ubyte_gt.p8:828 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_ubyte_gt.p8:831 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_95_else - beq label_asm_95_else - ; source: test_ubyte_gt.p8:832 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_ubyte_gt.p8:834 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_ubyte_gt.p8:837 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl5a -+ - ; source: test_ubyte_gt.p8:839 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gt.p8:840 lbl5a: fail_ubyte(85) -p8l_lbl5a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:841 skip5a: -p8l_skip5a - ; source: test_ubyte_gt.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:844 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:846 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gt.p8:847 lbl5b: fail_ubyte(86) -p8l_lbl5b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:848 skip5b: -p8l_skip5b - ; source: test_ubyte_gt.p8:850 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_96_afterif - beq label_asm_96_afterif - ; source: test_ubyte_gt.p8:851 fail_ubyte(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_ubyte -label_asm_96_afterif - ; source: test_ubyte_gt.p8:854 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_98_else - beq label_asm_98_else - ; source: test_ubyte_gt.p8:855 fail_ubyte(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_97_afterif -label_asm_98_else - ; source: test_ubyte_gt.p8:857 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_ubyte_gt.p8:860 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl6a -+ - ; source: test_ubyte_gt.p8:862 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gt.p8:863 lbl6a: fail_ubyte(89) -p8l_lbl6a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:864 skip6a: -p8l_skip6a - ; source: test_ubyte_gt.p8:866 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:867 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:869 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gt.p8:870 lbl6b: fail_ubyte(90) -p8l_lbl6b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:871 skip6b: -p8l_skip6b - ; source: test_ubyte_gt.p8:873 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_99_afterif - beq label_asm_99_afterif - ; source: test_ubyte_gt.p8:874 fail_ubyte(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_ubyte -label_asm_99_afterif - ; source: test_ubyte_gt.p8:877 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_101_else - beq label_asm_101_else - ; source: test_ubyte_gt.p8:878 fail_ubyte(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_100_afterif -label_asm_101_else - ; source: test_ubyte_gt.p8:880 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_ubyte_gt.p8:882 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gt.p8:884 if x>cx16.r4L+0-cx16.r5L - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl7a -+ - ; source: test_ubyte_gt.p8:886 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gt.p8:887 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:888 skip7a: -p8l_skip7a - ; source: test_ubyte_gt.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:891 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:893 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gt.p8:894 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:895 skip7b: -p8l_skip7b - ; source: test_ubyte_gt.p8:897 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_102_afterif - beq label_asm_102_afterif - ; source: test_ubyte_gt.p8:898 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_ubyte_gt.p8:901 if x>cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_104_else - beq label_asm_104_else - ; source: test_ubyte_gt.p8:902 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_ubyte_gt.p8:904 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_ubyte_gt.p8:907 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl8a -+ - ; source: test_ubyte_gt.p8:909 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gt.p8:910 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:911 skip8a: -p8l_skip8a - ; source: test_ubyte_gt.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:914 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:916 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gt.p8:917 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gt.p8:918 skip8b: -p8l_skip8b - ; source: test_ubyte_gt.p8:920 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_105_afterif - beq label_asm_105_afterif - ; source: test_ubyte_gt.p8:921 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_ubyte_gt.p8:924 if x>cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_107_else - beq label_asm_107_else - ; source: test_ubyte_gt.p8:925 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_ubyte_gt.p8:927 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_ubyte_gt.p8:930 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - beq + - bcs p8l_lbl9a -+ - ; source: test_ubyte_gt.p8:932 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gt.p8:933 lbl9a: fail_ubyte(93) -p8l_lbl9a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:934 skip9a: -p8l_skip9a - ; source: test_ubyte_gt.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gt.p8:937 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gt.p8:939 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gt.p8:940 lbl9b: fail_ubyte(94) -p8l_lbl9b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gt.p8:941 skip9b: -p8l_skip9b - ; source: test_ubyte_gt.p8:943 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_108_afterif - beq label_asm_108_afterif - ; source: test_ubyte_gt.p8:944 fail_ubyte(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_ubyte -label_asm_108_afterif - ; source: test_ubyte_gt.p8:947 if x>cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_110_else - beq label_asm_110_else - ; source: test_ubyte_gt.p8:948 fail_ubyte(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_109_afterif -label_asm_110_else - ; source: test_ubyte_gt.p8:950 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_ubyte_gt.p8:952 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gt.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .byte ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>number: " - .byte $0d, $3e, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>var: " - .byte $0d, $3e, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>expr: " - .byte $0d, $3e, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_ubyte_gt.p8:14 txt.print("\ngreater-than tests for: ") - ; source: test_ubyte_gt.p8:18 txt.print("\n>number: ") - ; source: test_ubyte_gt.p8:20 txt.print("\n>var: ") - ; source: test_ubyte_gt.p8:22 txt.print("\n>array[]: ") - ; source: test_ubyte_gt.p8:24 txt.print("\n>expr: ") - ; source: test_ubyte_gt.p8:33 txt.print(" **failed** ") - ; source: test_ubyte_gt.p8:35 txt.print(" success, expected ") - ; source: test_ubyte_gt.p8:41 txt.print(" **fail#") - ; source: test_ubyte_gt.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_ubyte_gt.p8 b/compiler/test/comparisons/test_ubyte_gt.p8 deleted file mode 100644 index 241cad311..000000000 --- a/compiler/test/comparisons/test_ubyte_gt.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "ubyte" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>number: ") - test_cmp_number() - txt.print("\n>var: ") - test_cmp_var() - txt.print("\n>array[]: ") - test_cmp_array() - txt.print("\n>expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - ubyte @shared x - success = 0 - x=0 - ; direct jump - if x>0 - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>0 - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(2) -skip1b: - ; no else - if x>0 - fail_ubyte(3) - - ; with else - if x>0 - fail_ubyte(4) - else - success++ - - ; direct jump - if x>1 - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(5) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>1 - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(6) -skip2b: - ; no else - if x>1 - fail_ubyte(7) - - ; with else - if x>1 - fail_ubyte(8) - else - success++ - - ; direct jump - if x>255 - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>255 - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(10) -skip3b: - ; no else - if x>255 - fail_ubyte(11) - - ; with else - if x>255 - fail_ubyte(12) - else - success++ - - x=1 - ; direct jump - if x>0 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>0 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(13) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>1 - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(14) -skip5b: - ; no else - if x>1 - fail_ubyte(15) - - ; with else - if x>1 - fail_ubyte(16) - else - success++ - - ; direct jump - if x>255 - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(17) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>255 - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(18) -skip6b: - ; no else - if x>255 - fail_ubyte(19) - - ; with else - if x>255 - fail_ubyte(20) - else - success++ - - x=255 - ; direct jump - if x>0 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>0 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>1 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>1 - success++ - - ; with else - if x>1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>255 - goto lbl9a - goto skip9a -lbl9a: fail_ubyte(21) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>255 - goto cx16.r3 - goto skip9b -lbl9b: fail_ubyte(22) -skip9b: - ; no else - if x>255 - fail_ubyte(23) - - ; with else - if x>255 - fail_ubyte(24) - else - success++ - - verify_success(18) -} - sub test_cmp_var() { - ubyte @shared x, value - success = 0 - x=0 - value=0 - ; direct jump - if x>value - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(25) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>value - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(26) -skip1b: - ; no else - if x>value - fail_ubyte(27) - - ; with else - if x>value - fail_ubyte(28) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(29) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>value - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(30) -skip2b: - ; no else - if x>value - fail_ubyte(31) - - ; with else - if x>value - fail_ubyte(32) - else - success++ - - value=255 - ; direct jump - if x>value - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(33) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>value - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(34) -skip3b: - ; no else - if x>value - fail_ubyte(35) - - ; with else - if x>value - fail_ubyte(36) - else - success++ - - x=1 - value=0 - ; direct jump - if x>value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(37) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>value - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(38) -skip5b: - ; no else - if x>value - fail_ubyte(39) - - ; with else - if x>value - fail_ubyte(40) - else - success++ - - value=255 - ; direct jump - if x>value - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(41) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>value - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(42) -skip6b: - ; no else - if x>value - fail_ubyte(43) - - ; with else - if x>value - fail_ubyte(44) - else - success++ - - x=255 - value=0 - ; direct jump - if x>value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x>value - goto lbl9a - goto skip9a -lbl9a: fail_ubyte(45) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>value - goto cx16.r3 - goto skip9b -lbl9b: fail_ubyte(46) -skip9b: - ; no else - if x>value - fail_ubyte(47) - - ; with else - if x>value - fail_ubyte(48) - else - success++ - - verify_success(18) -} - sub test_cmp_array() { - ubyte @shared x - ubyte[] values = [0, 0] - success = 0 - x=0 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(49) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(50) -skip1b: - ; no else - if x>values[1] - fail_ubyte(51) - - ; with else - if x>values[1] - fail_ubyte(52) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(53) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(54) -skip2b: - ; no else - if x>values[1] - fail_ubyte(55) - - ; with else - if x>values[1] - fail_ubyte(56) - else - success++ - - values[1]=255 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(57) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(58) -skip3b: - ; no else - if x>values[1] - fail_ubyte(59) - - ; with else - if x>values[1] - fail_ubyte(60) - else - success++ - - x=1 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(61) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(62) -skip5b: - ; no else - if x>values[1] - fail_ubyte(63) - - ; with else - if x>values[1] - fail_ubyte(64) - else - success++ - - values[1]=255 - ; direct jump - if x>values[1] - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(65) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(66) -skip6b: - ; no else - if x>values[1] - fail_ubyte(67) - - ; with else - if x>values[1] - fail_ubyte(68) - else - success++ - - x=255 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x>values[1] - goto lbl9a - goto skip9a -lbl9a: fail_ubyte(69) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_ubyte(70) -skip9b: - ; no else - if x>values[1] - fail_ubyte(71) - - ; with else - if x>values[1] - fail_ubyte(72) - else - success++ - - verify_success(18) -} - sub test_cmp_expr() { - ubyte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x>cx16.r4L+0-cx16.r5L - goto lbl1a - goto skip1a -lbl1a: fail_ubyte(73) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip1b -lbl1b: fail_ubyte(74) -skip1b: - ; no else - if x>cx16.r4L+0-cx16.r5L - fail_ubyte(75) - - ; with else - if x>cx16.r4L+0-cx16.r5L - fail_ubyte(76) - else - success++ - - ; direct jump - if x>cx16.r4L+1-cx16.r5L - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(77) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(78) -skip2b: - ; no else - if x>cx16.r4L+1-cx16.r5L - fail_ubyte(79) - - ; with else - if x>cx16.r4L+1-cx16.r5L - fail_ubyte(80) - else - success++ - - ; direct jump - if x>cx16.r4L+255-cx16.r5L - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(81) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(82) -skip3b: - ; no else - if x>cx16.r4L+255-cx16.r5L - fail_ubyte(83) - - ; with else - if x>cx16.r4L+255-cx16.r5L - fail_ubyte(84) - else - success++ - - x=1 - ; direct jump - if x>cx16.r4L+0-cx16.r5L - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>cx16.r4L+0-cx16.r5L - success++ - - ; with else - if x>cx16.r4L+0-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4L+1-cx16.r5L - goto lbl5a - goto skip5a -lbl5a: fail_ubyte(85) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip5b -lbl5b: fail_ubyte(86) -skip5b: - ; no else - if x>cx16.r4L+1-cx16.r5L - fail_ubyte(87) - - ; with else - if x>cx16.r4L+1-cx16.r5L - fail_ubyte(88) - else - success++ - - ; direct jump - if x>cx16.r4L+255-cx16.r5L - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(89) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(90) -skip6b: - ; no else - if x>cx16.r4L+255-cx16.r5L - fail_ubyte(91) - - ; with else - if x>cx16.r4L+255-cx16.r5L - fail_ubyte(92) - else - success++ - - x=255 - ; direct jump - if x>cx16.r4L+0-cx16.r5L - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>cx16.r4L+0-cx16.r5L - success++ - - ; with else - if x>cx16.r4L+0-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4L+1-cx16.r5L - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x>cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4L+255-cx16.r5L - goto lbl9a - goto skip9a -lbl9a: fail_ubyte(93) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip9b -lbl9b: fail_ubyte(94) -skip9b: - ; no else - if x>cx16.r4L+255-cx16.r5L - fail_ubyte(95) - - ; with else - if x>cx16.r4L+255-cx16.r5L - fail_ubyte(96) - else - success++ - - verify_success(18) -} - -} - diff --git a/compiler/test/comparisons/test_ubyte_gte.asm b/compiler/test/comparisons/test_ubyte_gte.asm deleted file mode 100644 index 88c9627b2..000000000 --- a/compiler/test/comparisons/test_ubyte_gte.asm +++ /dev/null @@ -1,9243 +0,0 @@ -; w65c02 assembly code for 'test_ubyte_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:42 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_ubyte_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"ubyte" - .byte $55, $42, $59, $54, $45, $00 - - ; source: test_ubyte_gte.p8:9 ubyte success = 0 - ; source: test_ubyte_gte.p8:10 str datatype = "ubyte" - ; source: test_ubyte_gte.p8:11 uword @shared comparison - ; source: test_ubyte_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_ubyte_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=number: ") - ldy #>prog8_interned_strings.string_2 - lda #=var: ") - ldy #>prog8_interned_strings.string_3 - lda #=array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #=expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:84 goto cx16.r3 - jmp (cx16.r3) - ; source: test_ubyte_gte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:87 skip1b: -p8l_skip1b - ; source: test_ubyte_gte.p8:90 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:94 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:99 if x>=1 - lda p8v_x - bne p8l_lbl2a - ; source: test_ubyte_gte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gte.p8:102 lbl2a: fail_ubyte(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:103 skip2a: -p8l_skip2a - ; source: test_ubyte_gte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:106 if x>=1 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gte.p8:109 lbl2b: fail_ubyte(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:110 skip2b: -p8l_skip2b - ; source: test_ubyte_gte.p8:112 if x>=1 - lda p8v_x - beq label_asm_3_afterif - ; source: test_ubyte_gte.p8:113 fail_ubyte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_ubyte -label_asm_3_afterif - ; source: test_ubyte_gte.p8:116 if x>=1 - lda p8v_x - beq label_asm_5_else - ; source: test_ubyte_gte.p8:117 fail_ubyte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_4_afterif -label_asm_5_else - ; source: test_ubyte_gte.p8:119 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_ubyte_gte.p8:122 if x>=255 - lda p8v_x - cmp #255 - bcs p8l_lbl3a - ; source: test_ubyte_gte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gte.p8:125 lbl3a: fail_ubyte(5) -p8l_lbl3a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:126 skip3a: -p8l_skip3a - ; source: test_ubyte_gte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:129 if x>=255 - lda p8v_x - cmp #255 - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gte.p8:132 lbl3b: fail_ubyte(6) -p8l_lbl3b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:133 skip3b: -p8l_skip3b - ; source: test_ubyte_gte.p8:135 if x>=255 - lda p8v_x - cmp #255 - bcc label_asm_6_afterif - ; source: test_ubyte_gte.p8:136 fail_ubyte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_ubyte -label_asm_6_afterif - ; source: test_ubyte_gte.p8:139 if x>=255 - lda p8v_x - cmp #255 - bcc label_asm_8_else - ; source: test_ubyte_gte.p8:140 fail_ubyte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_7_afterif -label_asm_8_else - ; source: test_ubyte_gte.p8:142 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_ubyte_gte.p8:144 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gte.p8:147 goto lbl4a - bra p8l_lbl4a - ; source: test_ubyte_gte.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gte.p8:149 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:150 skip4a: -p8l_skip4a - ; source: test_ubyte_gte.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:154 goto cx16.r3 - jmp (cx16.r3) - ; source: test_ubyte_gte.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gte.p8:156 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:157 skip4b: -p8l_skip4b - ; source: test_ubyte_gte.p8:160 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:164 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:169 if x>=1 - lda p8v_x - bne p8l_lbl5a - ; source: test_ubyte_gte.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gte.p8:172 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:173 skip5a: -p8l_skip5a - ; source: test_ubyte_gte.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:176 if x>=1 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gte.p8:179 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:180 skip5b: -p8l_skip5b - ; source: test_ubyte_gte.p8:182 if x>=1 - lda p8v_x - beq label_asm_9_afterif - ; source: test_ubyte_gte.p8:183 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_ubyte_gte.p8:186 if x>=1 - lda p8v_x - beq label_asm_11_else - ; source: test_ubyte_gte.p8:187 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_ubyte_gte.p8:189 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_ubyte_gte.p8:192 if x>=255 - lda p8v_x - cmp #255 - bcs p8l_lbl6a - ; source: test_ubyte_gte.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gte.p8:195 lbl6a: fail_ubyte(9) -p8l_lbl6a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:196 skip6a: -p8l_skip6a - ; source: test_ubyte_gte.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:199 if x>=255 - lda p8v_x - cmp #255 - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gte.p8:202 lbl6b: fail_ubyte(10) -p8l_lbl6b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:203 skip6b: -p8l_skip6b - ; source: test_ubyte_gte.p8:205 if x>=255 - lda p8v_x - cmp #255 - bcc label_asm_12_afterif - ; source: test_ubyte_gte.p8:206 fail_ubyte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_ubyte -label_asm_12_afterif - ; source: test_ubyte_gte.p8:209 if x>=255 - lda p8v_x - cmp #255 - bcc label_asm_14_else - ; source: test_ubyte_gte.p8:210 fail_ubyte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_13_afterif -label_asm_14_else - ; source: test_ubyte_gte.p8:212 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_ubyte_gte.p8:214 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gte.p8:217 goto lbl7a - bra p8l_lbl7a - ; source: test_ubyte_gte.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gte.p8:219 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:220 skip7a: -p8l_skip7a - ; source: test_ubyte_gte.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:224 goto cx16.r3 - jmp (cx16.r3) - ; source: test_ubyte_gte.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gte.p8:226 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:227 skip7b: -p8l_skip7b - ; source: test_ubyte_gte.p8:230 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:234 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:239 if x>=1 - lda p8v_x - bne p8l_lbl8a - ; source: test_ubyte_gte.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gte.p8:242 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:243 skip8a: -p8l_skip8a - ; source: test_ubyte_gte.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:246 if x>=1 - lda p8v_x - beq + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gte.p8:249 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:250 skip8b: -p8l_skip8b - ; source: test_ubyte_gte.p8:252 if x>=1 - lda p8v_x - beq label_asm_15_afterif - ; source: test_ubyte_gte.p8:253 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_ubyte_gte.p8:256 if x>=1 - lda p8v_x - beq label_asm_17_else - ; source: test_ubyte_gte.p8:257 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_ubyte_gte.p8:259 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_ubyte_gte.p8:262 if x>=255 - lda p8v_x - cmp #255 - bcs p8l_lbl9a - ; source: test_ubyte_gte.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gte.p8:265 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:266 skip9a: -p8l_skip9a - ; source: test_ubyte_gte.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:269 if x>=255 - lda p8v_x - cmp #255 - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gte.p8:272 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:273 skip9b: -p8l_skip9b - ; source: test_ubyte_gte.p8:275 if x>=255 - lda p8v_x - cmp #255 - bcc label_asm_18_afterif - ; source: test_ubyte_gte.p8:276 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_ubyte_gte.p8:279 if x>=255 - lda p8v_x - cmp #255 - bcc label_asm_20_else - ; source: test_ubyte_gte.p8:280 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_ubyte_gte.p8:282 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_ubyte_gte.p8:284 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_gte.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_ubyte_gte.p8:287 ubyte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_ubyte_gte.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_gte.p8:289 x=0 - stz p8v_x - ; source: test_ubyte_gte.p8:290 value=0 - stz p8v_value - ; source: test_ubyte_gte.p8:292 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl1a - ; source: test_ubyte_gte.p8:294 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gte.p8:295 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:296 skip1a: -p8l_skip1a - ; source: test_ubyte_gte.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:299 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:301 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gte.p8:302 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:303 skip1b: -p8l_skip1b - ; source: test_ubyte_gte.p8:305 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_21_afterif - ; source: test_ubyte_gte.p8:306 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_ubyte_gte.p8:309 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_23_else - ; source: test_ubyte_gte.p8:310 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_ubyte_gte.p8:312 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_ubyte_gte.p8:314 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_gte.p8:316 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl2a - ; source: test_ubyte_gte.p8:318 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gte.p8:319 lbl2a: fail_ubyte(13) -p8l_lbl2a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:320 skip2a: -p8l_skip2a - ; source: test_ubyte_gte.p8:322 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:323 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:325 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gte.p8:326 lbl2b: fail_ubyte(14) -p8l_lbl2b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:327 skip2b: -p8l_skip2b - ; source: test_ubyte_gte.p8:329 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_24_afterif - ; source: test_ubyte_gte.p8:330 fail_ubyte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_ubyte -label_asm_24_afterif - ; source: test_ubyte_gte.p8:333 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_26_else - ; source: test_ubyte_gte.p8:334 fail_ubyte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_25_afterif -label_asm_26_else - ; source: test_ubyte_gte.p8:336 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_ubyte_gte.p8:338 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_gte.p8:340 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl3a - ; source: test_ubyte_gte.p8:342 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gte.p8:343 lbl3a: fail_ubyte(17) -p8l_lbl3a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:344 skip3a: -p8l_skip3a - ; source: test_ubyte_gte.p8:346 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:347 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:349 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gte.p8:350 lbl3b: fail_ubyte(18) -p8l_lbl3b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:351 skip3b: -p8l_skip3b - ; source: test_ubyte_gte.p8:353 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_27_afterif - ; source: test_ubyte_gte.p8:354 fail_ubyte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_ubyte -label_asm_27_afterif - ; source: test_ubyte_gte.p8:357 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_29_else - ; source: test_ubyte_gte.p8:358 fail_ubyte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_28_afterif -label_asm_29_else - ; source: test_ubyte_gte.p8:360 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_ubyte_gte.p8:362 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gte.p8:363 value=0 - stz p8v_value - ; source: test_ubyte_gte.p8:365 if x>=value - cmp p8v_value - bcs p8l_lbl4a - ; source: test_ubyte_gte.p8:367 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gte.p8:368 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:369 skip4a: -p8l_skip4a - ; source: test_ubyte_gte.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:372 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:374 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gte.p8:375 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:376 skip4b: -p8l_skip4b - ; source: test_ubyte_gte.p8:378 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_30_afterif - ; source: test_ubyte_gte.p8:379 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_ubyte_gte.p8:382 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_32_else - ; source: test_ubyte_gte.p8:383 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_ubyte_gte.p8:385 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_ubyte_gte.p8:387 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_gte.p8:389 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl5a - ; source: test_ubyte_gte.p8:391 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gte.p8:392 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:393 skip5a: -p8l_skip5a - ; source: test_ubyte_gte.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:396 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:398 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gte.p8:399 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:400 skip5b: -p8l_skip5b - ; source: test_ubyte_gte.p8:402 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_33_afterif - ; source: test_ubyte_gte.p8:403 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_ubyte_gte.p8:406 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_35_else - ; source: test_ubyte_gte.p8:407 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_ubyte_gte.p8:409 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_ubyte_gte.p8:411 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_gte.p8:413 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl6a - ; source: test_ubyte_gte.p8:415 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gte.p8:416 lbl6a: fail_ubyte(21) -p8l_lbl6a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:417 skip6a: -p8l_skip6a - ; source: test_ubyte_gte.p8:419 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:420 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:422 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gte.p8:423 lbl6b: fail_ubyte(22) -p8l_lbl6b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:424 skip6b: -p8l_skip6b - ; source: test_ubyte_gte.p8:426 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_36_afterif - ; source: test_ubyte_gte.p8:427 fail_ubyte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_ubyte -label_asm_36_afterif - ; source: test_ubyte_gte.p8:430 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_38_else - ; source: test_ubyte_gte.p8:431 fail_ubyte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_37_afterif -label_asm_38_else - ; source: test_ubyte_gte.p8:433 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_ubyte_gte.p8:435 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gte.p8:436 value=0 - stz p8v_value - ; source: test_ubyte_gte.p8:438 if x>=value - cmp p8v_value - bcs p8l_lbl7a - ; source: test_ubyte_gte.p8:440 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gte.p8:441 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:442 skip7a: -p8l_skip7a - ; source: test_ubyte_gte.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:445 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:447 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gte.p8:448 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:449 skip7b: -p8l_skip7b - ; source: test_ubyte_gte.p8:451 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_39_afterif - ; source: test_ubyte_gte.p8:452 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_ubyte_gte.p8:455 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_41_else - ; source: test_ubyte_gte.p8:456 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_ubyte_gte.p8:458 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_ubyte_gte.p8:460 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_gte.p8:462 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl8a - ; source: test_ubyte_gte.p8:464 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gte.p8:465 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:466 skip8a: -p8l_skip8a - ; source: test_ubyte_gte.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:469 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:471 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gte.p8:472 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:473 skip8b: -p8l_skip8b - ; source: test_ubyte_gte.p8:475 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_42_afterif - ; source: test_ubyte_gte.p8:476 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_ubyte_gte.p8:479 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_44_else - ; source: test_ubyte_gte.p8:480 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_ubyte_gte.p8:482 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_ubyte_gte.p8:484 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_gte.p8:486 if x>=value - lda p8v_x - cmp p8v_value - bcs p8l_lbl9a - ; source: test_ubyte_gte.p8:488 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gte.p8:489 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:490 skip9a: -p8l_skip9a - ; source: test_ubyte_gte.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:493 if x>=value - lda p8v_x - cmp p8v_value - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:495 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gte.p8:496 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:497 skip9b: -p8l_skip9b - ; source: test_ubyte_gte.p8:499 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_45_afterif - ; source: test_ubyte_gte.p8:500 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_ubyte_gte.p8:503 if x>=value - lda p8v_x - cmp p8v_value - bcc label_asm_47_else - ; source: test_ubyte_gte.p8:504 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_ubyte_gte.p8:506 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_ubyte_gte.p8:508 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gte.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .byte ? -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_gte.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_ubyte_gte.p8:511 ubyte @shared x - ; source: test_ubyte_gte.p8:512 ubyte[] values = [0, 0] - ; source: test_ubyte_gte.p8:511 ubyte @shared x - stz p8v_x - ; source: test_ubyte_gte.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_gte.p8:514 x=0 - stz p8v_x - ; source: test_ubyte_gte.p8:515 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_gte.p8:517 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl1a - ; source: test_ubyte_gte.p8:519 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gte.p8:520 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:521 skip1a: -p8l_skip1a - ; source: test_ubyte_gte.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:524 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:526 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gte.p8:527 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:528 skip1b: -p8l_skip1b - ; source: test_ubyte_gte.p8:530 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_48_afterif - ; source: test_ubyte_gte.p8:531 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_ubyte_gte.p8:534 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_50_else - ; source: test_ubyte_gte.p8:535 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_ubyte_gte.p8:537 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_ubyte_gte.p8:539 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_gte.p8:541 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl2a - ; source: test_ubyte_gte.p8:543 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gte.p8:544 lbl2a: fail_ubyte(25) -p8l_lbl2a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:545 skip2a: -p8l_skip2a - ; source: test_ubyte_gte.p8:547 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:548 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:550 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gte.p8:551 lbl2b: fail_ubyte(26) -p8l_lbl2b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:552 skip2b: -p8l_skip2b - ; source: test_ubyte_gte.p8:554 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_51_afterif - ; source: test_ubyte_gte.p8:555 fail_ubyte(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_ubyte -label_asm_51_afterif - ; source: test_ubyte_gte.p8:558 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_53_else - ; source: test_ubyte_gte.p8:559 fail_ubyte(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_52_afterif -label_asm_53_else - ; source: test_ubyte_gte.p8:561 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_ubyte_gte.p8:563 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_gte.p8:565 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl3a - ; source: test_ubyte_gte.p8:567 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gte.p8:568 lbl3a: fail_ubyte(29) -p8l_lbl3a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:569 skip3a: -p8l_skip3a - ; source: test_ubyte_gte.p8:571 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:572 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:574 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gte.p8:575 lbl3b: fail_ubyte(30) -p8l_lbl3b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:576 skip3b: -p8l_skip3b - ; source: test_ubyte_gte.p8:578 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_54_afterif - ; source: test_ubyte_gte.p8:579 fail_ubyte(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_ubyte -label_asm_54_afterif - ; source: test_ubyte_gte.p8:582 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_56_else - ; source: test_ubyte_gte.p8:583 fail_ubyte(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_55_afterif -label_asm_56_else - ; source: test_ubyte_gte.p8:585 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_ubyte_gte.p8:587 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gte.p8:588 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_gte.p8:590 if x>=values[1] - ldy #1 - cmp p8v_values,y - bcs p8l_lbl4a - ; source: test_ubyte_gte.p8:592 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gte.p8:593 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:594 skip4a: -p8l_skip4a - ; source: test_ubyte_gte.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:597 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:599 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gte.p8:600 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:601 skip4b: -p8l_skip4b - ; source: test_ubyte_gte.p8:603 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_57_afterif - ; source: test_ubyte_gte.p8:604 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_ubyte_gte.p8:607 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_59_else - ; source: test_ubyte_gte.p8:608 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_ubyte_gte.p8:610 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_ubyte_gte.p8:612 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_gte.p8:614 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl5a - ; source: test_ubyte_gte.p8:616 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gte.p8:617 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:618 skip5a: -p8l_skip5a - ; source: test_ubyte_gte.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:621 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:623 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gte.p8:624 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:625 skip5b: -p8l_skip5b - ; source: test_ubyte_gte.p8:627 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_60_afterif - ; source: test_ubyte_gte.p8:628 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_ubyte_gte.p8:631 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_62_else - ; source: test_ubyte_gte.p8:632 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_ubyte_gte.p8:634 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_ubyte_gte.p8:636 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_gte.p8:638 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl6a - ; source: test_ubyte_gte.p8:640 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gte.p8:641 lbl6a: fail_ubyte(33) -p8l_lbl6a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:642 skip6a: -p8l_skip6a - ; source: test_ubyte_gte.p8:644 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:645 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:647 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gte.p8:648 lbl6b: fail_ubyte(34) -p8l_lbl6b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:649 skip6b: -p8l_skip6b - ; source: test_ubyte_gte.p8:651 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_63_afterif - ; source: test_ubyte_gte.p8:652 fail_ubyte(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_ubyte -label_asm_63_afterif - ; source: test_ubyte_gte.p8:655 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_65_else - ; source: test_ubyte_gte.p8:656 fail_ubyte(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_64_afterif -label_asm_65_else - ; source: test_ubyte_gte.p8:658 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_ubyte_gte.p8:660 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gte.p8:661 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_gte.p8:663 if x>=values[1] - ldy #1 - cmp p8v_values,y - bcs p8l_lbl7a - ; source: test_ubyte_gte.p8:665 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gte.p8:666 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:667 skip7a: -p8l_skip7a - ; source: test_ubyte_gte.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:670 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:672 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gte.p8:673 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:674 skip7b: -p8l_skip7b - ; source: test_ubyte_gte.p8:676 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_66_afterif - ; source: test_ubyte_gte.p8:677 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_ubyte_gte.p8:680 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_68_else - ; source: test_ubyte_gte.p8:681 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_ubyte_gte.p8:683 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_ubyte_gte.p8:685 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_gte.p8:687 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl8a - ; source: test_ubyte_gte.p8:689 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gte.p8:690 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:691 skip8a: -p8l_skip8a - ; source: test_ubyte_gte.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:694 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:696 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gte.p8:697 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:698 skip8b: -p8l_skip8b - ; source: test_ubyte_gte.p8:700 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_69_afterif - ; source: test_ubyte_gte.p8:701 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_ubyte_gte.p8:704 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_71_else - ; source: test_ubyte_gte.p8:705 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_ubyte_gte.p8:707 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_ubyte_gte.p8:709 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_gte.p8:711 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcs p8l_lbl9a - ; source: test_ubyte_gte.p8:713 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gte.p8:714 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:715 skip9a: -p8l_skip9a - ; source: test_ubyte_gte.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:718 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:720 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gte.p8:721 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:722 skip9b: -p8l_skip9b - ; source: test_ubyte_gte.p8:724 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_72_afterif - ; source: test_ubyte_gte.p8:725 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_ubyte_gte.p8:728 if x>=values[1] - lda p8v_x - ldy #1 - cmp p8v_values,y - bcc label_asm_74_else - ; source: test_ubyte_gte.p8:729 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_ubyte_gte.p8:731 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_ubyte_gte.p8:733 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gte.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS -; non-zeropage variables -p8v_values .byte $00, $00 - .pend - ; source: test_ubyte_gte.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_ubyte_gte.p8:736 ubyte @shared x - ; source: test_ubyte_gte.p8:739 float @shared f4 = 1.0 - ; source: test_ubyte_gte.p8:740 float @shared f5 = 1.0 - ; source: test_ubyte_gte.p8:736 ubyte @shared x - stz p8v_x - ; source: test_ubyte_gte.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_ubyte_gte.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_ubyte_gte.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_ubyte_gte.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_ubyte_gte.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_gte.p8:742 x=0 - stz p8v_x - ; source: test_ubyte_gte.p8:744 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl1a - ; source: test_ubyte_gte.p8:746 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_gte.p8:747 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:748 skip1a: -p8l_skip1a - ; source: test_ubyte_gte.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:751 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:753 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_gte.p8:754 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:755 skip1b: -p8l_skip1b - ; source: test_ubyte_gte.p8:757 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_75_afterif - ; source: test_ubyte_gte.p8:758 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_ubyte_gte.p8:761 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_77_else - ; source: test_ubyte_gte.p8:762 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_ubyte_gte.p8:764 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_ubyte_gte.p8:767 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl2a - ; source: test_ubyte_gte.p8:769 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_gte.p8:770 lbl2a: fail_ubyte(37) -p8l_lbl2a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:771 skip2a: -p8l_skip2a - ; source: test_ubyte_gte.p8:773 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:774 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:776 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_gte.p8:777 lbl2b: fail_ubyte(38) -p8l_lbl2b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:778 skip2b: -p8l_skip2b - ; source: test_ubyte_gte.p8:780 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_78_afterif - ; source: test_ubyte_gte.p8:781 fail_ubyte(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_ubyte -label_asm_78_afterif - ; source: test_ubyte_gte.p8:784 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_80_else - ; source: test_ubyte_gte.p8:785 fail_ubyte(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_79_afterif -label_asm_80_else - ; source: test_ubyte_gte.p8:787 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_ubyte_gte.p8:790 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl3a - ; source: test_ubyte_gte.p8:792 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_gte.p8:793 lbl3a: fail_ubyte(41) -p8l_lbl3a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:794 skip3a: -p8l_skip3a - ; source: test_ubyte_gte.p8:796 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:797 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:799 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_gte.p8:800 lbl3b: fail_ubyte(42) -p8l_lbl3b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:801 skip3b: -p8l_skip3b - ; source: test_ubyte_gte.p8:803 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_81_afterif - ; source: test_ubyte_gte.p8:804 fail_ubyte(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_ubyte -label_asm_81_afterif - ; source: test_ubyte_gte.p8:807 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_83_else - ; source: test_ubyte_gte.p8:808 fail_ubyte(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_82_afterif -label_asm_83_else - ; source: test_ubyte_gte.p8:810 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_ubyte_gte.p8:812 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_gte.p8:814 if x>=cx16.r4L+0-cx16.r5L - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl4a - ; source: test_ubyte_gte.p8:816 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_gte.p8:817 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:818 skip4a: -p8l_skip4a - ; source: test_ubyte_gte.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:821 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:823 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_gte.p8:824 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:825 skip4b: -p8l_skip4b - ; source: test_ubyte_gte.p8:827 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_84_afterif - ; source: test_ubyte_gte.p8:828 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_ubyte_gte.p8:831 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_86_else - ; source: test_ubyte_gte.p8:832 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_ubyte_gte.p8:834 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_ubyte_gte.p8:837 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl5a - ; source: test_ubyte_gte.p8:839 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_gte.p8:840 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:841 skip5a: -p8l_skip5a - ; source: test_ubyte_gte.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:844 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:846 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_gte.p8:847 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:848 skip5b: -p8l_skip5b - ; source: test_ubyte_gte.p8:850 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_87_afterif - ; source: test_ubyte_gte.p8:851 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_ubyte_gte.p8:854 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_89_else - ; source: test_ubyte_gte.p8:855 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_ubyte_gte.p8:857 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_ubyte_gte.p8:860 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl6a - ; source: test_ubyte_gte.p8:862 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_gte.p8:863 lbl6a: fail_ubyte(45) -p8l_lbl6a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:864 skip6a: -p8l_skip6a - ; source: test_ubyte_gte.p8:866 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:867 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:869 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_gte.p8:870 lbl6b: fail_ubyte(46) -p8l_lbl6b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_gte.p8:871 skip6b: -p8l_skip6b - ; source: test_ubyte_gte.p8:873 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_90_afterif - ; source: test_ubyte_gte.p8:874 fail_ubyte(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_ubyte -label_asm_90_afterif - ; source: test_ubyte_gte.p8:877 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_92_else - ; source: test_ubyte_gte.p8:878 fail_ubyte(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_91_afterif -label_asm_92_else - ; source: test_ubyte_gte.p8:880 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_ubyte_gte.p8:882 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_gte.p8:884 if x>=cx16.r4L+0-cx16.r5L - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl7a - ; source: test_ubyte_gte.p8:886 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_gte.p8:887 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:888 skip7a: -p8l_skip7a - ; source: test_ubyte_gte.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:891 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:893 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_gte.p8:894 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:895 skip7b: -p8l_skip7b - ; source: test_ubyte_gte.p8:897 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_93_afterif - ; source: test_ubyte_gte.p8:898 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_ubyte_gte.p8:901 if x>=cx16.r4L+0-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_95_else - ; source: test_ubyte_gte.p8:902 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_ubyte_gte.p8:904 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_ubyte_gte.p8:907 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl8a - ; source: test_ubyte_gte.p8:909 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_gte.p8:910 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:911 skip8a: -p8l_skip8a - ; source: test_ubyte_gte.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:914 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:916 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_gte.p8:917 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:918 skip8b: -p8l_skip8b - ; source: test_ubyte_gte.p8:920 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_96_afterif - ; source: test_ubyte_gte.p8:921 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_ubyte_gte.p8:924 if x>=cx16.r4L+1-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_98_else - ; source: test_ubyte_gte.p8:925 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_ubyte_gte.p8:927 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_ubyte_gte.p8:930 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcs p8l_lbl9a - ; source: test_ubyte_gte.p8:932 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_gte.p8:933 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:934 skip9a: -p8l_skip9a - ; source: test_ubyte_gte.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_gte.p8:937 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_gte.p8:939 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_gte.p8:940 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_gte.p8:941 skip9b: -p8l_skip9b - ; source: test_ubyte_gte.p8:943 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_99_afterif - ; source: test_ubyte_gte.p8:944 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_ubyte_gte.p8:947 if x>=cx16.r4L+255-cx16.r5L - lda p8v_x - pha - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - sta P8ZP_SCRATCH_REG - pla - cmp P8ZP_SCRATCH_REG - bcc label_asm_101_else - ; source: test_ubyte_gte.p8:948 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_ubyte_gte.p8:950 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_ubyte_gte.p8:952 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_gte.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .byte ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $54 - .byte $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>=number: " - .byte $0d, $3e, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>=var: " - .byte $0d, $3e, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>=expr: " - .byte $0d, $3e, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_ubyte_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ; source: test_ubyte_gte.p8:18 txt.print("\n>=number: ") - ; source: test_ubyte_gte.p8:20 txt.print("\n>=var: ") - ; source: test_ubyte_gte.p8:22 txt.print("\n>=array[]: ") - ; source: test_ubyte_gte.p8:24 txt.print("\n>=expr: ") - ; source: test_ubyte_gte.p8:33 txt.print(" **failed** ") - ; source: test_ubyte_gte.p8:35 txt.print(" success, expected ") - ; source: test_ubyte_gte.p8:41 txt.print(" **fail#") - ; source: test_ubyte_gte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_ubyte_gte.p8 b/compiler/test/comparisons/test_ubyte_gte.p8 deleted file mode 100644 index e432c9cb4..000000000 --- a/compiler/test/comparisons/test_ubyte_gte.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "ubyte" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=number: ") - test_cmp_number() - txt.print("\n>=var: ") - test_cmp_var() - txt.print("\n>=array[]: ") - test_cmp_array() - txt.print("\n>=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - ubyte @shared x - success = 0 - x=0 - ; direct jump - if x>=0 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=0 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=1 - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(2) -skip2b: - ; no else - if x>=1 - fail_ubyte(3) - - ; with else - if x>=1 - fail_ubyte(4) - else - success++ - - ; direct jump - if x>=255 - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(5) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=255 - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(6) -skip3b: - ; no else - if x>=255 - fail_ubyte(7) - - ; with else - if x>=255 - fail_ubyte(8) - else - success++ - - x=1 - ; direct jump - if x>=0 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=0 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=1 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=255 - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(9) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=255 - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(10) -skip6b: - ; no else - if x>=255 - fail_ubyte(11) - - ; with else - if x>=255 - fail_ubyte(12) - else - success++ - - x=255 - ; direct jump - if x>=0 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=0 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=1 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=255 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=255 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=255 - success++ - - ; with else - if x>=255 - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_var() { - ubyte @shared x, value - success = 0 - x=0 - value=0 - ; direct jump - if x>=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(13) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=value - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(14) -skip2b: - ; no else - if x>=value - fail_ubyte(15) - - ; with else - if x>=value - fail_ubyte(16) - else - success++ - - value=255 - ; direct jump - if x>=value - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(17) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=value - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(18) -skip3b: - ; no else - if x>=value - fail_ubyte(19) - - ; with else - if x>=value - fail_ubyte(20) - else - success++ - - x=1 - value=0 - ; direct jump - if x>=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x>=value - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(21) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=value - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(22) -skip6b: - ; no else - if x>=value - fail_ubyte(23) - - ; with else - if x>=value - fail_ubyte(24) - else - success++ - - x=255 - value=0 - ; direct jump - if x>=value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x>=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_array() { - ubyte @shared x - ubyte[] values = [0, 0] - success = 0 - x=0 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(25) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(26) -skip2b: - ; no else - if x>=values[1] - fail_ubyte(27) - - ; with else - if x>=values[1] - fail_ubyte(28) - else - success++ - - values[1]=255 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(29) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(30) -skip3b: - ; no else - if x>=values[1] - fail_ubyte(31) - - ; with else - if x>=values[1] - fail_ubyte(32) - else - success++ - - x=1 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x>=values[1] - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(33) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(34) -skip6b: - ; no else - if x>=values[1] - fail_ubyte(35) - - ; with else - if x>=values[1] - fail_ubyte(36) - else - success++ - - x=255 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x>=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_expr() { - ubyte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x>=cx16.r4L+0-cx16.r5L - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=cx16.r4L+0-cx16.r5L - success++ - - ; with else - if x>=cx16.r4L+0-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4L+1-cx16.r5L - goto lbl2a - goto skip2a -lbl2a: fail_ubyte(37) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip2b -lbl2b: fail_ubyte(38) -skip2b: - ; no else - if x>=cx16.r4L+1-cx16.r5L - fail_ubyte(39) - - ; with else - if x>=cx16.r4L+1-cx16.r5L - fail_ubyte(40) - else - success++ - - ; direct jump - if x>=cx16.r4L+255-cx16.r5L - goto lbl3a - goto skip3a -lbl3a: fail_ubyte(41) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip3b -lbl3b: fail_ubyte(42) -skip3b: - ; no else - if x>=cx16.r4L+255-cx16.r5L - fail_ubyte(43) - - ; with else - if x>=cx16.r4L+255-cx16.r5L - fail_ubyte(44) - else - success++ - - x=1 - ; direct jump - if x>=cx16.r4L+0-cx16.r5L - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x>=cx16.r4L+0-cx16.r5L - success++ - - ; with else - if x>=cx16.r4L+0-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4L+1-cx16.r5L - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x>=cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4L+255-cx16.r5L - goto lbl6a - goto skip6a -lbl6a: fail_ubyte(45) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip6b -lbl6b: fail_ubyte(46) -skip6b: - ; no else - if x>=cx16.r4L+255-cx16.r5L - fail_ubyte(47) - - ; with else - if x>=cx16.r4L+255-cx16.r5L - fail_ubyte(48) - else - success++ - - x=255 - ; direct jump - if x>=cx16.r4L+0-cx16.r5L - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x>=cx16.r4L+0-cx16.r5L - success++ - - ; with else - if x>=cx16.r4L+0-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4L+1-cx16.r5L - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x>=cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4L+255-cx16.r5L - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x>=cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - verify_success(27) -} - -} - diff --git a/compiler/test/comparisons/test_ubyte_lt.asm b/compiler/test/comparisons/test_ubyte_lt.asm deleted file mode 100644 index 30d74a994..000000000 --- a/compiler/test/comparisons/test_ubyte_lt.asm +++ /dev/null @@ -1,9309 +0,0 @@ -; w65c02 assembly code for 'test_ubyte_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:43 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_ubyte_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"ubyte" - .byte $55, $42, $59, $54, $45, $00 - - ; source: test_ubyte_lt.p8:9 ubyte success = 0 - ; source: test_ubyte_lt.p8:10 str datatype = "ubyte" - ; source: test_ubyte_lt.p8:11 uword @shared comparison - ; source: test_ubyte_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_ubyte_lt.p8:14 txt.print("\nless-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #1 - lda #<1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:80 skip1a: -p8l_skip1a - ; source: test_ubyte_lt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_lt.p8:86 lbl1b: fail_ubyte(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:87 skip1b: -p8l_skip1b - ; source: test_ubyte_lt.p8:96 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:99 if x<1 - lda p8v_x - beq p8l_lbl2a - ; source: test_ubyte_lt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_lt.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:103 skip2a: -p8l_skip2a - ; source: test_ubyte_lt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:106 if x<1 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_lt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_lt.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:110 skip2b: -p8l_skip2b - ; source: test_ubyte_lt.p8:112 if x<1 - lda p8v_x - bne label_asm_3_afterif - ; source: test_ubyte_lt.p8:113 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_ubyte_lt.p8:116 if x<1 - lda p8v_x - bne label_asm_5_else - ; source: test_ubyte_lt.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_ubyte_lt.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_ubyte_lt.p8:122 if x<255 - lda p8v_x - cmp #255 - bcc p8l_lbl3a - ; source: test_ubyte_lt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_lt.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:126 skip3a: -p8l_skip3a - ; source: test_ubyte_lt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:129 if x<255 - lda p8v_x - cmp #255 - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_lt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_lt.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:133 skip3b: -p8l_skip3b - ; source: test_ubyte_lt.p8:135 if x<255 - lda p8v_x - cmp #255 - bcs label_asm_6_afterif - ; source: test_ubyte_lt.p8:136 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_ubyte_lt.p8:139 if x<255 - lda p8v_x - cmp #255 - bcs label_asm_8_else - ; source: test_ubyte_lt.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_ubyte_lt.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_ubyte_lt.p8:144 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_lt.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_lt.p8:149 lbl4a: fail_ubyte(5) -p8l_lbl4a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:150 skip4a: -p8l_skip4a - ; source: test_ubyte_lt.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_lt.p8:156 lbl4b: fail_ubyte(6) -p8l_lbl4b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:157 skip4b: -p8l_skip4b - ; source: test_ubyte_lt.p8:166 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:169 if x<1 - lda p8v_x - beq p8l_lbl5a - ; source: test_ubyte_lt.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_lt.p8:172 lbl5a: fail_ubyte(9) -p8l_lbl5a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:173 skip5a: -p8l_skip5a - ; source: test_ubyte_lt.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:176 if x<1 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_lt.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_lt.p8:179 lbl5b: fail_ubyte(10) -p8l_lbl5b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:180 skip5b: -p8l_skip5b - ; source: test_ubyte_lt.p8:182 if x<1 - lda p8v_x - bne label_asm_9_afterif - ; source: test_ubyte_lt.p8:183 fail_ubyte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_ubyte -label_asm_9_afterif - ; source: test_ubyte_lt.p8:186 if x<1 - lda p8v_x - bne label_asm_11_else - ; source: test_ubyte_lt.p8:187 fail_ubyte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_10_afterif -label_asm_11_else - ; source: test_ubyte_lt.p8:189 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_ubyte_lt.p8:192 if x<255 - lda p8v_x - cmp #255 - bcc p8l_lbl6a - ; source: test_ubyte_lt.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_lt.p8:195 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:196 skip6a: -p8l_skip6a - ; source: test_ubyte_lt.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:199 if x<255 - lda p8v_x - cmp #255 - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_lt.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_lt.p8:202 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:203 skip6b: -p8l_skip6b - ; source: test_ubyte_lt.p8:205 if x<255 - lda p8v_x - cmp #255 - bcs label_asm_12_afterif - ; source: test_ubyte_lt.p8:206 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_ubyte_lt.p8:209 if x<255 - lda p8v_x - cmp #255 - bcs label_asm_14_else - ; source: test_ubyte_lt.p8:210 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_ubyte_lt.p8:212 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_ubyte_lt.p8:214 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_lt.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_lt.p8:219 lbl7a: fail_ubyte(13) -p8l_lbl7a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:220 skip7a: -p8l_skip7a - ; source: test_ubyte_lt.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_lt.p8:226 lbl7b: fail_ubyte(14) -p8l_lbl7b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:227 skip7b: -p8l_skip7b - ; source: test_ubyte_lt.p8:236 success++ - inc p8b_main.p8v_success - ; source: test_ubyte_lt.p8:239 if x<1 - lda p8v_x - beq p8l_lbl8a - ; source: test_ubyte_lt.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_lt.p8:242 lbl8a: fail_ubyte(17) -p8l_lbl8a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:243 skip8a: -p8l_skip8a - ; source: test_ubyte_lt.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:246 if x<1 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_lt.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_lt.p8:249 lbl8b: fail_ubyte(18) -p8l_lbl8b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:250 skip8b: -p8l_skip8b - ; source: test_ubyte_lt.p8:252 if x<1 - lda p8v_x - bne label_asm_15_afterif - ; source: test_ubyte_lt.p8:253 fail_ubyte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_ubyte -label_asm_15_afterif - ; source: test_ubyte_lt.p8:256 if x<1 - lda p8v_x - bne label_asm_17_else - ; source: test_ubyte_lt.p8:257 fail_ubyte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_16_afterif -label_asm_17_else - ; source: test_ubyte_lt.p8:259 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_ubyte_lt.p8:262 if x<255 - lda p8v_x - cmp #255 - bcc p8l_lbl9a - ; source: test_ubyte_lt.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_lt.p8:265 lbl9a: fail_ubyte(21) -p8l_lbl9a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:266 skip9a: -p8l_skip9a - ; source: test_ubyte_lt.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:269 if x<255 - lda p8v_x - cmp #255 - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_lt.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_lt.p8:272 lbl9b: fail_ubyte(22) -p8l_lbl9b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:273 skip9b: -p8l_skip9b - ; source: test_ubyte_lt.p8:275 if x<255 - lda p8v_x - cmp #255 - bcs label_asm_18_afterif - ; source: test_ubyte_lt.p8:276 fail_ubyte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_ubyte -label_asm_18_afterif - ; source: test_ubyte_lt.p8:279 if x<255 - lda p8v_x - cmp #255 - bcs label_asm_20_else - ; source: test_ubyte_lt.p8:280 fail_ubyte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_19_afterif -label_asm_20_else - ; source: test_ubyte_lt.p8:282 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_ubyte_lt.p8:284 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_lt.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_ubyte_lt.p8:287 ubyte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_ubyte_lt.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_lt.p8:289 x=0 - stz p8v_x - ; source: test_ubyte_lt.p8:290 value=0 - stz p8v_value - ; source: test_ubyte_lt.p8:292 if x$19 - lda #<$19 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:296 skip1a: -p8l_skip1a - ; source: test_ubyte_lt.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:299 if x$1a - lda #<$1a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:303 skip1b: -p8l_skip1b - ; source: test_ubyte_lt.p8:305 if x$1b - lda #<$1b - jsr p8b_main.p8s_fail_ubyte -label_asm_21_afterif - ; source: test_ubyte_lt.p8:309 if x$1c - lda #<$1c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_22_afterif -label_asm_23_else - ; source: test_ubyte_lt.p8:312 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_ubyte_lt.p8:314 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_lt.p8:316 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:323 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:347 if x$1d - lda #<$1d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:369 skip4a: -p8l_skip4a - ; source: test_ubyte_lt.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:372 if x$1e - lda #<$1e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:376 skip4b: -p8l_skip4b - ; source: test_ubyte_lt.p8:378 if x$1f - lda #<$1f - jsr p8b_main.p8s_fail_ubyte -label_asm_30_afterif - ; source: test_ubyte_lt.p8:382 if x$20 - lda #<$20 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_31_afterif -label_asm_32_else - ; source: test_ubyte_lt.p8:385 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_ubyte_lt.p8:387 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_lt.p8:389 if x$21 - lda #<$21 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:393 skip5a: -p8l_skip5a - ; source: test_ubyte_lt.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:396 if x$22 - lda #<$22 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:400 skip5b: -p8l_skip5b - ; source: test_ubyte_lt.p8:402 if x$23 - lda #<$23 - jsr p8b_main.p8s_fail_ubyte -label_asm_33_afterif - ; source: test_ubyte_lt.p8:406 if x$24 - lda #<$24 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_34_afterif -label_asm_35_else - ; source: test_ubyte_lt.p8:409 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_ubyte_lt.p8:411 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_lt.p8:413 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:420 if x$25 - lda #<$25 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:442 skip7a: -p8l_skip7a - ; source: test_ubyte_lt.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:445 if x$26 - lda #<$26 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:449 skip7b: -p8l_skip7b - ; source: test_ubyte_lt.p8:451 if x$27 - lda #<$27 - jsr p8b_main.p8s_fail_ubyte -label_asm_39_afterif - ; source: test_ubyte_lt.p8:455 if x$28 - lda #<$28 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_40_afterif -label_asm_41_else - ; source: test_ubyte_lt.p8:458 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_ubyte_lt.p8:460 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_lt.p8:462 if x$29 - lda #<$29 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:466 skip8a: -p8l_skip8a - ; source: test_ubyte_lt.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:469 if x$2a - lda #<$2a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:473 skip8b: -p8l_skip8b - ; source: test_ubyte_lt.p8:475 if x$2b - lda #<$2b - jsr p8b_main.p8s_fail_ubyte -label_asm_42_afterif - ; source: test_ubyte_lt.p8:479 if x$2c - lda #<$2c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_43_afterif -label_asm_44_else - ; source: test_ubyte_lt.p8:482 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_ubyte_lt.p8:484 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_lt.p8:486 if x$2d - lda #<$2d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:490 skip9a: -p8l_skip9a - ; source: test_ubyte_lt.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:493 if x$2e - lda #<$2e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:497 skip9b: -p8l_skip9b - ; source: test_ubyte_lt.p8:499 if x$2f - lda #<$2f - jsr p8b_main.p8s_fail_ubyte -label_asm_45_afterif - ; source: test_ubyte_lt.p8:503 if x$30 - lda #<$30 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_46_afterif -label_asm_47_else - ; source: test_ubyte_lt.p8:506 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_ubyte_lt.p8:508 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lt.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .byte ? -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_lt.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_ubyte_lt.p8:511 ubyte @shared x - ; source: test_ubyte_lt.p8:512 ubyte[] values = [0, 0] - ; source: test_ubyte_lt.p8:511 ubyte @shared x - stz p8v_x - ; source: test_ubyte_lt.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_lt.p8:514 x=0 - stz p8v_x - ; source: test_ubyte_lt.p8:515 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_lt.p8:517 if x$31 - lda #<$31 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:521 skip1a: -p8l_skip1a - ; source: test_ubyte_lt.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:524 if x$32 - lda #<$32 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:528 skip1b: -p8l_skip1b - ; source: test_ubyte_lt.p8:530 if x$33 - lda #<$33 - jsr p8b_main.p8s_fail_ubyte -label_asm_48_afterif - ; source: test_ubyte_lt.p8:534 if x$34 - lda #<$34 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_49_afterif -label_asm_50_else - ; source: test_ubyte_lt.p8:537 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_ubyte_lt.p8:539 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_lt.p8:541 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:548 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:572 if x$35 - lda #<$35 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:594 skip4a: -p8l_skip4a - ; source: test_ubyte_lt.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:597 if x$36 - lda #<$36 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:601 skip4b: -p8l_skip4b - ; source: test_ubyte_lt.p8:603 if x$37 - lda #<$37 - jsr p8b_main.p8s_fail_ubyte -label_asm_57_afterif - ; source: test_ubyte_lt.p8:607 if x$38 - lda #<$38 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_58_afterif -label_asm_59_else - ; source: test_ubyte_lt.p8:610 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_ubyte_lt.p8:612 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_lt.p8:614 if x$39 - lda #<$39 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:618 skip5a: -p8l_skip5a - ; source: test_ubyte_lt.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:621 if x$3a - lda #<$3a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:625 skip5b: -p8l_skip5b - ; source: test_ubyte_lt.p8:627 if x$3b - lda #<$3b - jsr p8b_main.p8s_fail_ubyte -label_asm_60_afterif - ; source: test_ubyte_lt.p8:631 if x$3c - lda #<$3c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_61_afterif -label_asm_62_else - ; source: test_ubyte_lt.p8:634 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_ubyte_lt.p8:636 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_lt.p8:638 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:645 if x$3d - lda #<$3d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:667 skip7a: -p8l_skip7a - ; source: test_ubyte_lt.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:670 if x$3e - lda #<$3e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:674 skip7b: -p8l_skip7b - ; source: test_ubyte_lt.p8:676 if x$3f - lda #<$3f - jsr p8b_main.p8s_fail_ubyte -label_asm_66_afterif - ; source: test_ubyte_lt.p8:680 if x$40 - lda #<$40 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_67_afterif -label_asm_68_else - ; source: test_ubyte_lt.p8:683 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_ubyte_lt.p8:685 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_lt.p8:687 if x$41 - lda #<$41 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:691 skip8a: -p8l_skip8a - ; source: test_ubyte_lt.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:694 if x$42 - lda #<$42 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:698 skip8b: -p8l_skip8b - ; source: test_ubyte_lt.p8:700 if x$43 - lda #<$43 - jsr p8b_main.p8s_fail_ubyte -label_asm_69_afterif - ; source: test_ubyte_lt.p8:704 if x$44 - lda #<$44 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_70_afterif -label_asm_71_else - ; source: test_ubyte_lt.p8:707 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_ubyte_lt.p8:709 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_lt.p8:711 if x$45 - lda #<$45 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:715 skip9a: -p8l_skip9a - ; source: test_ubyte_lt.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:718 if x$46 - lda #<$46 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:722 skip9b: -p8l_skip9b - ; source: test_ubyte_lt.p8:724 if x$47 - lda #<$47 - jsr p8b_main.p8s_fail_ubyte -label_asm_72_afterif - ; source: test_ubyte_lt.p8:728 if x$48 - lda #<$48 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_73_afterif -label_asm_74_else - ; source: test_ubyte_lt.p8:731 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_ubyte_lt.p8:733 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lt.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS -; non-zeropage variables -p8v_values .byte $00, $00 - .pend - ; source: test_ubyte_lt.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_ubyte_lt.p8:736 ubyte @shared x - ; source: test_ubyte_lt.p8:739 float @shared f4 = 1.0 - ; source: test_ubyte_lt.p8:740 float @shared f5 = 1.0 - ; source: test_ubyte_lt.p8:736 ubyte @shared x - stz p8v_x - ; source: test_ubyte_lt.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_ubyte_lt.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_ubyte_lt.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_ubyte_lt.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_ubyte_lt.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_lt.p8:742 x=0 - stz p8v_x - ; source: test_ubyte_lt.p8:744 if x$49 - lda #<$49 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:748 skip1a: -p8l_skip1a - ; source: test_ubyte_lt.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:751 if x$4a - lda #<$4a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:755 skip1b: -p8l_skip1b - ; source: test_ubyte_lt.p8:757 if x$4b - lda #<$4b - jsr p8b_main.p8s_fail_ubyte -label_asm_75_afterif - ; source: test_ubyte_lt.p8:761 if x$4c - lda #<$4c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_76_afterif -label_asm_77_else - ; source: test_ubyte_lt.p8:764 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_ubyte_lt.p8:767 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:774 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:797 if x$4d - lda #<$4d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:818 skip4a: -p8l_skip4a - ; source: test_ubyte_lt.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:821 if x$4e - lda #<$4e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:825 skip4b: -p8l_skip4b - ; source: test_ubyte_lt.p8:827 if x$4f - lda #<$4f - jsr p8b_main.p8s_fail_ubyte -label_asm_84_afterif - ; source: test_ubyte_lt.p8:831 if x$50 - lda #<$50 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_85_afterif -label_asm_86_else - ; source: test_ubyte_lt.p8:834 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_ubyte_lt.p8:837 if x$51 - lda #<$51 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:841 skip5a: -p8l_skip5a - ; source: test_ubyte_lt.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:844 if x$52 - lda #<$52 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:848 skip5b: -p8l_skip5b - ; source: test_ubyte_lt.p8:850 if x$53 - lda #<$53 - jsr p8b_main.p8s_fail_ubyte -label_asm_87_afterif - ; source: test_ubyte_lt.p8:854 if x$54 - lda #<$54 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_88_afterif -label_asm_89_else - ; source: test_ubyte_lt.p8:857 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_ubyte_lt.p8:860 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:867 if x$55 - lda #<$55 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:888 skip7a: -p8l_skip7a - ; source: test_ubyte_lt.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:891 if x$56 - lda #<$56 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:895 skip7b: -p8l_skip7b - ; source: test_ubyte_lt.p8:897 if x$57 - lda #<$57 - jsr p8b_main.p8s_fail_ubyte -label_asm_93_afterif - ; source: test_ubyte_lt.p8:901 if x$58 - lda #<$58 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_94_afterif -label_asm_95_else - ; source: test_ubyte_lt.p8:904 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_ubyte_lt.p8:907 if x$59 - lda #<$59 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:911 skip8a: -p8l_skip8a - ; source: test_ubyte_lt.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:914 if x$5a - lda #<$5a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:918 skip8b: -p8l_skip8b - ; source: test_ubyte_lt.p8:920 if x$5b - lda #<$5b - jsr p8b_main.p8s_fail_ubyte -label_asm_96_afterif - ; source: test_ubyte_lt.p8:924 if x$5c - lda #<$5c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_97_afterif -label_asm_98_else - ; source: test_ubyte_lt.p8:927 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_ubyte_lt.p8:930 if x$5d - lda #<$5d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:934 skip9a: -p8l_skip9a - ; source: test_ubyte_lt.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lt.p8:937 if x$5e - lda #<$5e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lt.p8:941 skip9b: -p8l_skip9b - ; source: test_ubyte_lt.p8:943 if x$5f - lda #<$5f - jsr p8b_main.p8s_fail_ubyte -label_asm_99_afterif - ; source: test_ubyte_lt.p8:947 if x$60 - lda #<$60 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_100_afterif -label_asm_101_else - ; source: test_ubyte_lt.p8:950 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_ubyte_lt.p8:952 verify_success(18) - lda #$12 - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lt.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .byte ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $54, $45, $53, $54, $53 - .byte $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_ubyte_lt.p8 b/compiler/test/comparisons/test_ubyte_lt.p8 deleted file mode 100644 index 9f590291c..000000000 --- a/compiler/test/comparisons/test_ubyte_lt.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "ubyte" - uword @shared comparison - - sub start() { - txt.print("\nless-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_ubyte_lte.p8:14 txt.print("\nless-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:83 if x<=0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_lte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:87 skip1b: -p8l_skip1b - ; source: test_ubyte_lte.p8:89 if x<=0 - lda p8v_x - bne label_asm_3_afterif - ; source: test_ubyte_lte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_ubyte_lte.p8:93 if x<=0 - lda p8v_x - bne label_asm_5_else - ; source: test_ubyte_lte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_ubyte_lte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_ubyte_lte.p8:99 if x<=1 - lda p8v_x - cmp #2 - bcc p8l_lbl2a - ; source: test_ubyte_lte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_lte.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:103 skip2a: -p8l_skip2a - ; source: test_ubyte_lte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:106 if x<=1 - lda p8v_x - cmp #2 - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_lte.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:110 skip2b: -p8l_skip2b - ; source: test_ubyte_lte.p8:112 if x<=1 - lda p8v_x - cmp #2 - bcs label_asm_6_afterif - ; source: test_ubyte_lte.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_ubyte_lte.p8:116 if x<=1 - lda p8v_x - cmp #2 - bcs label_asm_8_else - ; source: test_ubyte_lte.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_ubyte_lte.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_ubyte_lte.p8:122 if x<=255 - lda #$ff - cmp p8v_x - bcs p8l_lbl3a - ; source: test_ubyte_lte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_lte.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:126 skip3a: -p8l_skip3a - ; source: test_ubyte_lte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:129 if x<=255 - lda #$ff - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_lte.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:133 skip3b: -p8l_skip3b - ; source: test_ubyte_lte.p8:135 if x<=255 - lda #$ff - cmp p8v_x - bcc label_asm_9_afterif - ; source: test_ubyte_lte.p8:136 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_ubyte_lte.p8:139 if x<=255 - lda #$ff - cmp p8v_x - bcc label_asm_11_else - ; source: test_ubyte_lte.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_ubyte_lte.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_ubyte_lte.p8:144 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_lte.p8:146 if x<=0 - beq p8l_lbl4a - ; source: test_ubyte_lte.p8:148 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_lte.p8:149 lbl4a: fail_ubyte(1) -p8l_lbl4a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:150 skip4a: -p8l_skip4a - ; source: test_ubyte_lte.p8:152 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:153 if x<=0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:155 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_lte.p8:156 lbl4b: fail_ubyte(2) -p8l_lbl4b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:157 skip4b: -p8l_skip4b - ; source: test_ubyte_lte.p8:159 if x<=0 - lda p8v_x - bne label_asm_12_afterif - ; source: test_ubyte_lte.p8:160 fail_ubyte(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_ubyte -label_asm_12_afterif - ; source: test_ubyte_lte.p8:163 if x<=0 - lda p8v_x - bne label_asm_14_else - ; source: test_ubyte_lte.p8:164 fail_ubyte(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_13_afterif -label_asm_14_else - ; source: test_ubyte_lte.p8:166 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_ubyte_lte.p8:169 if x<=1 - lda p8v_x - cmp #2 - bcc p8l_lbl5a - ; source: test_ubyte_lte.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_lte.p8:172 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:173 skip5a: -p8l_skip5a - ; source: test_ubyte_lte.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:176 if x<=1 - lda p8v_x - cmp #2 - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_lte.p8:179 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:180 skip5b: -p8l_skip5b - ; source: test_ubyte_lte.p8:182 if x<=1 - lda p8v_x - cmp #2 - bcs label_asm_15_afterif - ; source: test_ubyte_lte.p8:183 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_ubyte_lte.p8:186 if x<=1 - lda p8v_x - cmp #2 - bcs label_asm_17_else - ; source: test_ubyte_lte.p8:187 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_ubyte_lte.p8:189 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_ubyte_lte.p8:192 if x<=255 - lda #$ff - cmp p8v_x - bcs p8l_lbl6a - ; source: test_ubyte_lte.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_lte.p8:195 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:196 skip6a: -p8l_skip6a - ; source: test_ubyte_lte.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:199 if x<=255 - lda #$ff - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_lte.p8:202 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:203 skip6b: -p8l_skip6b - ; source: test_ubyte_lte.p8:205 if x<=255 - lda #$ff - cmp p8v_x - bcc label_asm_18_afterif - ; source: test_ubyte_lte.p8:206 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_ubyte_lte.p8:209 if x<=255 - lda #$ff - cmp p8v_x - bcc label_asm_20_else - ; source: test_ubyte_lte.p8:210 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_ubyte_lte.p8:212 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_ubyte_lte.p8:214 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_lte.p8:216 if x<=0 - beq p8l_lbl7a - ; source: test_ubyte_lte.p8:218 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_lte.p8:219 lbl7a: fail_ubyte(5) -p8l_lbl7a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:220 skip7a: -p8l_skip7a - ; source: test_ubyte_lte.p8:222 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:223 if x<=0 - lda p8v_x - bne + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:225 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_lte.p8:226 lbl7b: fail_ubyte(6) -p8l_lbl7b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:227 skip7b: -p8l_skip7b - ; source: test_ubyte_lte.p8:229 if x<=0 - lda p8v_x - bne label_asm_21_afterif - ; source: test_ubyte_lte.p8:230 fail_ubyte(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_ubyte -label_asm_21_afterif - ; source: test_ubyte_lte.p8:233 if x<=0 - lda p8v_x - bne label_asm_23_else - ; source: test_ubyte_lte.p8:234 fail_ubyte(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_22_afterif -label_asm_23_else - ; source: test_ubyte_lte.p8:236 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_ubyte_lte.p8:239 if x<=1 - lda p8v_x - cmp #2 - bcc p8l_lbl8a - ; source: test_ubyte_lte.p8:241 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_lte.p8:242 lbl8a: fail_ubyte(9) -p8l_lbl8a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:243 skip8a: -p8l_skip8a - ; source: test_ubyte_lte.p8:245 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:246 if x<=1 - lda p8v_x - cmp #2 - bcs + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:248 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_lte.p8:249 lbl8b: fail_ubyte(10) -p8l_lbl8b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:250 skip8b: -p8l_skip8b - ; source: test_ubyte_lte.p8:252 if x<=1 - lda p8v_x - cmp #2 - bcs label_asm_24_afterif - ; source: test_ubyte_lte.p8:253 fail_ubyte(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_ubyte -label_asm_24_afterif - ; source: test_ubyte_lte.p8:256 if x<=1 - lda p8v_x - cmp #2 - bcs label_asm_26_else - ; source: test_ubyte_lte.p8:257 fail_ubyte(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_25_afterif -label_asm_26_else - ; source: test_ubyte_lte.p8:259 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_ubyte_lte.p8:262 if x<=255 - lda #$ff - cmp p8v_x - bcs p8l_lbl9a - ; source: test_ubyte_lte.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_lte.p8:265 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:266 skip9a: -p8l_skip9a - ; source: test_ubyte_lte.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:269 if x<=255 - lda #$ff - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_lte.p8:272 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:273 skip9b: -p8l_skip9b - ; source: test_ubyte_lte.p8:275 if x<=255 - lda #$ff - cmp p8v_x - bcc label_asm_27_afterif - ; source: test_ubyte_lte.p8:276 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_ubyte_lte.p8:279 if x<=255 - lda #$ff - cmp p8v_x - bcc label_asm_29_else - ; source: test_ubyte_lte.p8:280 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_ubyte_lte.p8:282 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_ubyte_lte.p8:284 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_lte.p8:286 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_ubyte_lte.p8:287 ubyte @shared x, value - stz p8v_x - lda p8v_x - sta p8v_value - - ; source: test_ubyte_lte.p8:288 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_lte.p8:289 x=0 - stz p8v_x - ; source: test_ubyte_lte.p8:290 value=0 - stz p8v_value - ; source: test_ubyte_lte.p8:292 if x<=value - lda p8v_value - cmp p8v_x - bcs p8l_lbl1a - ; source: test_ubyte_lte.p8:294 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_lte.p8:295 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:296 skip1a: -p8l_skip1a - ; source: test_ubyte_lte.p8:298 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:299 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:301 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_lte.p8:302 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:303 skip1b: -p8l_skip1b - ; source: test_ubyte_lte.p8:305 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_30_afterif - ; source: test_ubyte_lte.p8:306 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_ubyte_lte.p8:309 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_32_else - ; source: test_ubyte_lte.p8:310 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_ubyte_lte.p8:312 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_ubyte_lte.p8:314 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_lte.p8:316 if x<=value - cmp p8v_x - bcs p8l_lbl2a - ; source: test_ubyte_lte.p8:318 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_lte.p8:319 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:320 skip2a: -p8l_skip2a - ; source: test_ubyte_lte.p8:322 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:323 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:325 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_lte.p8:326 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:327 skip2b: -p8l_skip2b - ; source: test_ubyte_lte.p8:329 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_33_afterif - ; source: test_ubyte_lte.p8:330 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_ubyte_lte.p8:333 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_35_else - ; source: test_ubyte_lte.p8:334 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_ubyte_lte.p8:336 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_ubyte_lte.p8:338 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_lte.p8:340 if x<=value - cmp p8v_x - bcs p8l_lbl3a - ; source: test_ubyte_lte.p8:342 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_lte.p8:343 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:344 skip3a: -p8l_skip3a - ; source: test_ubyte_lte.p8:346 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:347 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:349 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_lte.p8:350 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:351 skip3b: -p8l_skip3b - ; source: test_ubyte_lte.p8:353 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_36_afterif - ; source: test_ubyte_lte.p8:354 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_ubyte_lte.p8:357 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_38_else - ; source: test_ubyte_lte.p8:358 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_ubyte_lte.p8:360 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_ubyte_lte.p8:362 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_lte.p8:363 value=0 - stz p8v_value - ; source: test_ubyte_lte.p8:365 if x<=value - lda p8v_value - cmp p8v_x - bcs p8l_lbl4a - ; source: test_ubyte_lte.p8:367 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_lte.p8:368 lbl4a: fail_ubyte(13) -p8l_lbl4a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:369 skip4a: -p8l_skip4a - ; source: test_ubyte_lte.p8:371 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:372 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:374 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_lte.p8:375 lbl4b: fail_ubyte(14) -p8l_lbl4b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:376 skip4b: -p8l_skip4b - ; source: test_ubyte_lte.p8:378 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_39_afterif - ; source: test_ubyte_lte.p8:379 fail_ubyte(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_ubyte -label_asm_39_afterif - ; source: test_ubyte_lte.p8:382 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_41_else - ; source: test_ubyte_lte.p8:383 fail_ubyte(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_40_afterif -label_asm_41_else - ; source: test_ubyte_lte.p8:385 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_ubyte_lte.p8:387 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_lte.p8:389 if x<=value - cmp p8v_x - bcs p8l_lbl5a - ; source: test_ubyte_lte.p8:391 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_lte.p8:392 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:393 skip5a: -p8l_skip5a - ; source: test_ubyte_lte.p8:395 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:396 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:398 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_lte.p8:399 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:400 skip5b: -p8l_skip5b - ; source: test_ubyte_lte.p8:402 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_42_afterif - ; source: test_ubyte_lte.p8:403 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_ubyte_lte.p8:406 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_44_else - ; source: test_ubyte_lte.p8:407 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_ubyte_lte.p8:409 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_ubyte_lte.p8:411 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_lte.p8:413 if x<=value - cmp p8v_x - bcs p8l_lbl6a - ; source: test_ubyte_lte.p8:415 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_lte.p8:416 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:417 skip6a: -p8l_skip6a - ; source: test_ubyte_lte.p8:419 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:420 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:422 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_lte.p8:423 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:424 skip6b: -p8l_skip6b - ; source: test_ubyte_lte.p8:426 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_45_afterif - ; source: test_ubyte_lte.p8:427 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_ubyte_lte.p8:430 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_47_else - ; source: test_ubyte_lte.p8:431 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_ubyte_lte.p8:433 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_ubyte_lte.p8:435 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_lte.p8:436 value=0 - stz p8v_value - ; source: test_ubyte_lte.p8:438 if x<=value - lda p8v_value - cmp p8v_x - bcs p8l_lbl7a - ; source: test_ubyte_lte.p8:440 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_lte.p8:441 lbl7a: fail_ubyte(17) -p8l_lbl7a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:442 skip7a: -p8l_skip7a - ; source: test_ubyte_lte.p8:444 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:445 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:447 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_lte.p8:448 lbl7b: fail_ubyte(18) -p8l_lbl7b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:449 skip7b: -p8l_skip7b - ; source: test_ubyte_lte.p8:451 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_48_afterif - ; source: test_ubyte_lte.p8:452 fail_ubyte(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_ubyte -label_asm_48_afterif - ; source: test_ubyte_lte.p8:455 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_50_else - ; source: test_ubyte_lte.p8:456 fail_ubyte(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_49_afterif -label_asm_50_else - ; source: test_ubyte_lte.p8:458 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_ubyte_lte.p8:460 value=1 - lda #1 - sta p8v_value - ; source: test_ubyte_lte.p8:462 if x<=value - cmp p8v_x - bcs p8l_lbl8a - ; source: test_ubyte_lte.p8:464 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_lte.p8:465 lbl8a: fail_ubyte(21) -p8l_lbl8a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:466 skip8a: -p8l_skip8a - ; source: test_ubyte_lte.p8:468 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:469 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:471 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_lte.p8:472 lbl8b: fail_ubyte(22) -p8l_lbl8b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:473 skip8b: -p8l_skip8b - ; source: test_ubyte_lte.p8:475 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_51_afterif - ; source: test_ubyte_lte.p8:476 fail_ubyte(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_ubyte -label_asm_51_afterif - ; source: test_ubyte_lte.p8:479 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_53_else - ; source: test_ubyte_lte.p8:480 fail_ubyte(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_52_afterif -label_asm_53_else - ; source: test_ubyte_lte.p8:482 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_ubyte_lte.p8:484 value=255 - lda #$ff - sta p8v_value - ; source: test_ubyte_lte.p8:486 if x<=value - cmp p8v_x - bcs p8l_lbl9a - ; source: test_ubyte_lte.p8:488 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_lte.p8:489 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:490 skip9a: -p8l_skip9a - ; source: test_ubyte_lte.p8:492 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:493 if x<=value - lda p8v_value - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:495 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_lte.p8:496 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:497 skip9b: -p8l_skip9b - ; source: test_ubyte_lte.p8:499 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_54_afterif - ; source: test_ubyte_lte.p8:500 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_ubyte_lte.p8:503 if x<=value - lda p8v_value - cmp p8v_x - bcc label_asm_56_else - ; source: test_ubyte_lte.p8:504 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_ubyte_lte.p8:506 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_ubyte_lte.p8:508 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lte.p8:286 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .byte ? -p8v_x .byte ? - .send BSS - .pend - ; source: test_ubyte_lte.p8:510 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_ubyte_lte.p8:511 ubyte @shared x - ; source: test_ubyte_lte.p8:512 ubyte[] values = [0, 0] - ; source: test_ubyte_lte.p8:511 ubyte @shared x - stz p8v_x - ; source: test_ubyte_lte.p8:513 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_lte.p8:514 x=0 - stz p8v_x - ; source: test_ubyte_lte.p8:515 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_lte.p8:517 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcs p8l_lbl1a - ; source: test_ubyte_lte.p8:519 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_lte.p8:520 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:521 skip1a: -p8l_skip1a - ; source: test_ubyte_lte.p8:523 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:524 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:526 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_lte.p8:527 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:528 skip1b: -p8l_skip1b - ; source: test_ubyte_lte.p8:530 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_57_afterif - ; source: test_ubyte_lte.p8:531 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_ubyte_lte.p8:534 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_59_else - ; source: test_ubyte_lte.p8:535 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_ubyte_lte.p8:537 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_ubyte_lte.p8:539 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_lte.p8:541 if x<=values[1] - cmp p8v_x - bcs p8l_lbl2a - ; source: test_ubyte_lte.p8:543 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_lte.p8:544 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:545 skip2a: -p8l_skip2a - ; source: test_ubyte_lte.p8:547 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:548 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:550 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_lte.p8:551 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:552 skip2b: -p8l_skip2b - ; source: test_ubyte_lte.p8:554 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_60_afterif - ; source: test_ubyte_lte.p8:555 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_ubyte_lte.p8:558 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_62_else - ; source: test_ubyte_lte.p8:559 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_ubyte_lte.p8:561 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_ubyte_lte.p8:563 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_lte.p8:565 if x<=values[1] - cmp p8v_x - bcs p8l_lbl3a - ; source: test_ubyte_lte.p8:567 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_lte.p8:568 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:569 skip3a: -p8l_skip3a - ; source: test_ubyte_lte.p8:571 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:572 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:574 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_lte.p8:575 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:576 skip3b: -p8l_skip3b - ; source: test_ubyte_lte.p8:578 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_63_afterif - ; source: test_ubyte_lte.p8:579 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_ubyte_lte.p8:582 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_65_else - ; source: test_ubyte_lte.p8:583 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_ubyte_lte.p8:585 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_ubyte_lte.p8:587 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_lte.p8:588 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_lte.p8:590 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcs p8l_lbl4a - ; source: test_ubyte_lte.p8:592 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_lte.p8:593 lbl4a: fail_ubyte(25) -p8l_lbl4a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:594 skip4a: -p8l_skip4a - ; source: test_ubyte_lte.p8:596 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:597 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:599 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_lte.p8:600 lbl4b: fail_ubyte(26) -p8l_lbl4b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:601 skip4b: -p8l_skip4b - ; source: test_ubyte_lte.p8:603 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_66_afterif - ; source: test_ubyte_lte.p8:604 fail_ubyte(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_ubyte -label_asm_66_afterif - ; source: test_ubyte_lte.p8:607 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_68_else - ; source: test_ubyte_lte.p8:608 fail_ubyte(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_67_afterif -label_asm_68_else - ; source: test_ubyte_lte.p8:610 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_ubyte_lte.p8:612 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_lte.p8:614 if x<=values[1] - cmp p8v_x - bcs p8l_lbl5a - ; source: test_ubyte_lte.p8:616 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_lte.p8:617 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:618 skip5a: -p8l_skip5a - ; source: test_ubyte_lte.p8:620 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:621 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:623 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_lte.p8:624 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:625 skip5b: -p8l_skip5b - ; source: test_ubyte_lte.p8:627 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_69_afterif - ; source: test_ubyte_lte.p8:628 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_ubyte_lte.p8:631 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_71_else - ; source: test_ubyte_lte.p8:632 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_ubyte_lte.p8:634 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_ubyte_lte.p8:636 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_lte.p8:638 if x<=values[1] - cmp p8v_x - bcs p8l_lbl6a - ; source: test_ubyte_lte.p8:640 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_lte.p8:641 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:642 skip6a: -p8l_skip6a - ; source: test_ubyte_lte.p8:644 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:645 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:647 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_lte.p8:648 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:649 skip6b: -p8l_skip6b - ; source: test_ubyte_lte.p8:651 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_72_afterif - ; source: test_ubyte_lte.p8:652 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_ubyte_lte.p8:655 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_74_else - ; source: test_ubyte_lte.p8:656 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_ubyte_lte.p8:658 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_ubyte_lte.p8:660 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_lte.p8:661 values[1]=0 - stz p8v_values+1 - ; source: test_ubyte_lte.p8:663 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcs p8l_lbl7a - ; source: test_ubyte_lte.p8:665 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_lte.p8:666 lbl7a: fail_ubyte(29) -p8l_lbl7a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:667 skip7a: -p8l_skip7a - ; source: test_ubyte_lte.p8:669 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:670 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:672 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_lte.p8:673 lbl7b: fail_ubyte(30) -p8l_lbl7b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:674 skip7b: -p8l_skip7b - ; source: test_ubyte_lte.p8:676 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_75_afterif - ; source: test_ubyte_lte.p8:677 fail_ubyte(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_ubyte -label_asm_75_afterif - ; source: test_ubyte_lte.p8:680 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_77_else - ; source: test_ubyte_lte.p8:681 fail_ubyte(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_76_afterif -label_asm_77_else - ; source: test_ubyte_lte.p8:683 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_ubyte_lte.p8:685 values[1]=1 - lda #1 - sta p8v_values+1 - ; source: test_ubyte_lte.p8:687 if x<=values[1] - cmp p8v_x - bcs p8l_lbl8a - ; source: test_ubyte_lte.p8:689 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_lte.p8:690 lbl8a: fail_ubyte(33) -p8l_lbl8a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:691 skip8a: -p8l_skip8a - ; source: test_ubyte_lte.p8:693 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:694 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:696 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_lte.p8:697 lbl8b: fail_ubyte(34) -p8l_lbl8b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:698 skip8b: -p8l_skip8b - ; source: test_ubyte_lte.p8:700 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_78_afterif - ; source: test_ubyte_lte.p8:701 fail_ubyte(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_ubyte -label_asm_78_afterif - ; source: test_ubyte_lte.p8:704 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_80_else - ; source: test_ubyte_lte.p8:705 fail_ubyte(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_79_afterif -label_asm_80_else - ; source: test_ubyte_lte.p8:707 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_ubyte_lte.p8:709 values[1]=255 - lda #$ff - sta p8v_values+1 - ; source: test_ubyte_lte.p8:711 if x<=values[1] - cmp p8v_x - bcs p8l_lbl9a - ; source: test_ubyte_lte.p8:713 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_lte.p8:714 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:715 skip9a: -p8l_skip9a - ; source: test_ubyte_lte.p8:717 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:718 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:720 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_lte.p8:721 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:722 skip9b: -p8l_skip9b - ; source: test_ubyte_lte.p8:724 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_81_afterif - ; source: test_ubyte_lte.p8:725 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_ubyte_lte.p8:728 if x<=values[1] - lda p8v_values+1 - cmp p8v_x - bcc label_asm_83_else - ; source: test_ubyte_lte.p8:729 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_ubyte_lte.p8:731 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_ubyte_lte.p8:733 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lte.p8:510 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .byte ? - .send BSS -; non-zeropage variables -p8v_values .byte $00, $00 - .pend - ; source: test_ubyte_lte.p8:735 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_ubyte_lte.p8:736 ubyte @shared x - ; source: test_ubyte_lte.p8:739 float @shared f4 = 1.0 - ; source: test_ubyte_lte.p8:740 float @shared f5 = 1.0 - ; source: test_ubyte_lte.p8:736 ubyte @shared x - stz p8v_x - ; source: test_ubyte_lte.p8:737 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_ubyte_lte.p8:738 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_ubyte_lte.p8:739 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_ubyte_lte.p8:740 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_ubyte_lte.p8:741 success = 0 - stz p8b_main.p8v_success - ; source: test_ubyte_lte.p8:742 x=0 - stz p8v_x - ; source: test_ubyte_lte.p8:744 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl1a - ; source: test_ubyte_lte.p8:746 goto skip1a - bra p8l_skip1a - ; source: test_ubyte_lte.p8:747 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:748 skip1a: -p8l_skip1a - ; source: test_ubyte_lte.p8:750 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:751 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:753 goto skip1b - bra p8l_skip1b - ; source: test_ubyte_lte.p8:754 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:755 skip1b: -p8l_skip1b - ; source: test_ubyte_lte.p8:757 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_84_afterif - ; source: test_ubyte_lte.p8:758 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_ubyte_lte.p8:761 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_86_else - ; source: test_ubyte_lte.p8:762 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_ubyte_lte.p8:764 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_ubyte_lte.p8:767 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl2a - ; source: test_ubyte_lte.p8:769 goto skip2a - bra p8l_skip2a - ; source: test_ubyte_lte.p8:770 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:771 skip2a: -p8l_skip2a - ; source: test_ubyte_lte.p8:773 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:774 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:776 goto skip2b - bra p8l_skip2b - ; source: test_ubyte_lte.p8:777 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:778 skip2b: -p8l_skip2b - ; source: test_ubyte_lte.p8:780 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_87_afterif - ; source: test_ubyte_lte.p8:781 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_ubyte_lte.p8:784 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_89_else - ; source: test_ubyte_lte.p8:785 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_ubyte_lte.p8:787 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_ubyte_lte.p8:790 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl3a - ; source: test_ubyte_lte.p8:792 goto skip3a - bra p8l_skip3a - ; source: test_ubyte_lte.p8:793 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:794 skip3a: -p8l_skip3a - ; source: test_ubyte_lte.p8:796 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:797 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:799 goto skip3b - bra p8l_skip3b - ; source: test_ubyte_lte.p8:800 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:801 skip3b: -p8l_skip3b - ; source: test_ubyte_lte.p8:803 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_90_afterif - ; source: test_ubyte_lte.p8:804 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_ubyte_lte.p8:807 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_92_else - ; source: test_ubyte_lte.p8:808 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_ubyte_lte.p8:810 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_ubyte_lte.p8:812 x=1 - lda #1 - sta p8v_x - ; source: test_ubyte_lte.p8:814 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl4a - ; source: test_ubyte_lte.p8:816 goto skip4a - bra p8l_skip4a - ; source: test_ubyte_lte.p8:817 lbl4a: fail_ubyte(37) -p8l_lbl4a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:818 skip4a: -p8l_skip4a - ; source: test_ubyte_lte.p8:820 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:821 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:823 goto skip4b - bra p8l_skip4b - ; source: test_ubyte_lte.p8:824 lbl4b: fail_ubyte(38) -p8l_lbl4b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:825 skip4b: -p8l_skip4b - ; source: test_ubyte_lte.p8:827 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_93_afterif - ; source: test_ubyte_lte.p8:828 fail_ubyte(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_ubyte -label_asm_93_afterif - ; source: test_ubyte_lte.p8:831 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_95_else - ; source: test_ubyte_lte.p8:832 fail_ubyte(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_94_afterif -label_asm_95_else - ; source: test_ubyte_lte.p8:834 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_ubyte_lte.p8:837 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl5a - ; source: test_ubyte_lte.p8:839 goto skip5a - bra p8l_skip5a - ; source: test_ubyte_lte.p8:840 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:841 skip5a: -p8l_skip5a - ; source: test_ubyte_lte.p8:843 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:844 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:846 goto skip5b - bra p8l_skip5b - ; source: test_ubyte_lte.p8:847 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:848 skip5b: -p8l_skip5b - ; source: test_ubyte_lte.p8:850 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_96_afterif - ; source: test_ubyte_lte.p8:851 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_ubyte_lte.p8:854 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_98_else - ; source: test_ubyte_lte.p8:855 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_ubyte_lte.p8:857 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_ubyte_lte.p8:860 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl6a - ; source: test_ubyte_lte.p8:862 goto skip6a - bra p8l_skip6a - ; source: test_ubyte_lte.p8:863 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:864 skip6a: -p8l_skip6a - ; source: test_ubyte_lte.p8:866 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:867 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:869 goto skip6b - bra p8l_skip6b - ; source: test_ubyte_lte.p8:870 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:871 skip6b: -p8l_skip6b - ; source: test_ubyte_lte.p8:873 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_99_afterif - ; source: test_ubyte_lte.p8:874 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_ubyte_lte.p8:877 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_101_else - ; source: test_ubyte_lte.p8:878 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_ubyte_lte.p8:880 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_ubyte_lte.p8:882 x=255 - lda #$ff - sta p8v_x - ; source: test_ubyte_lte.p8:884 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl7a - ; source: test_ubyte_lte.p8:886 goto skip7a - bra p8l_skip7a - ; source: test_ubyte_lte.p8:887 lbl7a: fail_ubyte(41) -p8l_lbl7a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:888 skip7a: -p8l_skip7a - ; source: test_ubyte_lte.p8:890 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:891 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:893 goto skip7b - bra p8l_skip7b - ; source: test_ubyte_lte.p8:894 lbl7b: fail_ubyte(42) -p8l_lbl7b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:895 skip7b: -p8l_skip7b - ; source: test_ubyte_lte.p8:897 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_102_afterif - ; source: test_ubyte_lte.p8:898 fail_ubyte(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_ubyte -label_asm_102_afterif - ; source: test_ubyte_lte.p8:901 if x<=cx16.r4L+0-cx16.r5L - lda cx16.r4L - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_104_else - ; source: test_ubyte_lte.p8:902 fail_ubyte(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_ubyte - bra label_asm_103_afterif -label_asm_104_else - ; source: test_ubyte_lte.p8:904 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_ubyte_lte.p8:907 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl8a - ; source: test_ubyte_lte.p8:909 goto skip8a - bra p8l_skip8a - ; source: test_ubyte_lte.p8:910 lbl8a: fail_ubyte(45) -p8l_lbl8a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:911 skip8a: -p8l_skip8a - ; source: test_ubyte_lte.p8:913 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:914 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:916 goto skip8b - bra p8l_skip8b - ; source: test_ubyte_lte.p8:917 lbl8b: fail_ubyte(46) -p8l_lbl8b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_ubyte - ; source: test_ubyte_lte.p8:918 skip8b: -p8l_skip8b - ; source: test_ubyte_lte.p8:920 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_105_afterif - ; source: test_ubyte_lte.p8:921 fail_ubyte(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_ubyte -label_asm_105_afterif - ; source: test_ubyte_lte.p8:924 if x<=cx16.r4L+1-cx16.r5L - lda cx16.r4L - clc - adc #1 - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_107_else - ; source: test_ubyte_lte.p8:925 fail_ubyte(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_ubyte - bra label_asm_106_afterif -label_asm_107_else - ; source: test_ubyte_lte.p8:927 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_ubyte_lte.p8:930 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcs p8l_lbl9a - ; source: test_ubyte_lte.p8:932 goto skip9a - bra p8l_skip9a - ; source: test_ubyte_lte.p8:933 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:934 skip9a: -p8l_skip9a - ; source: test_ubyte_lte.p8:936 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_ubyte_lte.p8:937 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc + - jmp (cx16.r3) -+ - ; source: test_ubyte_lte.p8:939 goto skip9b - bra p8l_skip9b - ; source: test_ubyte_lte.p8:940 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_ubyte_lte.p8:941 skip9b: -p8l_skip9b - ; source: test_ubyte_lte.p8:943 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_108_afterif - ; source: test_ubyte_lte.p8:944 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_ubyte_lte.p8:947 if x<=cx16.r4L+255-cx16.r5L - lda cx16.r4L - clc - adc #$ff - sec - sbc cx16.r5L - cmp p8v_x - bcc label_asm_110_else - ; source: test_ubyte_lte.p8:948 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_ubyte_lte.p8:950 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_ubyte_lte.p8:952 verify_success(27) - lda #$1b - jmp p8b_main.p8s_verify_success - ; source: test_ubyte_lte.p8:735 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .byte ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $54, $45, $53, $54 - .byte $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n<=number: " - .byte $0d, $3c, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n<=var: " - .byte $0d, $3c, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n<=expr: " - .byte $0d, $3c, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_ubyte_lte.p8:14 txt.print("\nless-equal tests for: ") - ; source: test_ubyte_lte.p8:18 txt.print("\n<=number: ") - ; source: test_ubyte_lte.p8:20 txt.print("\n<=var: ") - ; source: test_ubyte_lte.p8:22 txt.print("\n<=array[]: ") - ; source: test_ubyte_lte.p8:24 txt.print("\n<=expr: ") - ; source: test_ubyte_lte.p8:33 txt.print(" **failed** ") - ; source: test_ubyte_lte.p8:35 txt.print(" success, expected ") - ; source: test_ubyte_lte.p8:41 txt.print(" **fail#") - ; source: test_ubyte_lte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_ubyte_lte.p8 b/compiler/test/comparisons/test_ubyte_lte.p8 deleted file mode 100644 index 15c7fc188..000000000 --- a/compiler/test/comparisons/test_ubyte_lte.p8 +++ /dev/null @@ -1,956 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "ubyte" - uword @shared comparison - - sub start() { - txt.print("\nless-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=number: ") - test_cmp_number() - txt.print("\n<=var: ") - test_cmp_var() - txt.print("\n<=array[]: ") - test_cmp_array() - txt.print("\n<=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - ubyte @shared x - success = 0 - x=0 - ; direct jump - if x<=0 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=0 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=1 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=255 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=255 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=255 - success++ - - ; with else - if x<=255 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=0 - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=0 - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(2) -skip4b: - ; no else - if x<=0 - fail_ubyte(3) - - ; with else - if x<=0 - fail_ubyte(4) - else - success++ - - ; direct jump - if x<=1 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=1 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=255 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=255 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=255 - success++ - - ; with else - if x<=255 - success++ - else - cx16.r0L++ - - x=255 - ; direct jump - if x<=0 - goto lbl7a - goto skip7a -lbl7a: fail_ubyte(5) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=0 - goto cx16.r3 - goto skip7b -lbl7b: fail_ubyte(6) -skip7b: - ; no else - if x<=0 - fail_ubyte(7) - - ; with else - if x<=0 - fail_ubyte(8) - else - success++ - - ; direct jump - if x<=1 - goto lbl8a - goto skip8a -lbl8a: fail_ubyte(9) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=1 - goto cx16.r3 - goto skip8b -lbl8b: fail_ubyte(10) -skip8b: - ; no else - if x<=1 - fail_ubyte(11) - - ; with else - if x<=1 - fail_ubyte(12) - else - success++ - - ; direct jump - if x<=255 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=255 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=255 - success++ - - ; with else - if x<=255 - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_var() { - ubyte @shared x, value - success = 0 - x=0 - value=0 - ; direct jump - if x<=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x<=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=1 - value=0 - ; direct jump - if x<=value - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(13) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=value - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(14) -skip4b: - ; no else - if x<=value - fail_ubyte(15) - - ; with else - if x<=value - fail_ubyte(16) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=255 - ; direct jump - if x<=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=255 - value=0 - ; direct jump - if x<=value - goto lbl7a - goto skip7a -lbl7a: fail_ubyte(17) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=value - goto cx16.r3 - goto skip7b -lbl7b: fail_ubyte(18) -skip7b: - ; no else - if x<=value - fail_ubyte(19) - - ; with else - if x<=value - fail_ubyte(20) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl8a - goto skip8a -lbl8a: fail_ubyte(21) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=value - goto cx16.r3 - goto skip8b -lbl8b: fail_ubyte(22) -skip8b: - ; no else - if x<=value - fail_ubyte(23) - - ; with else - if x<=value - fail_ubyte(24) - else - success++ - - value=255 - ; direct jump - if x<=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_array() { - ubyte @shared x - ubyte[] values = [0, 0] - success = 0 - x=0 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=1 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(25) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(26) -skip4b: - ; no else - if x<=values[1] - fail_ubyte(27) - - ; with else - if x<=values[1] - fail_ubyte(28) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=255 - ; direct jump - if x<=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=255 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl7a - goto skip7a -lbl7a: fail_ubyte(29) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_ubyte(30) -skip7b: - ; no else - if x<=values[1] - fail_ubyte(31) - - ; with else - if x<=values[1] - fail_ubyte(32) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_ubyte(33) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_ubyte(34) -skip8b: - ; no else - if x<=values[1] - fail_ubyte(35) - - ; with else - if x<=values[1] - fail_ubyte(36) - else - success++ - - values[1]=255 - ; direct jump - if x<=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - verify_success(27) -} - sub test_cmp_expr() { - ubyte @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x<=cx16.r4L+0-cx16.r5L - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=cx16.r4L+0-cx16.r5L - success++ - - ; with else - if x<=cx16.r4L+0-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4L+1-cx16.r5L - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x<=cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4L+255-cx16.r5L - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x<=cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=cx16.r4L+0-cx16.r5L - goto lbl4a - goto skip4a -lbl4a: fail_ubyte(37) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip4b -lbl4b: fail_ubyte(38) -skip4b: - ; no else - if x<=cx16.r4L+0-cx16.r5L - fail_ubyte(39) - - ; with else - if x<=cx16.r4L+0-cx16.r5L - fail_ubyte(40) - else - success++ - - ; direct jump - if x<=cx16.r4L+1-cx16.r5L - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=cx16.r4L+1-cx16.r5L - success++ - - ; with else - if x<=cx16.r4L+1-cx16.r5L - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4L+255-cx16.r5L - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x<=cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - x=255 - ; direct jump - if x<=cx16.r4L+0-cx16.r5L - goto lbl7a - goto skip7a -lbl7a: fail_ubyte(41) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=cx16.r4L+0-cx16.r5L - goto cx16.r3 - goto skip7b -lbl7b: fail_ubyte(42) -skip7b: - ; no else - if x<=cx16.r4L+0-cx16.r5L - fail_ubyte(43) - - ; with else - if x<=cx16.r4L+0-cx16.r5L - fail_ubyte(44) - else - success++ - - ; direct jump - if x<=cx16.r4L+1-cx16.r5L - goto lbl8a - goto skip8a -lbl8a: fail_ubyte(45) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=cx16.r4L+1-cx16.r5L - goto cx16.r3 - goto skip8b -lbl8b: fail_ubyte(46) -skip8b: - ; no else - if x<=cx16.r4L+1-cx16.r5L - fail_ubyte(47) - - ; with else - if x<=cx16.r4L+1-cx16.r5L - fail_ubyte(48) - else - success++ - - ; direct jump - if x<=cx16.r4L+255-cx16.r5L - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=cx16.r4L+255-cx16.r5L - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=cx16.r4L+255-cx16.r5L - success++ - - ; with else - if x<=cx16.r4L+255-cx16.r5L - success++ - else - cx16.r0L++ - - verify_success(27) -} - -} - diff --git a/compiler/test/comparisons/test_uword_equalities.asm b/compiler/test/comparisons/test_uword_equalities.asm deleted file mode 100644 index a8684eb18..000000000 --- a/compiler/test/comparisons/test_uword_equalities.asm +++ /dev/null @@ -1,18832 +0,0 @@ -; w65c02 assembly code for 'test_uword_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:43 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_equalities.p8:9 ubyte success = 0 - ; source: test_uword_equalities.p8:10 str datatype = "uword" - ; source: test_uword_equalities.p8:11 uword @shared comparison - ; source: test_uword_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:107 if x==0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:109 goto skip2 - bra p8l_skip2 - ; source: test_uword_equalities.p8:110 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:111 skip2: -p8l_skip2 - ; source: test_uword_equalities.p8:113 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_3_afterif - ; source: test_uword_equalities.p8:114 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_uword_equalities.p8:117 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_5_else - ; source: test_uword_equalities.p8:118 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_equalities.p8:120 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_uword_equalities.p8:122 x = 9999 - lda #<$270f - ldy #>$270f - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:124 if x==0 - ora p8v_x+1 - beq p8l_skip3 - ; source: test_uword_equalities.p8:126 success++ - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:127 skip3: -p8l_skip3 - ; source: test_uword_equalities.p8:129 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:130 if x==0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:132 success++ - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:133 skip4: -p8l_skip4 - ; source: test_uword_equalities.p8:135 success++ - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:136 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_6_afterif - ; source: test_uword_equalities.p8:137 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_uword_equalities.p8:140 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_8_else - ; source: test_uword_equalities.p8:141 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_equalities.p8:143 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_uword_equalities.p8:145 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:94 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:149 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_uword_equalities.p8:150 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:151 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:153 x=9999 - lda #<$270f - ldy #>$270f - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:155 if x!=0 - ora p8v_x+1 - bne p8l_lbl1 - ; source: test_uword_equalities.p8:157 goto skip1 - bra p8l_skip1 - ; source: test_uword_equalities.p8:158 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:159 skip1: -p8l_skip1 - ; source: test_uword_equalities.p8:161 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:162 if x!=0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:164 goto skip2 - bra p8l_skip2 - ; source: test_uword_equalities.p8:165 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:166 skip2: -p8l_skip2 - ; source: test_uword_equalities.p8:168 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_9_afterif - ; source: test_uword_equalities.p8:169 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_uword_equalities.p8:172 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_11_else - ; source: test_uword_equalities.p8:173 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_equalities.p8:175 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_uword_equalities.p8:177 x = 0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:179 if x!=0 - lda p8v_x - ora p8v_x+1 - bne p8l_skip3 - ; source: test_uword_equalities.p8:181 success++ - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:182 skip3: -p8l_skip3 - ; source: test_uword_equalities.p8:184 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:185 if x!=0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:187 success++ - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:188 skip4: -p8l_skip4 - ; source: test_uword_equalities.p8:190 success++ - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:191 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_12_afterif - ; source: test_uword_equalities.p8:192 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_uword_equalities.p8:195 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_14_else - ; source: test_uword_equalities.p8:196 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_equalities.p8:198 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_uword_equalities.p8:200 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:149 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:203 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_uword_equalities.p8:204 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:205 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:206 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:208 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - beq p8l_lbl1a -+ - ; source: test_uword_equalities.p8:210 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:211 lbl1a: fail_uword(1,0) -p8l_lbl1a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:212 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:214 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:215 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:217 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:218 lbl1b: fail_uword(2,0) -p8l_lbl1b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:219 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:221 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_15_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_15_afterif - ; source: test_uword_equalities.p8:222 fail_uword(3,0) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_15_afterif - ; source: test_uword_equalities.p8:225 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_17_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_17_else - ; source: test_uword_equalities.p8:226 fail_uword(4,0) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_equalities.p8:228 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_uword_equalities.p8:231 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl2a -+ - ; source: test_uword_equalities.p8:233 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:234 lbl2a: fail_uword(5,0) -p8l_lbl2a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:235 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:237 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:238 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:240 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:241 lbl2b: fail_uword(6,0) -p8l_lbl2b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:242 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:244 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_18_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_18_afterif - ; source: test_uword_equalities.p8:245 fail_uword(7,0) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_18_afterif - ; source: test_uword_equalities.p8:248 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_20_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_20_else - ; source: test_uword_equalities.p8:249 fail_uword(8,0) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_equalities.p8:251 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_uword_equalities.p8:254 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - beq p8l_lbl3a -+ - ; source: test_uword_equalities.p8:256 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:257 lbl3a: fail_uword(9,0) -p8l_lbl3a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:258 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:260 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:261 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:263 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:264 lbl3b: fail_uword(10,0) -p8l_lbl3b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:265 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:267 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_21_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_21_afterif - ; source: test_uword_equalities.p8:268 fail_uword(11,0) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_21_afterif - ; source: test_uword_equalities.p8:271 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_23_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_23_else - ; source: test_uword_equalities.p8:272 fail_uword(12,0) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_equalities.p8:274 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_uword_equalities.p8:276 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:278 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - beq p8l_lbl4a -+ - ; source: test_uword_equalities.p8:280 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:281 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:282 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:284 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:285 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:287 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:288 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:289 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:291 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_24_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_24_afterif - ; source: test_uword_equalities.p8:292 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_uword_equalities.p8:295 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_26_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_26_else - ; source: test_uword_equalities.p8:296 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_equalities.p8:298 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_uword_equalities.p8:301 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl5a -+ - ; source: test_uword_equalities.p8:303 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:304 lbl5a: fail_uword(13,1) -p8l_lbl5a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:305 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:307 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:308 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:310 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:311 lbl5b: fail_uword(14,1) -p8l_lbl5b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:312 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:314 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_27_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_27_afterif - ; source: test_uword_equalities.p8:315 fail_uword(15,1) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_27_afterif - ; source: test_uword_equalities.p8:318 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_29_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_29_else - ; source: test_uword_equalities.p8:319 fail_uword(16,1) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_equalities.p8:321 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_uword_equalities.p8:324 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - beq p8l_lbl6a -+ - ; source: test_uword_equalities.p8:326 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:327 lbl6a: fail_uword(17,1) -p8l_lbl6a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:328 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:330 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:331 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:333 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:334 lbl6b: fail_uword(18,1) -p8l_lbl6b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:335 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:337 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_30_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_30_afterif - ; source: test_uword_equalities.p8:338 fail_uword(19,1) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_30_afterif - ; source: test_uword_equalities.p8:341 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_32_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_32_else - ; source: test_uword_equalities.p8:342 fail_uword(20,1) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_equalities.p8:344 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_uword_equalities.p8:346 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:348 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - beq p8l_lbl7a -+ - ; source: test_uword_equalities.p8:350 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:351 lbl7a: fail_uword(21,30464) -p8l_lbl7a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:352 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:354 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:355 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:357 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:358 lbl7b: fail_uword(22,30464) -p8l_lbl7b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:359 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:361 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_33_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_33_afterif - ; source: test_uword_equalities.p8:362 fail_uword(23,30464) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_33_afterif - ; source: test_uword_equalities.p8:365 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_35_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_35_else - ; source: test_uword_equalities.p8:366 fail_uword(24,30464) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_equalities.p8:368 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_uword_equalities.p8:371 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl8a -+ - ; source: test_uword_equalities.p8:373 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:374 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:375 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:377 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:378 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:380 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:381 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:382 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:384 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_36_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_36_afterif - ; source: test_uword_equalities.p8:385 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_uword_equalities.p8:388 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_38_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_38_else - ; source: test_uword_equalities.p8:389 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_equalities.p8:391 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_uword_equalities.p8:394 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - beq p8l_lbl9a -+ - ; source: test_uword_equalities.p8:396 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:397 lbl9a: fail_uword(25,30464) -p8l_lbl9a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:398 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:400 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:401 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:403 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:404 lbl9b: fail_uword(26,30464) -p8l_lbl9b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:405 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:407 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_39_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_39_afterif - ; source: test_uword_equalities.p8:408 fail_uword(27,30464) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_39_afterif - ; source: test_uword_equalities.p8:411 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_41_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_41_else - ; source: test_uword_equalities.p8:412 fail_uword(28,30464) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_equalities.p8:414 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_uword_equalities.p8:416 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:418 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - beq p8l_lbl10a -+ - ; source: test_uword_equalities.p8:420 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:421 lbl10a: fail_uword(29,65535) -p8l_lbl10a - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:422 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:424 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:425 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:427 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:428 lbl10b: fail_uword(30,65535) -p8l_lbl10b - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:429 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:431 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_42_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_42_afterif - ; source: test_uword_equalities.p8:432 fail_uword(31,65535) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_42_afterif - ; source: test_uword_equalities.p8:435 if x==1 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<1 - bne label_asm_44_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>1 - bne label_asm_44_else - ; source: test_uword_equalities.p8:436 fail_uword(32,65535) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_equalities.p8:438 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_uword_equalities.p8:441 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl11a -+ - ; source: test_uword_equalities.p8:443 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:444 lbl11a: fail_uword(33,65535) -p8l_lbl11a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:445 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:447 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:448 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:450 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:451 lbl11b: fail_uword(34,65535) -p8l_lbl11b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:452 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:454 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_45_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_45_afterif - ; source: test_uword_equalities.p8:455 fail_uword(35,65535) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_45_afterif - ; source: test_uword_equalities.p8:458 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_47_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_47_else - ; source: test_uword_equalities.p8:459 fail_uword(36,65535) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_equalities.p8:461 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_uword_equalities.p8:464 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - beq p8l_lbl12a -+ - ; source: test_uword_equalities.p8:466 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:467 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:468 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:470 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:471 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:473 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:474 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:475 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:477 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_48_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_48_afterif - ; source: test_uword_equalities.p8:478 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_uword_equalities.p8:481 if x==65535 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<65535 - bne label_asm_50_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>65535 - bne label_asm_50_else - ; source: test_uword_equalities.p8:482 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_equalities.p8:484 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_uword_equalities.p8:486 verify_success(12) - lda #12 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:203 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:488 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_uword_equalities.p8:489 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:490 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:491 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:493 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne p8l_lbl1a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - bne p8l_lbl1a - ; source: test_uword_equalities.p8:495 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:496 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:497 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:499 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:500 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:502 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:503 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:504 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:506 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_51_afterif -+ - ; source: test_uword_equalities.p8:507 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_uword_equalities.p8:510 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_53_else -+ - ; source: test_uword_equalities.p8:511 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_equalities.p8:513 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_uword_equalities.p8:516 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl2a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl2a - ; source: test_uword_equalities.p8:518 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:519 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:520 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:522 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:523 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:525 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:526 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:527 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:529 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_54_afterif -+ - ; source: test_uword_equalities.p8:530 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_uword_equalities.p8:533 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_56_else -+ - ; source: test_uword_equalities.p8:534 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_equalities.p8:536 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_uword_equalities.p8:539 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne p8l_lbl3a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - bne p8l_lbl3a - ; source: test_uword_equalities.p8:541 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:542 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:543 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:545 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:546 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:548 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:549 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:550 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:552 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_57_afterif -+ - ; source: test_uword_equalities.p8:553 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_uword_equalities.p8:556 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_59_else -+ - ; source: test_uword_equalities.p8:557 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_equalities.p8:559 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_uword_equalities.p8:561 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:563 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne p8l_lbl4a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - bne p8l_lbl4a - ; source: test_uword_equalities.p8:565 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:566 lbl4a: fail_uword(37,1) -p8l_lbl4a - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:567 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:569 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:570 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:572 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:573 lbl4b: fail_uword(38,1) -p8l_lbl4b - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:574 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:576 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_60_afterif -+ - ; source: test_uword_equalities.p8:577 fail_uword(39,1) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_60_afterif - ; source: test_uword_equalities.p8:580 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_62_else -+ - ; source: test_uword_equalities.p8:581 fail_uword(40,1) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_equalities.p8:583 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_uword_equalities.p8:586 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl5a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl5a - ; source: test_uword_equalities.p8:588 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:589 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:590 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:592 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:593 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:595 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:596 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:597 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:599 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_63_afterif -+ - ; source: test_uword_equalities.p8:600 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_uword_equalities.p8:603 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_65_else -+ - ; source: test_uword_equalities.p8:604 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_equalities.p8:606 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_uword_equalities.p8:609 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne p8l_lbl6a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - bne p8l_lbl6a - ; source: test_uword_equalities.p8:611 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:612 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:613 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:615 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:616 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:618 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:619 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:620 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:622 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_66_afterif -+ - ; source: test_uword_equalities.p8:623 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_uword_equalities.p8:626 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_68_else -+ - ; source: test_uword_equalities.p8:627 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_equalities.p8:629 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_uword_equalities.p8:631 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:633 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne p8l_lbl7a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - bne p8l_lbl7a - ; source: test_uword_equalities.p8:635 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:636 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:637 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:639 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:640 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:642 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:643 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:644 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:646 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_69_afterif -+ - ; source: test_uword_equalities.p8:647 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_uword_equalities.p8:650 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_71_else -+ - ; source: test_uword_equalities.p8:651 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_equalities.p8:653 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_uword_equalities.p8:656 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl8a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl8a - ; source: test_uword_equalities.p8:658 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:659 lbl8a: fail_uword(41,30464) -p8l_lbl8a - lda #<$29 - ldy #>$29 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:660 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:662 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:663 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:665 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:666 lbl8b: fail_uword(42,30464) -p8l_lbl8b - lda #<$2a - ldy #>$2a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:667 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:669 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_72_afterif -+ - ; source: test_uword_equalities.p8:670 fail_uword(43,30464) - lda #<$2b - ldy #>$2b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_72_afterif - ; source: test_uword_equalities.p8:673 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_74_else -+ - ; source: test_uword_equalities.p8:674 fail_uword(44,30464) - lda #<$2c - ldy #>$2c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_equalities.p8:676 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_uword_equalities.p8:679 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne p8l_lbl9a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - bne p8l_lbl9a - ; source: test_uword_equalities.p8:681 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:682 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:683 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:685 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:686 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:688 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:689 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:690 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:692 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_75_afterif -+ - ; source: test_uword_equalities.p8:693 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_uword_equalities.p8:696 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_77_else -+ - ; source: test_uword_equalities.p8:697 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_equalities.p8:699 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_uword_equalities.p8:701 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:703 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne p8l_lbl10a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - bne p8l_lbl10a - ; source: test_uword_equalities.p8:705 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:706 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:707 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:709 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:710 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:712 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:713 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:714 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:716 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_78_afterif -+ - ; source: test_uword_equalities.p8:717 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_uword_equalities.p8:720 if x!=1 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<1 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>1 - beq label_asm_80_else -+ - ; source: test_uword_equalities.p8:721 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_equalities.p8:723 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_uword_equalities.p8:726 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl11a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl11a - ; source: test_uword_equalities.p8:728 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:729 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:730 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:732 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:733 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:735 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:736 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:737 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:739 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_81_afterif -+ - ; source: test_uword_equalities.p8:740 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_uword_equalities.p8:743 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_83_else -+ - ; source: test_uword_equalities.p8:744 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_equalities.p8:746 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_uword_equalities.p8:749 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne p8l_lbl12a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - bne p8l_lbl12a - ; source: test_uword_equalities.p8:751 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:752 lbl12a: fail_uword(45,65535) -p8l_lbl12a - lda #<$2d - ldy #>$2d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:753 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:755 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:756 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:758 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:759 lbl12b: fail_uword(46,65535) -p8l_lbl12b - lda #<$2e - ldy #>$2e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:760 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:762 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_84_afterif -+ - ; source: test_uword_equalities.p8:763 fail_uword(47,65535) - lda #<$2f - ldy #>$2f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_84_afterif - ; source: test_uword_equalities.p8:766 if x!=65535 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<65535 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>65535 - beq label_asm_86_else -+ - ; source: test_uword_equalities.p8:767 fail_uword(48,65535) - lda #<$30 - ldy #>$30 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_equalities.p8:769 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_uword_equalities.p8:771 verify_success(36) - lda #$24 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:488 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:773 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_uword_equalities.p8:774 uword @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_uword_equalities.p8:775 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:776 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:777 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:779 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl1a -+ - ; source: test_uword_equalities.p8:781 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:782 lbl1a: fail_uword(49,0) -p8l_lbl1a - lda #<$31 - ldy #>$31 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:783 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:785 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:786 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:788 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:789 lbl1b: fail_uword(50,0) -p8l_lbl1b - lda #<$32 - ldy #>$32 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:790 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:792 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_87_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_87_afterif - ; source: test_uword_equalities.p8:793 fail_uword(51,0) - lda #<$33 - ldy #>$33 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_87_afterif - ; source: test_uword_equalities.p8:796 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_89_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_89_else - ; source: test_uword_equalities.p8:797 fail_uword(52,0) - lda #<$34 - ldy #>$34 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_equalities.p8:799 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_uword_equalities.p8:801 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:803 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl2a -+ - ; source: test_uword_equalities.p8:805 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:806 lbl2a: fail_uword(53,0) -p8l_lbl2a - lda #<$35 - ldy #>$35 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:807 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:809 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:810 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:812 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:813 lbl2b: fail_uword(54,0) -p8l_lbl2b - lda #<$36 - ldy #>$36 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:814 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:816 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_90_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_90_afterif - ; source: test_uword_equalities.p8:817 fail_uword(55,0) - lda #<$37 - ldy #>$37 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_90_afterif - ; source: test_uword_equalities.p8:820 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_92_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_92_else - ; source: test_uword_equalities.p8:821 fail_uword(56,0) - lda #<$38 - ldy #>$38 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_equalities.p8:823 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_uword_equalities.p8:825 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:827 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl3a -+ - ; source: test_uword_equalities.p8:829 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:830 lbl3a: fail_uword(57,0) -p8l_lbl3a - lda #<$39 - ldy #>$39 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:831 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:833 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:834 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:836 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:837 lbl3b: fail_uword(58,0) -p8l_lbl3b - lda #<$3a - ldy #>$3a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:838 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:840 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_93_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_93_afterif - ; source: test_uword_equalities.p8:841 fail_uword(59,0) - lda #<$3b - ldy #>$3b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_93_afterif - ; source: test_uword_equalities.p8:844 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_95_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_95_else - ; source: test_uword_equalities.p8:845 fail_uword(60,0) - lda #<$3c - ldy #>$3c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_equalities.p8:847 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_uword_equalities.p8:849 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:850 value=1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:852 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl4a -+ - ; source: test_uword_equalities.p8:854 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:855 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:856 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:858 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:859 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:861 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:862 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:863 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:865 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_96_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_96_afterif - ; source: test_uword_equalities.p8:866 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_uword_equalities.p8:869 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_98_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_98_else - ; source: test_uword_equalities.p8:870 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_equalities.p8:872 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_uword_equalities.p8:874 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:876 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl5a -+ - ; source: test_uword_equalities.p8:878 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:879 lbl5a: fail_uword(61,1) -p8l_lbl5a - lda #<$3d - ldy #>$3d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:880 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:882 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:883 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:885 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:886 lbl5b: fail_uword(62,1) -p8l_lbl5b - lda #<$3e - ldy #>$3e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:887 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:889 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_99_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_99_afterif - ; source: test_uword_equalities.p8:890 fail_uword(63,1) - lda #<$3f - ldy #>$3f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_99_afterif - ; source: test_uword_equalities.p8:893 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_101_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_101_else - ; source: test_uword_equalities.p8:894 fail_uword(64,1) - lda #<$40 - ldy #>$40 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_100_afterif -label_asm_101_else - ; source: test_uword_equalities.p8:896 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_uword_equalities.p8:898 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:900 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl6a -+ - ; source: test_uword_equalities.p8:902 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:903 lbl6a: fail_uword(65,1) -p8l_lbl6a - lda #<$41 - ldy #>$41 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:904 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:906 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:907 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:909 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:910 lbl6b: fail_uword(66,1) -p8l_lbl6b - lda #<$42 - ldy #>$42 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:911 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:913 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_102_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_102_afterif - ; source: test_uword_equalities.p8:914 fail_uword(67,1) - lda #<$43 - ldy #>$43 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_102_afterif - ; source: test_uword_equalities.p8:917 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_104_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_104_else - ; source: test_uword_equalities.p8:918 fail_uword(68,1) - lda #<$44 - ldy #>$44 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_103_afterif -label_asm_104_else - ; source: test_uword_equalities.p8:920 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_uword_equalities.p8:922 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:923 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:925 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl7a -+ - ; source: test_uword_equalities.p8:927 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:928 lbl7a: fail_uword(69,30464) -p8l_lbl7a - lda #<$45 - ldy #>$45 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:929 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:931 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:932 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:934 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:935 lbl7b: fail_uword(70,30464) -p8l_lbl7b - lda #<$46 - ldy #>$46 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:936 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:938 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_105_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_105_afterif - ; source: test_uword_equalities.p8:939 fail_uword(71,30464) - lda #<$47 - ldy #>$47 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_105_afterif - ; source: test_uword_equalities.p8:942 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_107_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_107_else - ; source: test_uword_equalities.p8:943 fail_uword(72,30464) - lda #<$48 - ldy #>$48 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_106_afterif -label_asm_107_else - ; source: test_uword_equalities.p8:945 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_uword_equalities.p8:947 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:949 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl8a -+ - ; source: test_uword_equalities.p8:951 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:952 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:953 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:955 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:956 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:958 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:959 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:960 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:962 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_108_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_108_afterif - ; source: test_uword_equalities.p8:963 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_uword_equalities.p8:966 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_110_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_110_else - ; source: test_uword_equalities.p8:967 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_uword_equalities.p8:969 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_uword_equalities.p8:971 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:973 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl9a -+ - ; source: test_uword_equalities.p8:975 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:976 lbl9a: fail_uword(73,30464) -p8l_lbl9a - lda #<$49 - ldy #>$49 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:977 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:979 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:980 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:982 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:983 lbl9b: fail_uword(74,30464) -p8l_lbl9b - lda #<$4a - ldy #>$4a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:984 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:986 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_111_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_111_afterif - ; source: test_uword_equalities.p8:987 fail_uword(75,30464) - lda #<$4b - ldy #>$4b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_111_afterif - ; source: test_uword_equalities.p8:990 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_113_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_113_else - ; source: test_uword_equalities.p8:991 fail_uword(76,30464) - lda #<$4c - ldy #>$4c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_112_afterif -label_asm_113_else - ; source: test_uword_equalities.p8:993 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_uword_equalities.p8:995 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:996 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:998 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl10a -+ - ; source: test_uword_equalities.p8:1000 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:1001 lbl10a: fail_uword(77,65535) -p8l_lbl10a - lda #<$4d - ldy #>$4d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1002 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:1004 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1005 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1007 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:1008 lbl10b: fail_uword(78,65535) -p8l_lbl10b - lda #<$4e - ldy #>$4e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1009 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:1011 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_114_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_114_afterif - ; source: test_uword_equalities.p8:1012 fail_uword(79,65535) - lda #<$4f - ldy #>$4f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_114_afterif - ; source: test_uword_equalities.p8:1015 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_116_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_116_else - ; source: test_uword_equalities.p8:1016 fail_uword(80,65535) - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_115_afterif -label_asm_116_else - ; source: test_uword_equalities.p8:1018 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_uword_equalities.p8:1020 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1022 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl11a -+ - ; source: test_uword_equalities.p8:1024 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:1025 lbl11a: fail_uword(81,65535) -p8l_lbl11a - lda #<$51 - ldy #>$51 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1026 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:1028 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1029 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1031 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:1032 lbl11b: fail_uword(82,65535) -p8l_lbl11b - lda #<$52 - ldy #>$52 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1033 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:1035 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_117_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_117_afterif - ; source: test_uword_equalities.p8:1036 fail_uword(83,65535) - lda #<$53 - ldy #>$53 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_117_afterif - ; source: test_uword_equalities.p8:1039 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_119_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_119_else - ; source: test_uword_equalities.p8:1040 fail_uword(84,65535) - lda #<$54 - ldy #>$54 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_118_afterif -label_asm_119_else - ; source: test_uword_equalities.p8:1042 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_uword_equalities.p8:1044 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:1046 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl12a -+ - ; source: test_uword_equalities.p8:1048 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:1049 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1050 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:1052 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1053 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1055 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:1056 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1057 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:1059 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_120_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_120_afterif - ; source: test_uword_equalities.p8:1060 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_uword_equalities.p8:1063 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_122_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_122_else - ; source: test_uword_equalities.p8:1064 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_uword_equalities.p8:1066 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_uword_equalities.p8:1068 verify_success(12) - lda #12 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:773 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .word ? -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:1070 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_uword_equalities.p8:1071 uword @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_uword_equalities.p8:1072 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:1073 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1074 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1076 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl1a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl1a - ; source: test_uword_equalities.p8:1078 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:1079 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1080 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:1082 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1083 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1085 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:1086 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1087 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:1089 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_123_afterif -+ - ; source: test_uword_equalities.p8:1090 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_uword_equalities.p8:1093 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_125_else -+ - ; source: test_uword_equalities.p8:1094 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_uword_equalities.p8:1096 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_uword_equalities.p8:1098 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1100 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl2a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl2a - ; source: test_uword_equalities.p8:1102 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:1103 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1104 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:1106 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1107 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1109 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:1110 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1111 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:1113 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_126_afterif -+ - ; source: test_uword_equalities.p8:1114 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_uword_equalities.p8:1117 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_128_else -+ - ; source: test_uword_equalities.p8:1118 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_uword_equalities.p8:1120 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_uword_equalities.p8:1122 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:1124 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl3a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl3a - ; source: test_uword_equalities.p8:1126 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:1127 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1128 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:1130 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1131 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1133 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:1134 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1135 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:1137 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_129_afterif -+ - ; source: test_uword_equalities.p8:1138 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_uword_equalities.p8:1141 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_131_else -+ - ; source: test_uword_equalities.p8:1142 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_uword_equalities.p8:1144 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_uword_equalities.p8:1146 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:1147 value=1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1149 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl4a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl4a - ; source: test_uword_equalities.p8:1151 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:1152 lbl4a: fail_uword(85,1) -p8l_lbl4a - lda #<$55 - ldy #>$55 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1153 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:1155 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1156 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1158 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:1159 lbl4b: fail_uword(86,1) -p8l_lbl4b - lda #<$56 - ldy #>$56 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1160 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:1162 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_132_afterif -+ - ; source: test_uword_equalities.p8:1163 fail_uword(87,1) - lda #<$57 - ldy #>$57 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_132_afterif - ; source: test_uword_equalities.p8:1166 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_134_else -+ - ; source: test_uword_equalities.p8:1167 fail_uword(88,1) - lda #<$58 - ldy #>$58 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_133_afterif -label_asm_134_else - ; source: test_uword_equalities.p8:1169 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_uword_equalities.p8:1171 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1173 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl5a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl5a - ; source: test_uword_equalities.p8:1175 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:1176 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1177 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:1179 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1180 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1182 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:1183 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1184 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:1186 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_135_afterif -+ - ; source: test_uword_equalities.p8:1187 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_uword_equalities.p8:1190 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_137_else -+ - ; source: test_uword_equalities.p8:1191 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_uword_equalities.p8:1193 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_uword_equalities.p8:1195 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:1197 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl6a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl6a - ; source: test_uword_equalities.p8:1199 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:1200 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1201 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:1203 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1204 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1206 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:1207 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1208 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:1210 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_138_afterif -+ - ; source: test_uword_equalities.p8:1211 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_uword_equalities.p8:1214 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_140_else -+ - ; source: test_uword_equalities.p8:1215 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_uword_equalities.p8:1217 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_uword_equalities.p8:1219 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:1220 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1222 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl7a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl7a - ; source: test_uword_equalities.p8:1224 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:1225 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1226 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:1228 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1229 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1231 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:1232 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1233 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:1235 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_141_afterif -+ - ; source: test_uword_equalities.p8:1236 success++ - inc p8b_main.p8v_success -label_asm_141_afterif - ; source: test_uword_equalities.p8:1239 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_143_else -+ - ; source: test_uword_equalities.p8:1240 success++ - inc p8b_main.p8v_success - bra label_asm_142_afterif -label_asm_143_else - ; source: test_uword_equalities.p8:1242 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_uword_equalities.p8:1244 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1246 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl8a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl8a - ; source: test_uword_equalities.p8:1248 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:1249 lbl8a: fail_uword(89,30464) -p8l_lbl8a - lda #<$59 - ldy #>$59 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1250 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:1252 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1253 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1255 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:1256 lbl8b: fail_uword(90,30464) -p8l_lbl8b - lda #<$5a - ldy #>$5a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1257 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:1259 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_144_afterif -+ - ; source: test_uword_equalities.p8:1260 fail_uword(91,30464) - lda #<$5b - ldy #>$5b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_144_afterif - ; source: test_uword_equalities.p8:1263 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_146_else -+ - ; source: test_uword_equalities.p8:1264 fail_uword(92,30464) - lda #<$5c - ldy #>$5c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_145_afterif -label_asm_146_else - ; source: test_uword_equalities.p8:1266 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_uword_equalities.p8:1268 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:1270 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl9a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl9a - ; source: test_uword_equalities.p8:1272 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:1273 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1274 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:1276 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1277 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1279 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:1280 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1281 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:1283 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_147_afterif -+ - ; source: test_uword_equalities.p8:1284 success++ - inc p8b_main.p8v_success -label_asm_147_afterif - ; source: test_uword_equalities.p8:1287 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_149_else -+ - ; source: test_uword_equalities.p8:1288 success++ - inc p8b_main.p8v_success - bra label_asm_148_afterif -label_asm_149_else - ; source: test_uword_equalities.p8:1290 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_uword_equalities.p8:1292 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:1293 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1295 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl10a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl10a - ; source: test_uword_equalities.p8:1297 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:1298 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1299 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:1301 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1302 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1304 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:1305 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1306 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:1308 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_150_afterif -+ - ; source: test_uword_equalities.p8:1309 success++ - inc p8b_main.p8v_success -label_asm_150_afterif - ; source: test_uword_equalities.p8:1312 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_152_else -+ - ; source: test_uword_equalities.p8:1313 success++ - inc p8b_main.p8v_success - bra label_asm_151_afterif -label_asm_152_else - ; source: test_uword_equalities.p8:1315 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_uword_equalities.p8:1317 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_equalities.p8:1319 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl11a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl11a - ; source: test_uword_equalities.p8:1321 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:1322 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1323 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:1325 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1326 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1328 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:1329 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1330 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:1332 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_153_afterif -+ - ; source: test_uword_equalities.p8:1333 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_uword_equalities.p8:1336 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_155_else -+ - ; source: test_uword_equalities.p8:1337 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_uword_equalities.p8:1339 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_uword_equalities.p8:1341 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_equalities.p8:1343 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl12a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl12a - ; source: test_uword_equalities.p8:1345 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:1346 lbl12a: fail_uword(93,65535) -p8l_lbl12a - lda #<$5d - ldy #>$5d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1347 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:1349 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1350 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1352 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:1353 lbl12b: fail_uword(94,65535) -p8l_lbl12b - lda #<$5e - ldy #>$5e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1354 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:1356 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_156_afterif -+ - ; source: test_uword_equalities.p8:1357 fail_uword(95,65535) - lda #<$5f - ldy #>$5f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_156_afterif - ; source: test_uword_equalities.p8:1360 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_158_else -+ - ; source: test_uword_equalities.p8:1361 fail_uword(96,65535) - lda #<$60 - ldy #>$60 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_157_afterif -label_asm_158_else - ; source: test_uword_equalities.p8:1363 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_uword_equalities.p8:1365 verify_success(36) - lda #$24 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:1070 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .word ? -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:1367 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_uword_equalities.p8:1368 uword @shared x - ; source: test_uword_equalities.p8:1371 float @shared f4 = 1.0 - ; source: test_uword_equalities.p8:1372 float @shared f5 = 1.0 - ; source: test_uword_equalities.p8:1368 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1369 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_equalities.p8:1370 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_equalities.p8:1371 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_uword_equalities.p8:1372 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_uword_equalities.p8:1373 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:1374 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1376 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl1a -+ - ; source: test_uword_equalities.p8:1378 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:1379 lbl1a: fail_uword(97,0) -p8l_lbl1a - lda #<$61 - ldy #>$61 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1380 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:1382 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1383 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1385 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:1386 lbl1b: fail_uword(98,0) -p8l_lbl1b - lda #<$62 - ldy #>$62 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1387 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:1389 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_159_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_159_afterif - ; source: test_uword_equalities.p8:1390 fail_uword(99,0) - lda #<$63 - ldy #>$63 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_159_afterif - ; source: test_uword_equalities.p8:1393 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_161_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_161_else - ; source: test_uword_equalities.p8:1394 fail_uword(100,0) - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_160_afterif -label_asm_161_else - ; source: test_uword_equalities.p8:1396 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_uword_equalities.p8:1399 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl2a -+ - ; source: test_uword_equalities.p8:1401 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:1402 lbl2a: fail_uword(101,0) -p8l_lbl2a - lda #<$65 - ldy #>$65 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1403 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:1405 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1406 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1408 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:1409 lbl2b: fail_uword(102,0) -p8l_lbl2b - lda #<$66 - ldy #>$66 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1410 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:1412 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_162_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_162_afterif - ; source: test_uword_equalities.p8:1413 fail_uword(103,0) - lda #<$67 - ldy #>$67 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_162_afterif - ; source: test_uword_equalities.p8:1416 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_164_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_164_else - ; source: test_uword_equalities.p8:1417 fail_uword(104,0) - lda #<$68 - ldy #>$68 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_163_afterif -label_asm_164_else - ; source: test_uword_equalities.p8:1419 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_uword_equalities.p8:1422 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl3a -+ - ; source: test_uword_equalities.p8:1424 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:1425 lbl3a: fail_uword(105,0) -p8l_lbl3a - lda #<$69 - ldy #>$69 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1426 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:1428 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1429 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1431 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:1432 lbl3b: fail_uword(106,0) -p8l_lbl3b - lda #<$6a - ldy #>$6a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1433 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:1435 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_165_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_165_afterif - ; source: test_uword_equalities.p8:1436 fail_uword(107,0) - lda #<$6b - ldy #>$6b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_165_afterif - ; source: test_uword_equalities.p8:1439 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_167_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_167_else - ; source: test_uword_equalities.p8:1440 fail_uword(108,0) - lda #<$6c - ldy #>$6c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_166_afterif -label_asm_167_else - ; source: test_uword_equalities.p8:1442 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_uword_equalities.p8:1444 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:1446 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl4a -+ - ; source: test_uword_equalities.p8:1448 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:1449 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1450 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:1452 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1453 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1455 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:1456 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1457 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:1459 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_168_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_168_afterif - ; source: test_uword_equalities.p8:1460 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_uword_equalities.p8:1463 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_170_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_170_else - ; source: test_uword_equalities.p8:1464 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_uword_equalities.p8:1466 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_uword_equalities.p8:1469 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl5a -+ - ; source: test_uword_equalities.p8:1471 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:1472 lbl5a: fail_uword(109,1) -p8l_lbl5a - lda #<$6d - ldy #>$6d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1473 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:1475 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1476 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1478 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:1479 lbl5b: fail_uword(110,1) -p8l_lbl5b - lda #<$6e - ldy #>$6e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1480 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:1482 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_171_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_171_afterif - ; source: test_uword_equalities.p8:1483 fail_uword(111,1) - lda #<$6f - ldy #>$6f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_171_afterif - ; source: test_uword_equalities.p8:1486 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_173_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_173_else - ; source: test_uword_equalities.p8:1487 fail_uword(112,1) - lda #<$70 - ldy #>$70 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_172_afterif -label_asm_173_else - ; source: test_uword_equalities.p8:1489 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_uword_equalities.p8:1492 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl6a -+ - ; source: test_uword_equalities.p8:1494 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:1495 lbl6a: fail_uword(113,1) -p8l_lbl6a - lda #<$71 - ldy #>$71 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1496 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:1498 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1499 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1501 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:1502 lbl6b: fail_uword(114,1) -p8l_lbl6b - lda #<$72 - ldy #>$72 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1503 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:1505 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_174_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_174_afterif - ; source: test_uword_equalities.p8:1506 fail_uword(115,1) - lda #<$73 - ldy #>$73 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_174_afterif - ; source: test_uword_equalities.p8:1509 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_176_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_176_else - ; source: test_uword_equalities.p8:1510 fail_uword(116,1) - lda #<$74 - ldy #>$74 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_175_afterif -label_asm_176_else - ; source: test_uword_equalities.p8:1512 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_uword_equalities.p8:1514 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:1516 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl7a -+ - ; source: test_uword_equalities.p8:1518 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:1519 lbl7a: fail_uword(117,30464) -p8l_lbl7a - lda #<$75 - ldy #>$75 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1520 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:1522 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1523 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1525 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:1526 lbl7b: fail_uword(118,30464) -p8l_lbl7b - lda #<$76 - ldy #>$76 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1527 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:1529 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_177_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_177_afterif - ; source: test_uword_equalities.p8:1530 fail_uword(119,30464) - lda #<$77 - ldy #>$77 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_177_afterif - ; source: test_uword_equalities.p8:1533 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_179_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_179_else - ; source: test_uword_equalities.p8:1534 fail_uword(120,30464) - lda #<$78 - ldy #>$78 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_178_afterif -label_asm_179_else - ; source: test_uword_equalities.p8:1536 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_uword_equalities.p8:1539 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl8a -+ - ; source: test_uword_equalities.p8:1541 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:1542 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1543 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:1545 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1546 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1548 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:1549 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1550 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:1552 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_180_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_180_afterif - ; source: test_uword_equalities.p8:1553 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_uword_equalities.p8:1556 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_182_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_182_else - ; source: test_uword_equalities.p8:1557 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_uword_equalities.p8:1559 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_uword_equalities.p8:1562 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl9a -+ - ; source: test_uword_equalities.p8:1564 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:1565 lbl9a: fail_uword(121,30464) -p8l_lbl9a - lda #<$79 - ldy #>$79 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1566 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:1568 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1569 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1571 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:1572 lbl9b: fail_uword(122,30464) -p8l_lbl9b - lda #<$7a - ldy #>$7a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1573 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:1575 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_183_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_183_afterif - ; source: test_uword_equalities.p8:1576 fail_uword(123,30464) - lda #<$7b - ldy #>$7b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_183_afterif - ; source: test_uword_equalities.p8:1579 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_185_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_185_else - ; source: test_uword_equalities.p8:1580 fail_uword(124,30464) - lda #<$7c - ldy #>$7c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_184_afterif -label_asm_185_else - ; source: test_uword_equalities.p8:1582 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_uword_equalities.p8:1584 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:1586 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl10a -+ - ; source: test_uword_equalities.p8:1588 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:1589 lbl10a: fail_uword(125,65535) -p8l_lbl10a - lda #<$7d - ldy #>$7d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1590 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:1592 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1593 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1595 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:1596 lbl10b: fail_uword(126,65535) -p8l_lbl10b - lda #<$7e - ldy #>$7e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1597 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:1599 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_186_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_186_afterif - ; source: test_uword_equalities.p8:1600 fail_uword(127,65535) - lda #<$7f - ldy #>$7f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_186_afterif - ; source: test_uword_equalities.p8:1603 if x==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_188_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_188_else - ; source: test_uword_equalities.p8:1604 fail_uword(128,65535) - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_187_afterif -label_asm_188_else - ; source: test_uword_equalities.p8:1606 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_uword_equalities.p8:1609 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl11a -+ - ; source: test_uword_equalities.p8:1611 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:1612 lbl11a: fail_uword(129,65535) -p8l_lbl11a - lda #<$81 - ldy #>$81 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1613 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:1615 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1616 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1618 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:1619 lbl11b: fail_uword(130,65535) -p8l_lbl11b - lda #<$82 - ldy #>$82 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1620 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:1622 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_189_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_189_afterif - ; source: test_uword_equalities.p8:1623 fail_uword(131,65535) - lda #<$83 - ldy #>$83 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_189_afterif - ; source: test_uword_equalities.p8:1626 if x==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_191_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_191_else - ; source: test_uword_equalities.p8:1627 fail_uword(132,65535) - lda #<$84 - ldy #>$84 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_190_afterif -label_asm_191_else - ; source: test_uword_equalities.p8:1629 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_uword_equalities.p8:1632 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl12a -+ - ; source: test_uword_equalities.p8:1634 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:1635 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1636 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:1638 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1639 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1641 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:1642 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1643 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:1645 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_192_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_192_afterif - ; source: test_uword_equalities.p8:1646 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_uword_equalities.p8:1649 if x==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_194_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_194_else - ; source: test_uword_equalities.p8:1650 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_uword_equalities.p8:1652 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_uword_equalities.p8:1654 verify_success(12) - lda #12 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:1367 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:1656 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_uword_equalities.p8:1657 uword @shared x - ; source: test_uword_equalities.p8:1660 float @shared f4 = 1.0 - ; source: test_uword_equalities.p8:1661 float @shared f5 = 1.0 - ; source: test_uword_equalities.p8:1657 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1658 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_equalities.p8:1659 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_equalities.p8:1660 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_uword_equalities.p8:1661 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_uword_equalities.p8:1662 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:1663 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1665 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl1a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl1a - ; source: test_uword_equalities.p8:1667 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:1668 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1669 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:1671 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1672 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1674 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:1675 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1676 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:1678 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_195_afterif -+ - ; source: test_uword_equalities.p8:1679 success++ - inc p8b_main.p8v_success -label_asm_195_afterif - ; source: test_uword_equalities.p8:1682 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_197_else -+ - ; source: test_uword_equalities.p8:1683 success++ - inc p8b_main.p8v_success - bra label_asm_196_afterif -label_asm_197_else - ; source: test_uword_equalities.p8:1685 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_uword_equalities.p8:1688 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl2a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl2a - ; source: test_uword_equalities.p8:1690 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:1691 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1692 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:1694 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1695 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1697 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:1698 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1699 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:1701 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_198_afterif -+ - ; source: test_uword_equalities.p8:1702 success++ - inc p8b_main.p8v_success -label_asm_198_afterif - ; source: test_uword_equalities.p8:1705 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_200_else -+ - ; source: test_uword_equalities.p8:1706 success++ - inc p8b_main.p8v_success - bra label_asm_199_afterif -label_asm_200_else - ; source: test_uword_equalities.p8:1708 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_uword_equalities.p8:1711 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl3a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl3a - ; source: test_uword_equalities.p8:1713 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:1714 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1715 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:1717 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1718 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1720 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:1721 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1722 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:1724 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_201_afterif -+ - ; source: test_uword_equalities.p8:1725 success++ - inc p8b_main.p8v_success -label_asm_201_afterif - ; source: test_uword_equalities.p8:1728 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_203_else -+ - ; source: test_uword_equalities.p8:1729 success++ - inc p8b_main.p8v_success - bra label_asm_202_afterif -label_asm_203_else - ; source: test_uword_equalities.p8:1731 cx16.r0L++ - inc cx16.r0L -label_asm_202_afterif - ; source: test_uword_equalities.p8:1733 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:1735 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl4a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl4a - ; source: test_uword_equalities.p8:1737 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:1738 lbl4a: fail_uword(133,1) -p8l_lbl4a - lda #<$85 - ldy #>$85 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1739 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:1741 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1742 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1744 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:1745 lbl4b: fail_uword(134,1) -p8l_lbl4b - lda #<$86 - ldy #>$86 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1746 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:1748 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_204_afterif -+ - ; source: test_uword_equalities.p8:1749 fail_uword(135,1) - lda #<$87 - ldy #>$87 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_204_afterif - ; source: test_uword_equalities.p8:1752 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_206_else -+ - ; source: test_uword_equalities.p8:1753 fail_uword(136,1) - lda #<$88 - ldy #>$88 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_205_afterif -label_asm_206_else - ; source: test_uword_equalities.p8:1755 cx16.r0L++ - inc cx16.r0L -label_asm_205_afterif - ; source: test_uword_equalities.p8:1758 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl5a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl5a - ; source: test_uword_equalities.p8:1760 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:1761 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1762 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:1764 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1765 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1767 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:1768 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1769 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:1771 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_207_afterif -+ - ; source: test_uword_equalities.p8:1772 success++ - inc p8b_main.p8v_success -label_asm_207_afterif - ; source: test_uword_equalities.p8:1775 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_209_else -+ - ; source: test_uword_equalities.p8:1776 success++ - inc p8b_main.p8v_success - bra label_asm_208_afterif -label_asm_209_else - ; source: test_uword_equalities.p8:1778 cx16.r0L++ - inc cx16.r0L -label_asm_208_afterif - ; source: test_uword_equalities.p8:1781 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl6a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl6a - ; source: test_uword_equalities.p8:1783 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:1784 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1785 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:1787 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1788 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1790 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:1791 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1792 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:1794 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_210_afterif -+ - ; source: test_uword_equalities.p8:1795 success++ - inc p8b_main.p8v_success -label_asm_210_afterif - ; source: test_uword_equalities.p8:1798 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_212_else -+ - ; source: test_uword_equalities.p8:1799 success++ - inc p8b_main.p8v_success - bra label_asm_211_afterif -label_asm_212_else - ; source: test_uword_equalities.p8:1801 cx16.r0L++ - inc cx16.r0L -label_asm_211_afterif - ; source: test_uword_equalities.p8:1803 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:1805 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl7a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl7a - ; source: test_uword_equalities.p8:1807 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:1808 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1809 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:1811 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1812 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1814 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:1815 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1816 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:1818 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_213_afterif -+ - ; source: test_uword_equalities.p8:1819 success++ - inc p8b_main.p8v_success -label_asm_213_afterif - ; source: test_uword_equalities.p8:1822 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_215_else -+ - ; source: test_uword_equalities.p8:1823 success++ - inc p8b_main.p8v_success - bra label_asm_214_afterif -label_asm_215_else - ; source: test_uword_equalities.p8:1825 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_uword_equalities.p8:1828 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl8a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl8a - ; source: test_uword_equalities.p8:1830 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:1831 lbl8a: fail_uword(137,30464) -p8l_lbl8a - lda #<$89 - ldy #>$89 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1832 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:1834 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1835 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1837 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:1838 lbl8b: fail_uword(138,30464) -p8l_lbl8b - lda #<$8a - ldy #>$8a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1839 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:1841 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_216_afterif -+ - ; source: test_uword_equalities.p8:1842 fail_uword(139,30464) - lda #<$8b - ldy #>$8b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_216_afterif - ; source: test_uword_equalities.p8:1845 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_218_else -+ - ; source: test_uword_equalities.p8:1846 fail_uword(140,30464) - lda #<$8c - ldy #>$8c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_217_afterif -label_asm_218_else - ; source: test_uword_equalities.p8:1848 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_uword_equalities.p8:1851 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl9a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl9a - ; source: test_uword_equalities.p8:1853 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:1854 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1855 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:1857 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1858 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1860 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:1861 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1862 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:1864 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_219_afterif -+ - ; source: test_uword_equalities.p8:1865 success++ - inc p8b_main.p8v_success -label_asm_219_afterif - ; source: test_uword_equalities.p8:1868 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_221_else -+ - ; source: test_uword_equalities.p8:1869 success++ - inc p8b_main.p8v_success - bra label_asm_220_afterif -label_asm_221_else - ; source: test_uword_equalities.p8:1871 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_uword_equalities.p8:1873 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:1875 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl10a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl10a - ; source: test_uword_equalities.p8:1877 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:1878 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1879 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:1881 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1882 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1884 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:1885 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1886 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:1888 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_222_afterif -+ - ; source: test_uword_equalities.p8:1889 success++ - inc p8b_main.p8v_success -label_asm_222_afterif - ; source: test_uword_equalities.p8:1892 if x!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_224_else -+ - ; source: test_uword_equalities.p8:1893 success++ - inc p8b_main.p8v_success - bra label_asm_223_afterif -label_asm_224_else - ; source: test_uword_equalities.p8:1895 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_uword_equalities.p8:1898 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl11a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl11a - ; source: test_uword_equalities.p8:1900 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:1901 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1902 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:1904 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1905 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1907 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:1908 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:1909 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:1911 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_225_afterif -+ - ; source: test_uword_equalities.p8:1912 success++ - inc p8b_main.p8v_success -label_asm_225_afterif - ; source: test_uword_equalities.p8:1915 if x!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_227_else -+ - ; source: test_uword_equalities.p8:1916 success++ - inc p8b_main.p8v_success - bra label_asm_226_afterif -label_asm_227_else - ; source: test_uword_equalities.p8:1918 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_uword_equalities.p8:1921 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl12a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl12a - ; source: test_uword_equalities.p8:1923 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:1924 lbl12a: fail_uword(141,65535) -p8l_lbl12a - lda #<$8d - ldy #>$8d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1925 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:1927 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1928 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1930 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:1931 lbl12b: fail_uword(142,65535) -p8l_lbl12b - lda #<$8e - ldy #>$8e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1932 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:1934 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_228_afterif -+ - ; source: test_uword_equalities.p8:1935 fail_uword(143,65535) - lda #<$8f - ldy #>$8f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_228_afterif - ; source: test_uword_equalities.p8:1938 if x!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_230_else -+ - ; source: test_uword_equalities.p8:1939 fail_uword(144,65535) - lda #<$90 - ldy #>$90 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_229_afterif -label_asm_230_else - ; source: test_uword_equalities.p8:1941 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_uword_equalities.p8:1943 verify_success(36) - lda #$24 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:1656 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_equalities.p8:1945 sub test_is_array() { - -p8s_test_is_array .proc -; statements - ; source: test_uword_equalities.p8:1946 uword @shared x - ; source: test_uword_equalities.p8:1947 uword[] values = [0, 0] - ; source: test_uword_equalities.p8:1948 uword[] sources = [0, 0] - ; source: test_uword_equalities.p8:1946 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1949 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:1950 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:1951 sources[1]=0 - ldy #2 - lda #0 - sta p8v_sources,y - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:1952 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:1954 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl1a -+ - ; source: test_uword_equalities.p8:1956 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:1957 lbl1a: fail_uword(145,0) -p8l_lbl1a - lda #<$91 - ldy #>$91 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1958 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:1960 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1961 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1963 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:1964 lbl1b: fail_uword(146,0) -p8l_lbl1b - lda #<$92 - ldy #>$92 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1965 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:1967 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_231_afterif - cpy p8v_values+2+1 - bne label_asm_231_afterif - ; source: test_uword_equalities.p8:1968 fail_uword(147,0) - lda #<$93 - ldy #>$93 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_231_afterif - ; source: test_uword_equalities.p8:1971 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_233_else - cpy p8v_values+2+1 - bne label_asm_233_else - ; source: test_uword_equalities.p8:1972 fail_uword(148,0) - lda #<$94 - ldy #>$94 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_232_afterif -label_asm_233_else - ; source: test_uword_equalities.p8:1974 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_uword_equalities.p8:1977 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl1c -+ - ; source: test_uword_equalities.p8:1979 goto skip1c - bra p8l_skip1c - ; source: test_uword_equalities.p8:1980 lbl1c: fail_uword(149,0) -p8l_lbl1c - lda #<$95 - ldy #>$95 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1981 skip1c: -p8l_skip1c - ; source: test_uword_equalities.p8:1983 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:1984 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:1986 goto skip1d - bra p8l_skip1d - ; source: test_uword_equalities.p8:1987 lbl1d: fail_uword(150,0) -p8l_lbl1d - lda #<$96 - ldy #>$96 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:1988 skip1d: -p8l_skip1d - ; source: test_uword_equalities.p8:1990 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_234_afterif - cpy p8v_sources+2+1 - bne label_asm_234_afterif - ; source: test_uword_equalities.p8:1991 fail_uword(151,0) - lda #<$97 - ldy #>$97 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_234_afterif - ; source: test_uword_equalities.p8:1994 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_236_else - cpy p8v_sources+2+1 - bne label_asm_236_else - ; source: test_uword_equalities.p8:1995 fail_uword(152,0) - lda #<$98 - ldy #>$98 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_235_afterif -label_asm_236_else - ; source: test_uword_equalities.p8:1997 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_uword_equalities.p8:1999 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2001 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl2a -+ - ; source: test_uword_equalities.p8:2003 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:2004 lbl2a: fail_uword(153,0) -p8l_lbl2a - lda #<$99 - ldy #>$99 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2005 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:2007 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2008 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2010 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:2011 lbl2b: fail_uword(154,0) -p8l_lbl2b - lda #<$9a - ldy #>$9a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2012 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:2014 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_237_afterif - cpy p8v_values+2+1 - bne label_asm_237_afterif - ; source: test_uword_equalities.p8:2015 fail_uword(155,0) - lda #<$9b - ldy #>$9b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_237_afterif - ; source: test_uword_equalities.p8:2018 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_239_else - cpy p8v_values+2+1 - bne label_asm_239_else - ; source: test_uword_equalities.p8:2019 fail_uword(156,0) - lda #<$9c - ldy #>$9c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_238_afterif -label_asm_239_else - ; source: test_uword_equalities.p8:2021 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_uword_equalities.p8:2024 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl2c -+ - ; source: test_uword_equalities.p8:2026 goto skip2c - bra p8l_skip2c - ; source: test_uword_equalities.p8:2027 lbl2c: fail_uword(157,0) -p8l_lbl2c - lda #<$9d - ldy #>$9d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2028 skip2c: -p8l_skip2c - ; source: test_uword_equalities.p8:2030 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2031 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2033 goto skip2d - bra p8l_skip2d - ; source: test_uword_equalities.p8:2034 lbl2d: fail_uword(158,0) -p8l_lbl2d - lda #<$9e - ldy #>$9e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2035 skip2d: -p8l_skip2d - ; source: test_uword_equalities.p8:2037 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_240_afterif - cpy p8v_sources+2+1 - bne label_asm_240_afterif - ; source: test_uword_equalities.p8:2038 fail_uword(159,0) - lda #<$9f - ldy #>$9f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_240_afterif - ; source: test_uword_equalities.p8:2041 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_242_else - cpy p8v_sources+2+1 - bne label_asm_242_else - ; source: test_uword_equalities.p8:2042 fail_uword(160,0) - lda #<$a0 - ldy #>$a0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_241_afterif -label_asm_242_else - ; source: test_uword_equalities.p8:2044 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_uword_equalities.p8:2046 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2048 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl3a -+ - ; source: test_uword_equalities.p8:2050 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:2051 lbl3a: fail_uword(161,0) -p8l_lbl3a - lda #<$a1 - ldy #>$a1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2052 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:2054 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2055 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2057 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:2058 lbl3b: fail_uword(162,0) -p8l_lbl3b - lda #<$a2 - ldy #>$a2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2059 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:2061 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_243_afterif - cpy p8v_values+2+1 - bne label_asm_243_afterif - ; source: test_uword_equalities.p8:2062 fail_uword(163,0) - lda #<$a3 - ldy #>$a3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_243_afterif - ; source: test_uword_equalities.p8:2065 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_245_else - cpy p8v_values+2+1 - bne label_asm_245_else - ; source: test_uword_equalities.p8:2066 fail_uword(164,0) - lda #<$a4 - ldy #>$a4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_244_afterif -label_asm_245_else - ; source: test_uword_equalities.p8:2068 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_uword_equalities.p8:2071 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl3c -+ - ; source: test_uword_equalities.p8:2073 goto skip3c - bra p8l_skip3c - ; source: test_uword_equalities.p8:2074 lbl3c: fail_uword(165,0) -p8l_lbl3c - lda #<$a5 - ldy #>$a5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2075 skip3c: -p8l_skip3c - ; source: test_uword_equalities.p8:2077 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2078 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2080 goto skip3d - bra p8l_skip3d - ; source: test_uword_equalities.p8:2081 lbl3d: fail_uword(166,0) -p8l_lbl3d - lda #<$a6 - ldy #>$a6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2082 skip3d: -p8l_skip3d - ; source: test_uword_equalities.p8:2084 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_246_afterif - cpy p8v_sources+2+1 - bne label_asm_246_afterif - ; source: test_uword_equalities.p8:2085 fail_uword(167,0) - lda #<$a7 - ldy #>$a7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_246_afterif - ; source: test_uword_equalities.p8:2088 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_248_else - cpy p8v_sources+2+1 - bne label_asm_248_else - ; source: test_uword_equalities.p8:2089 fail_uword(168,0) - lda #<$a8 - ldy #>$a8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_247_afterif -label_asm_248_else - ; source: test_uword_equalities.p8:2091 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_uword_equalities.p8:2093 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:2094 sources[1]=1 - ldy #2 - lda #<1 - sta p8v_sources,y - lda #>1 - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2095 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2097 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl4a -+ - ; source: test_uword_equalities.p8:2099 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:2100 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2101 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:2103 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2104 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2106 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:2107 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2108 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:2110 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_249_afterif - cpy p8v_values+2+1 - bne label_asm_249_afterif - ; source: test_uword_equalities.p8:2111 success++ - inc p8b_main.p8v_success -label_asm_249_afterif - ; source: test_uword_equalities.p8:2114 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_251_else - cpy p8v_values+2+1 - bne label_asm_251_else - ; source: test_uword_equalities.p8:2115 success++ - inc p8b_main.p8v_success - bra label_asm_250_afterif -label_asm_251_else - ; source: test_uword_equalities.p8:2117 cx16.r0L++ - inc cx16.r0L -label_asm_250_afterif - ; source: test_uword_equalities.p8:2120 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl4c -+ - ; source: test_uword_equalities.p8:2122 goto skip4c - bra p8l_skip4c - ; source: test_uword_equalities.p8:2123 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2124 skip4c: -p8l_skip4c - ; source: test_uword_equalities.p8:2126 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2127 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2129 goto skip4d - bra p8l_skip4d - ; source: test_uword_equalities.p8:2130 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2131 skip4d: -p8l_skip4d - ; source: test_uword_equalities.p8:2133 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_252_afterif - cpy p8v_sources+2+1 - bne label_asm_252_afterif - ; source: test_uword_equalities.p8:2134 success++ - inc p8b_main.p8v_success -label_asm_252_afterif - ; source: test_uword_equalities.p8:2137 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_254_else - cpy p8v_sources+2+1 - bne label_asm_254_else - ; source: test_uword_equalities.p8:2138 success++ - inc p8b_main.p8v_success - bra label_asm_253_afterif -label_asm_254_else - ; source: test_uword_equalities.p8:2140 cx16.r0L++ - inc cx16.r0L -label_asm_253_afterif - ; source: test_uword_equalities.p8:2142 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2144 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl5a -+ - ; source: test_uword_equalities.p8:2146 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:2147 lbl5a: fail_uword(169,1) -p8l_lbl5a - lda #<$a9 - ldy #>$a9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2148 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:2150 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2151 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2153 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:2154 lbl5b: fail_uword(170,1) -p8l_lbl5b - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2155 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:2157 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_255_afterif - cpy p8v_values+2+1 - bne label_asm_255_afterif - ; source: test_uword_equalities.p8:2158 fail_uword(171,1) - lda #<$ab - ldy #>$ab - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_255_afterif - ; source: test_uword_equalities.p8:2161 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_257_else - cpy p8v_values+2+1 - bne label_asm_257_else - ; source: test_uword_equalities.p8:2162 fail_uword(172,1) - lda #<$ac - ldy #>$ac - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_256_afterif -label_asm_257_else - ; source: test_uword_equalities.p8:2164 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_uword_equalities.p8:2167 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl5c -+ - ; source: test_uword_equalities.p8:2169 goto skip5c - bra p8l_skip5c - ; source: test_uword_equalities.p8:2170 lbl5c: fail_uword(173,1) -p8l_lbl5c - lda #<$ad - ldy #>$ad - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2171 skip5c: -p8l_skip5c - ; source: test_uword_equalities.p8:2173 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2174 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2176 goto skip5d - bra p8l_skip5d - ; source: test_uword_equalities.p8:2177 lbl5d: fail_uword(174,1) -p8l_lbl5d - lda #<$ae - ldy #>$ae - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2178 skip5d: -p8l_skip5d - ; source: test_uword_equalities.p8:2180 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_258_afterif - cpy p8v_sources+2+1 - bne label_asm_258_afterif - ; source: test_uword_equalities.p8:2181 fail_uword(175,1) - lda #<$af - ldy #>$af - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_258_afterif - ; source: test_uword_equalities.p8:2184 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_260_else - cpy p8v_sources+2+1 - bne label_asm_260_else - ; source: test_uword_equalities.p8:2185 fail_uword(176,1) - lda #<$b0 - ldy #>$b0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_259_afterif -label_asm_260_else - ; source: test_uword_equalities.p8:2187 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_uword_equalities.p8:2189 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2191 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl6a -+ - ; source: test_uword_equalities.p8:2193 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:2194 lbl6a: fail_uword(177,1) -p8l_lbl6a - lda #<$b1 - ldy #>$b1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2195 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:2197 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2198 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2200 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:2201 lbl6b: fail_uword(178,1) -p8l_lbl6b - lda #<$b2 - ldy #>$b2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2202 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:2204 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_261_afterif - cpy p8v_values+2+1 - bne label_asm_261_afterif - ; source: test_uword_equalities.p8:2205 fail_uword(179,1) - lda #<$b3 - ldy #>$b3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_261_afterif - ; source: test_uword_equalities.p8:2208 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_263_else - cpy p8v_values+2+1 - bne label_asm_263_else - ; source: test_uword_equalities.p8:2209 fail_uword(180,1) - lda #<$b4 - ldy #>$b4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_262_afterif -label_asm_263_else - ; source: test_uword_equalities.p8:2211 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_uword_equalities.p8:2214 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl6c -+ - ; source: test_uword_equalities.p8:2216 goto skip6c - bra p8l_skip6c - ; source: test_uword_equalities.p8:2217 lbl6c: fail_uword(181,1) -p8l_lbl6c - lda #<$b5 - ldy #>$b5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2218 skip6c: -p8l_skip6c - ; source: test_uword_equalities.p8:2220 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2221 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2223 goto skip6d - bra p8l_skip6d - ; source: test_uword_equalities.p8:2224 lbl6d: fail_uword(182,1) -p8l_lbl6d - lda #<$b6 - ldy #>$b6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2225 skip6d: -p8l_skip6d - ; source: test_uword_equalities.p8:2227 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_264_afterif - cpy p8v_sources+2+1 - bne label_asm_264_afterif - ; source: test_uword_equalities.p8:2228 fail_uword(183,1) - lda #<$b7 - ldy #>$b7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_264_afterif - ; source: test_uword_equalities.p8:2231 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_266_else - cpy p8v_sources+2+1 - bne label_asm_266_else - ; source: test_uword_equalities.p8:2232 fail_uword(184,1) - lda #<$b8 - ldy #>$b8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_265_afterif -label_asm_266_else - ; source: test_uword_equalities.p8:2234 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_uword_equalities.p8:2236 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:2237 sources[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_sources,y - lda #>$7700 - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2238 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2240 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl7a -+ - ; source: test_uword_equalities.p8:2242 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:2243 lbl7a: fail_uword(185,30464) -p8l_lbl7a - lda #<$b9 - ldy #>$b9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2244 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:2246 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2247 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2249 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:2250 lbl7b: fail_uword(186,30464) -p8l_lbl7b - lda #<$ba - ldy #>$ba - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2251 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:2253 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_267_afterif - cpy p8v_values+2+1 - bne label_asm_267_afterif - ; source: test_uword_equalities.p8:2254 fail_uword(187,30464) - lda #<$bb - ldy #>$bb - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_267_afterif - ; source: test_uword_equalities.p8:2257 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_269_else - cpy p8v_values+2+1 - bne label_asm_269_else - ; source: test_uword_equalities.p8:2258 fail_uword(188,30464) - lda #<$bc - ldy #>$bc - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_268_afterif -label_asm_269_else - ; source: test_uword_equalities.p8:2260 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_uword_equalities.p8:2263 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl7c -+ - ; source: test_uword_equalities.p8:2265 goto skip7c - bra p8l_skip7c - ; source: test_uword_equalities.p8:2266 lbl7c: fail_uword(189,30464) -p8l_lbl7c - lda #<$bd - ldy #>$bd - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2267 skip7c: -p8l_skip7c - ; source: test_uword_equalities.p8:2269 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2270 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2272 goto skip7d - bra p8l_skip7d - ; source: test_uword_equalities.p8:2273 lbl7d: fail_uword(190,30464) -p8l_lbl7d - lda #<$be - ldy #>$be - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2274 skip7d: -p8l_skip7d - ; source: test_uword_equalities.p8:2276 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_270_afterif - cpy p8v_sources+2+1 - bne label_asm_270_afterif - ; source: test_uword_equalities.p8:2277 fail_uword(191,30464) - lda #<$bf - ldy #>$bf - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_270_afterif - ; source: test_uword_equalities.p8:2280 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_272_else - cpy p8v_sources+2+1 - bne label_asm_272_else - ; source: test_uword_equalities.p8:2281 fail_uword(192,30464) - lda #<$c0 - ldy #>$c0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_271_afterif -label_asm_272_else - ; source: test_uword_equalities.p8:2283 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_uword_equalities.p8:2285 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2287 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl8a -+ - ; source: test_uword_equalities.p8:2289 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:2290 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2291 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:2293 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2294 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2296 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:2297 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2298 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:2300 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_273_afterif - cpy p8v_values+2+1 - bne label_asm_273_afterif - ; source: test_uword_equalities.p8:2301 success++ - inc p8b_main.p8v_success -label_asm_273_afterif - ; source: test_uword_equalities.p8:2304 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_275_else - cpy p8v_values+2+1 - bne label_asm_275_else - ; source: test_uword_equalities.p8:2305 success++ - inc p8b_main.p8v_success - bra label_asm_274_afterif -label_asm_275_else - ; source: test_uword_equalities.p8:2307 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_uword_equalities.p8:2310 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl8c -+ - ; source: test_uword_equalities.p8:2312 goto skip8c - bra p8l_skip8c - ; source: test_uword_equalities.p8:2313 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2314 skip8c: -p8l_skip8c - ; source: test_uword_equalities.p8:2316 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2317 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2319 goto skip8d - bra p8l_skip8d - ; source: test_uword_equalities.p8:2320 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2321 skip8d: -p8l_skip8d - ; source: test_uword_equalities.p8:2323 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_276_afterif - cpy p8v_sources+2+1 - bne label_asm_276_afterif - ; source: test_uword_equalities.p8:2324 success++ - inc p8b_main.p8v_success -label_asm_276_afterif - ; source: test_uword_equalities.p8:2327 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_278_else - cpy p8v_sources+2+1 - bne label_asm_278_else - ; source: test_uword_equalities.p8:2328 success++ - inc p8b_main.p8v_success - bra label_asm_277_afterif -label_asm_278_else - ; source: test_uword_equalities.p8:2330 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_uword_equalities.p8:2332 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2334 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl9a -+ - ; source: test_uword_equalities.p8:2336 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:2337 lbl9a: fail_uword(193,30464) -p8l_lbl9a - lda #<$c1 - ldy #>$c1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2338 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:2340 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2341 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2343 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:2344 lbl9b: fail_uword(194,30464) -p8l_lbl9b - lda #<$c2 - ldy #>$c2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2345 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:2347 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_279_afterif - cpy p8v_values+2+1 - bne label_asm_279_afterif - ; source: test_uword_equalities.p8:2348 fail_uword(195,30464) - lda #<$c3 - ldy #>$c3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_279_afterif - ; source: test_uword_equalities.p8:2351 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_281_else - cpy p8v_values+2+1 - bne label_asm_281_else - ; source: test_uword_equalities.p8:2352 fail_uword(196,30464) - lda #<$c4 - ldy #>$c4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_280_afterif -label_asm_281_else - ; source: test_uword_equalities.p8:2354 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_uword_equalities.p8:2357 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl9c -+ - ; source: test_uword_equalities.p8:2359 goto skip9c - bra p8l_skip9c - ; source: test_uword_equalities.p8:2360 lbl9c: fail_uword(197,30464) -p8l_lbl9c - lda #<$c5 - ldy #>$c5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2361 skip9c: -p8l_skip9c - ; source: test_uword_equalities.p8:2363 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2364 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2366 goto skip9d - bra p8l_skip9d - ; source: test_uword_equalities.p8:2367 lbl9d: fail_uword(198,30464) -p8l_lbl9d - lda #<$c6 - ldy #>$c6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2368 skip9d: -p8l_skip9d - ; source: test_uword_equalities.p8:2370 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_282_afterif - cpy p8v_sources+2+1 - bne label_asm_282_afterif - ; source: test_uword_equalities.p8:2371 fail_uword(199,30464) - lda #<$c7 - ldy #>$c7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_282_afterif - ; source: test_uword_equalities.p8:2374 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_284_else - cpy p8v_sources+2+1 - bne label_asm_284_else - ; source: test_uword_equalities.p8:2375 fail_uword(200,30464) - lda #<$c8 - ldy #>$c8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_283_afterif -label_asm_284_else - ; source: test_uword_equalities.p8:2377 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_uword_equalities.p8:2379 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:2380 sources[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_sources,y - lda #>$ffff - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2381 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2383 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl10a -+ - ; source: test_uword_equalities.p8:2385 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:2386 lbl10a: fail_uword(201,65535) -p8l_lbl10a - lda #<$c9 - ldy #>$c9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2387 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:2389 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2390 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2392 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:2393 lbl10b: fail_uword(202,65535) -p8l_lbl10b - lda #<$ca - ldy #>$ca - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2394 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:2396 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_285_afterif - cpy p8v_values+2+1 - bne label_asm_285_afterif - ; source: test_uword_equalities.p8:2397 fail_uword(203,65535) - lda #<$cb - ldy #>$cb - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_285_afterif - ; source: test_uword_equalities.p8:2400 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_287_else - cpy p8v_values+2+1 - bne label_asm_287_else - ; source: test_uword_equalities.p8:2401 fail_uword(204,65535) - lda #<$cc - ldy #>$cc - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_286_afterif -label_asm_287_else - ; source: test_uword_equalities.p8:2403 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_uword_equalities.p8:2406 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl10c -+ - ; source: test_uword_equalities.p8:2408 goto skip10c - bra p8l_skip10c - ; source: test_uword_equalities.p8:2409 lbl10c: fail_uword(205,65535) -p8l_lbl10c - lda #<$cd - ldy #>$cd - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2410 skip10c: -p8l_skip10c - ; source: test_uword_equalities.p8:2412 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2413 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2415 goto skip10d - bra p8l_skip10d - ; source: test_uword_equalities.p8:2416 lbl10d: fail_uword(206,65535) -p8l_lbl10d - lda #<$ce - ldy #>$ce - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2417 skip10d: -p8l_skip10d - ; source: test_uword_equalities.p8:2419 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_288_afterif - cpy p8v_sources+2+1 - bne label_asm_288_afterif - ; source: test_uword_equalities.p8:2420 fail_uword(207,65535) - lda #<$cf - ldy #>$cf - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_288_afterif - ; source: test_uword_equalities.p8:2423 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_290_else - cpy p8v_sources+2+1 - bne label_asm_290_else - ; source: test_uword_equalities.p8:2424 fail_uword(208,65535) - lda #<$d0 - ldy #>$d0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_289_afterif -label_asm_290_else - ; source: test_uword_equalities.p8:2426 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_uword_equalities.p8:2428 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2430 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl11a -+ - ; source: test_uword_equalities.p8:2432 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:2433 lbl11a: fail_uword(209,65535) -p8l_lbl11a - lda #<$d1 - ldy #>$d1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2434 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:2436 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2437 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2439 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:2440 lbl11b: fail_uword(210,65535) -p8l_lbl11b - lda #<$d2 - ldy #>$d2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2441 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:2443 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_291_afterif - cpy p8v_values+2+1 - bne label_asm_291_afterif - ; source: test_uword_equalities.p8:2444 fail_uword(211,65535) - lda #<$d3 - ldy #>$d3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_291_afterif - ; source: test_uword_equalities.p8:2447 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_293_else - cpy p8v_values+2+1 - bne label_asm_293_else - ; source: test_uword_equalities.p8:2448 fail_uword(212,65535) - lda #<$d4 - ldy #>$d4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_292_afterif -label_asm_293_else - ; source: test_uword_equalities.p8:2450 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_uword_equalities.p8:2453 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl11c -+ - ; source: test_uword_equalities.p8:2455 goto skip11c - bra p8l_skip11c - ; source: test_uword_equalities.p8:2456 lbl11c: fail_uword(213,65535) -p8l_lbl11c - lda #<$d5 - ldy #>$d5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2457 skip11c: -p8l_skip11c - ; source: test_uword_equalities.p8:2459 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2460 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2462 goto skip11d - bra p8l_skip11d - ; source: test_uword_equalities.p8:2463 lbl11d: fail_uword(214,65535) -p8l_lbl11d - lda #<$d6 - ldy #>$d6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2464 skip11d: -p8l_skip11d - ; source: test_uword_equalities.p8:2466 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_294_afterif - cpy p8v_sources+2+1 - bne label_asm_294_afterif - ; source: test_uword_equalities.p8:2467 fail_uword(215,65535) - lda #<$d7 - ldy #>$d7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_294_afterif - ; source: test_uword_equalities.p8:2470 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_296_else - cpy p8v_sources+2+1 - bne label_asm_296_else - ; source: test_uword_equalities.p8:2471 fail_uword(216,65535) - lda #<$d8 - ldy #>$d8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_295_afterif -label_asm_296_else - ; source: test_uword_equalities.p8:2473 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_uword_equalities.p8:2475 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2477 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl12a -+ - ; source: test_uword_equalities.p8:2479 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:2480 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2481 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:2483 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2484 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2486 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:2487 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2488 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:2490 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_297_afterif - cpy p8v_values+2+1 - bne label_asm_297_afterif - ; source: test_uword_equalities.p8:2491 success++ - inc p8b_main.p8v_success -label_asm_297_afterif - ; source: test_uword_equalities.p8:2494 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_299_else - cpy p8v_values+2+1 - bne label_asm_299_else - ; source: test_uword_equalities.p8:2495 success++ - inc p8b_main.p8v_success - bra label_asm_298_afterif -label_asm_299_else - ; source: test_uword_equalities.p8:2497 cx16.r0L++ - inc cx16.r0L -label_asm_298_afterif - ; source: test_uword_equalities.p8:2500 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl12c -+ - ; source: test_uword_equalities.p8:2502 goto skip12c - bra p8l_skip12c - ; source: test_uword_equalities.p8:2503 lbl12c: success++ -p8l_lbl12c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2504 skip12c: -p8l_skip12c - ; source: test_uword_equalities.p8:2506 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2507 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2509 goto skip12d - bra p8l_skip12d - ; source: test_uword_equalities.p8:2510 lbl12d: success++ -p8l_lbl12d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2511 skip12d: -p8l_skip12d - ; source: test_uword_equalities.p8:2513 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_300_afterif - cpy p8v_sources+2+1 - bne label_asm_300_afterif - ; source: test_uword_equalities.p8:2514 success++ - inc p8b_main.p8v_success -label_asm_300_afterif - ; source: test_uword_equalities.p8:2517 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_302_else - cpy p8v_sources+2+1 - bne label_asm_302_else - ; source: test_uword_equalities.p8:2518 success++ - inc p8b_main.p8v_success - bra label_asm_301_afterif -label_asm_302_else - ; source: test_uword_equalities.p8:2520 cx16.r0L++ - inc cx16.r0L -label_asm_301_afterif - ; source: test_uword_equalities.p8:2522 verify_success(24) - lda #$18 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:1945 sub test_is_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -p8v_sources .word $0000, $0000 -p8v_values .word $0000, $0000 - .pend - ; source: test_uword_equalities.p8:2524 sub test_not_array() { - -p8s_test_not_array .proc -; statements - ; source: test_uword_equalities.p8:2525 uword @shared x - ; source: test_uword_equalities.p8:2526 uword[] values = [0, 0] - ; source: test_uword_equalities.p8:2527 uword[] sources = [0, 0] - ; source: test_uword_equalities.p8:2525 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:2528 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_equalities.p8:2529 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_equalities.p8:2530 sources[1]=0 - ldy #2 - lda #0 - sta p8v_sources,y - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2531 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2533 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl1a - cpy p8v_values+2+1 - bne p8l_lbl1a - ; source: test_uword_equalities.p8:2535 goto skip1a - bra p8l_skip1a - ; source: test_uword_equalities.p8:2536 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2537 skip1a: -p8l_skip1a - ; source: test_uword_equalities.p8:2539 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2540 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2542 goto skip1b - bra p8l_skip1b - ; source: test_uword_equalities.p8:2543 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2544 skip1b: -p8l_skip1b - ; source: test_uword_equalities.p8:2546 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_303_afterif -+ - ; source: test_uword_equalities.p8:2547 success++ - inc p8b_main.p8v_success -label_asm_303_afterif - ; source: test_uword_equalities.p8:2550 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_305_else -+ - ; source: test_uword_equalities.p8:2551 success++ - inc p8b_main.p8v_success - bra label_asm_304_afterif -label_asm_305_else - ; source: test_uword_equalities.p8:2553 cx16.r0L++ - inc cx16.r0L -label_asm_304_afterif - ; source: test_uword_equalities.p8:2556 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl1c - cpy p8v_sources+2+1 - bne p8l_lbl1c - ; source: test_uword_equalities.p8:2558 goto skip1c - bra p8l_skip1c - ; source: test_uword_equalities.p8:2559 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2560 skip1c: -p8l_skip1c - ; source: test_uword_equalities.p8:2562 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2563 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2565 goto skip1d - bra p8l_skip1d - ; source: test_uword_equalities.p8:2566 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2567 skip1d: -p8l_skip1d - ; source: test_uword_equalities.p8:2569 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_306_afterif -+ - ; source: test_uword_equalities.p8:2570 success++ - inc p8b_main.p8v_success -label_asm_306_afterif - ; source: test_uword_equalities.p8:2573 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_308_else -+ - ; source: test_uword_equalities.p8:2574 success++ - inc p8b_main.p8v_success - bra label_asm_307_afterif -label_asm_308_else - ; source: test_uword_equalities.p8:2576 cx16.r0L++ - inc cx16.r0L -label_asm_307_afterif - ; source: test_uword_equalities.p8:2578 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2580 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl2a - cpy p8v_values+2+1 - bne p8l_lbl2a - ; source: test_uword_equalities.p8:2582 goto skip2a - bra p8l_skip2a - ; source: test_uword_equalities.p8:2583 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2584 skip2a: -p8l_skip2a - ; source: test_uword_equalities.p8:2586 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2587 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2589 goto skip2b - bra p8l_skip2b - ; source: test_uword_equalities.p8:2590 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2591 skip2b: -p8l_skip2b - ; source: test_uword_equalities.p8:2593 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_309_afterif -+ - ; source: test_uword_equalities.p8:2594 success++ - inc p8b_main.p8v_success -label_asm_309_afterif - ; source: test_uword_equalities.p8:2597 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_311_else -+ - ; source: test_uword_equalities.p8:2598 success++ - inc p8b_main.p8v_success - bra label_asm_310_afterif -label_asm_311_else - ; source: test_uword_equalities.p8:2600 cx16.r0L++ - inc cx16.r0L -label_asm_310_afterif - ; source: test_uword_equalities.p8:2603 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl2c - cpy p8v_sources+2+1 - bne p8l_lbl2c - ; source: test_uword_equalities.p8:2605 goto skip2c - bra p8l_skip2c - ; source: test_uword_equalities.p8:2606 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2607 skip2c: -p8l_skip2c - ; source: test_uword_equalities.p8:2609 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2610 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2612 goto skip2d - bra p8l_skip2d - ; source: test_uword_equalities.p8:2613 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2614 skip2d: -p8l_skip2d - ; source: test_uword_equalities.p8:2616 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_312_afterif -+ - ; source: test_uword_equalities.p8:2617 success++ - inc p8b_main.p8v_success -label_asm_312_afterif - ; source: test_uword_equalities.p8:2620 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_314_else -+ - ; source: test_uword_equalities.p8:2621 success++ - inc p8b_main.p8v_success - bra label_asm_313_afterif -label_asm_314_else - ; source: test_uword_equalities.p8:2623 cx16.r0L++ - inc cx16.r0L -label_asm_313_afterif - ; source: test_uword_equalities.p8:2625 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2627 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl3a - cpy p8v_values+2+1 - bne p8l_lbl3a - ; source: test_uword_equalities.p8:2629 goto skip3a - bra p8l_skip3a - ; source: test_uword_equalities.p8:2630 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2631 skip3a: -p8l_skip3a - ; source: test_uword_equalities.p8:2633 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2634 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2636 goto skip3b - bra p8l_skip3b - ; source: test_uword_equalities.p8:2637 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2638 skip3b: -p8l_skip3b - ; source: test_uword_equalities.p8:2640 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_315_afterif -+ - ; source: test_uword_equalities.p8:2641 success++ - inc p8b_main.p8v_success -label_asm_315_afterif - ; source: test_uword_equalities.p8:2644 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_317_else -+ - ; source: test_uword_equalities.p8:2645 success++ - inc p8b_main.p8v_success - bra label_asm_316_afterif -label_asm_317_else - ; source: test_uword_equalities.p8:2647 cx16.r0L++ - inc cx16.r0L -label_asm_316_afterif - ; source: test_uword_equalities.p8:2650 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl3c - cpy p8v_sources+2+1 - bne p8l_lbl3c - ; source: test_uword_equalities.p8:2652 goto skip3c - bra p8l_skip3c - ; source: test_uword_equalities.p8:2653 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2654 skip3c: -p8l_skip3c - ; source: test_uword_equalities.p8:2656 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2657 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2659 goto skip3d - bra p8l_skip3d - ; source: test_uword_equalities.p8:2660 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2661 skip3d: -p8l_skip3d - ; source: test_uword_equalities.p8:2663 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_318_afterif -+ - ; source: test_uword_equalities.p8:2664 success++ - inc p8b_main.p8v_success -label_asm_318_afterif - ; source: test_uword_equalities.p8:2667 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_320_else -+ - ; source: test_uword_equalities.p8:2668 success++ - inc p8b_main.p8v_success - bra label_asm_319_afterif -label_asm_320_else - ; source: test_uword_equalities.p8:2670 cx16.r0L++ - inc cx16.r0L -label_asm_319_afterif - ; source: test_uword_equalities.p8:2672 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:2673 sources[1]=1 - ldy #2 - lda #<1 - sta p8v_sources,y - lda #>1 - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2674 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2676 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl4a - cpy p8v_values+2+1 - bne p8l_lbl4a - ; source: test_uword_equalities.p8:2678 goto skip4a - bra p8l_skip4a - ; source: test_uword_equalities.p8:2679 lbl4a: fail_uword(217,1) -p8l_lbl4a - lda #<$d9 - ldy #>$d9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2680 skip4a: -p8l_skip4a - ; source: test_uword_equalities.p8:2682 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2683 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2685 goto skip4b - bra p8l_skip4b - ; source: test_uword_equalities.p8:2686 lbl4b: fail_uword(218,1) -p8l_lbl4b - lda #<$da - ldy #>$da - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2687 skip4b: -p8l_skip4b - ; source: test_uword_equalities.p8:2689 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_321_afterif -+ - ; source: test_uword_equalities.p8:2690 fail_uword(219,1) - lda #<$db - ldy #>$db - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_321_afterif - ; source: test_uword_equalities.p8:2693 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_323_else -+ - ; source: test_uword_equalities.p8:2694 fail_uword(220,1) - lda #<$dc - ldy #>$dc - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_322_afterif -label_asm_323_else - ; source: test_uword_equalities.p8:2696 cx16.r0L++ - inc cx16.r0L -label_asm_322_afterif - ; source: test_uword_equalities.p8:2699 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl4c - cpy p8v_sources+2+1 - bne p8l_lbl4c - ; source: test_uword_equalities.p8:2701 goto skip4c - bra p8l_skip4c - ; source: test_uword_equalities.p8:2702 lbl4c: fail_uword(221,1) -p8l_lbl4c - lda #<$dd - ldy #>$dd - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2703 skip4c: -p8l_skip4c - ; source: test_uword_equalities.p8:2705 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2706 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2708 goto skip4d - bra p8l_skip4d - ; source: test_uword_equalities.p8:2709 lbl4d: fail_uword(222,1) -p8l_lbl4d - lda #<$de - ldy #>$de - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2710 skip4d: -p8l_skip4d - ; source: test_uword_equalities.p8:2712 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_324_afterif -+ - ; source: test_uword_equalities.p8:2713 fail_uword(223,1) - lda #<$df - ldy #>$df - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_324_afterif - ; source: test_uword_equalities.p8:2716 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_326_else -+ - ; source: test_uword_equalities.p8:2717 fail_uword(224,1) - lda #<$e0 - ldy #>$e0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_325_afterif -label_asm_326_else - ; source: test_uword_equalities.p8:2719 cx16.r0L++ - inc cx16.r0L -label_asm_325_afterif - ; source: test_uword_equalities.p8:2721 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2723 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl5a - cpy p8v_values+2+1 - bne p8l_lbl5a - ; source: test_uword_equalities.p8:2725 goto skip5a - bra p8l_skip5a - ; source: test_uword_equalities.p8:2726 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2727 skip5a: -p8l_skip5a - ; source: test_uword_equalities.p8:2729 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2730 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2732 goto skip5b - bra p8l_skip5b - ; source: test_uword_equalities.p8:2733 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2734 skip5b: -p8l_skip5b - ; source: test_uword_equalities.p8:2736 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_327_afterif -+ - ; source: test_uword_equalities.p8:2737 success++ - inc p8b_main.p8v_success -label_asm_327_afterif - ; source: test_uword_equalities.p8:2740 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_329_else -+ - ; source: test_uword_equalities.p8:2741 success++ - inc p8b_main.p8v_success - bra label_asm_328_afterif -label_asm_329_else - ; source: test_uword_equalities.p8:2743 cx16.r0L++ - inc cx16.r0L -label_asm_328_afterif - ; source: test_uword_equalities.p8:2746 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl5c - cpy p8v_sources+2+1 - bne p8l_lbl5c - ; source: test_uword_equalities.p8:2748 goto skip5c - bra p8l_skip5c - ; source: test_uword_equalities.p8:2749 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2750 skip5c: -p8l_skip5c - ; source: test_uword_equalities.p8:2752 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2753 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2755 goto skip5d - bra p8l_skip5d - ; source: test_uword_equalities.p8:2756 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2757 skip5d: -p8l_skip5d - ; source: test_uword_equalities.p8:2759 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_330_afterif -+ - ; source: test_uword_equalities.p8:2760 success++ - inc p8b_main.p8v_success -label_asm_330_afterif - ; source: test_uword_equalities.p8:2763 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_332_else -+ - ; source: test_uword_equalities.p8:2764 success++ - inc p8b_main.p8v_success - bra label_asm_331_afterif -label_asm_332_else - ; source: test_uword_equalities.p8:2766 cx16.r0L++ - inc cx16.r0L -label_asm_331_afterif - ; source: test_uword_equalities.p8:2768 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2770 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl6a - cpy p8v_values+2+1 - bne p8l_lbl6a - ; source: test_uword_equalities.p8:2772 goto skip6a - bra p8l_skip6a - ; source: test_uword_equalities.p8:2773 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2774 skip6a: -p8l_skip6a - ; source: test_uword_equalities.p8:2776 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2777 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2779 goto skip6b - bra p8l_skip6b - ; source: test_uword_equalities.p8:2780 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2781 skip6b: -p8l_skip6b - ; source: test_uword_equalities.p8:2783 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_333_afterif -+ - ; source: test_uword_equalities.p8:2784 success++ - inc p8b_main.p8v_success -label_asm_333_afterif - ; source: test_uword_equalities.p8:2787 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_335_else -+ - ; source: test_uword_equalities.p8:2788 success++ - inc p8b_main.p8v_success - bra label_asm_334_afterif -label_asm_335_else - ; source: test_uword_equalities.p8:2790 cx16.r0L++ - inc cx16.r0L -label_asm_334_afterif - ; source: test_uword_equalities.p8:2793 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl6c - cpy p8v_sources+2+1 - bne p8l_lbl6c - ; source: test_uword_equalities.p8:2795 goto skip6c - bra p8l_skip6c - ; source: test_uword_equalities.p8:2796 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2797 skip6c: -p8l_skip6c - ; source: test_uword_equalities.p8:2799 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2800 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2802 goto skip6d - bra p8l_skip6d - ; source: test_uword_equalities.p8:2803 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2804 skip6d: -p8l_skip6d - ; source: test_uword_equalities.p8:2806 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_336_afterif -+ - ; source: test_uword_equalities.p8:2807 success++ - inc p8b_main.p8v_success -label_asm_336_afterif - ; source: test_uword_equalities.p8:2810 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_338_else -+ - ; source: test_uword_equalities.p8:2811 success++ - inc p8b_main.p8v_success - bra label_asm_337_afterif -label_asm_338_else - ; source: test_uword_equalities.p8:2813 cx16.r0L++ - inc cx16.r0L -label_asm_337_afterif - ; source: test_uword_equalities.p8:2815 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_equalities.p8:2816 sources[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_sources,y - lda #>$7700 - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2817 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2819 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl7a - cpy p8v_values+2+1 - bne p8l_lbl7a - ; source: test_uword_equalities.p8:2821 goto skip7a - bra p8l_skip7a - ; source: test_uword_equalities.p8:2822 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2823 skip7a: -p8l_skip7a - ; source: test_uword_equalities.p8:2825 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2826 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2828 goto skip7b - bra p8l_skip7b - ; source: test_uword_equalities.p8:2829 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2830 skip7b: -p8l_skip7b - ; source: test_uword_equalities.p8:2832 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_339_afterif -+ - ; source: test_uword_equalities.p8:2833 success++ - inc p8b_main.p8v_success -label_asm_339_afterif - ; source: test_uword_equalities.p8:2836 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_341_else -+ - ; source: test_uword_equalities.p8:2837 success++ - inc p8b_main.p8v_success - bra label_asm_340_afterif -label_asm_341_else - ; source: test_uword_equalities.p8:2839 cx16.r0L++ - inc cx16.r0L -label_asm_340_afterif - ; source: test_uword_equalities.p8:2842 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl7c - cpy p8v_sources+2+1 - bne p8l_lbl7c - ; source: test_uword_equalities.p8:2844 goto skip7c - bra p8l_skip7c - ; source: test_uword_equalities.p8:2845 lbl7c: success++ -p8l_lbl7c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2846 skip7c: -p8l_skip7c - ; source: test_uword_equalities.p8:2848 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2849 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2851 goto skip7d - bra p8l_skip7d - ; source: test_uword_equalities.p8:2852 lbl7d: success++ -p8l_lbl7d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2853 skip7d: -p8l_skip7d - ; source: test_uword_equalities.p8:2855 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_342_afterif -+ - ; source: test_uword_equalities.p8:2856 success++ - inc p8b_main.p8v_success -label_asm_342_afterif - ; source: test_uword_equalities.p8:2859 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_344_else -+ - ; source: test_uword_equalities.p8:2860 success++ - inc p8b_main.p8v_success - bra label_asm_343_afterif -label_asm_344_else - ; source: test_uword_equalities.p8:2862 cx16.r0L++ - inc cx16.r0L -label_asm_343_afterif - ; source: test_uword_equalities.p8:2864 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2866 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl8a - cpy p8v_values+2+1 - bne p8l_lbl8a - ; source: test_uword_equalities.p8:2868 goto skip8a - bra p8l_skip8a - ; source: test_uword_equalities.p8:2869 lbl8a: fail_uword(225,30464) -p8l_lbl8a - lda #<$e1 - ldy #>$e1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2870 skip8a: -p8l_skip8a - ; source: test_uword_equalities.p8:2872 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2873 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2875 goto skip8b - bra p8l_skip8b - ; source: test_uword_equalities.p8:2876 lbl8b: fail_uword(226,30464) -p8l_lbl8b - lda #<$e2 - ldy #>$e2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2877 skip8b: -p8l_skip8b - ; source: test_uword_equalities.p8:2879 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_345_afterif -+ - ; source: test_uword_equalities.p8:2880 fail_uword(227,30464) - lda #<$e3 - ldy #>$e3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_345_afterif - ; source: test_uword_equalities.p8:2883 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_347_else -+ - ; source: test_uword_equalities.p8:2884 fail_uword(228,30464) - lda #<$e4 - ldy #>$e4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_346_afterif -label_asm_347_else - ; source: test_uword_equalities.p8:2886 cx16.r0L++ - inc cx16.r0L -label_asm_346_afterif - ; source: test_uword_equalities.p8:2889 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl8c - cpy p8v_sources+2+1 - bne p8l_lbl8c - ; source: test_uword_equalities.p8:2891 goto skip8c - bra p8l_skip8c - ; source: test_uword_equalities.p8:2892 lbl8c: fail_uword(229,30464) -p8l_lbl8c - lda #<$e5 - ldy #>$e5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2893 skip8c: -p8l_skip8c - ; source: test_uword_equalities.p8:2895 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2896 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2898 goto skip8d - bra p8l_skip8d - ; source: test_uword_equalities.p8:2899 lbl8d: fail_uword(230,30464) -p8l_lbl8d - lda #<$e6 - ldy #>$e6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:2900 skip8d: -p8l_skip8d - ; source: test_uword_equalities.p8:2902 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_348_afterif -+ - ; source: test_uword_equalities.p8:2903 fail_uword(231,30464) - lda #<$e7 - ldy #>$e7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_348_afterif - ; source: test_uword_equalities.p8:2906 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_350_else -+ - ; source: test_uword_equalities.p8:2907 fail_uword(232,30464) - lda #<$e8 - ldy #>$e8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_349_afterif -label_asm_350_else - ; source: test_uword_equalities.p8:2909 cx16.r0L++ - inc cx16.r0L -label_asm_349_afterif - ; source: test_uword_equalities.p8:2911 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2913 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl9a - cpy p8v_values+2+1 - bne p8l_lbl9a - ; source: test_uword_equalities.p8:2915 goto skip9a - bra p8l_skip9a - ; source: test_uword_equalities.p8:2916 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2917 skip9a: -p8l_skip9a - ; source: test_uword_equalities.p8:2919 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2920 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2922 goto skip9b - bra p8l_skip9b - ; source: test_uword_equalities.p8:2923 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2924 skip9b: -p8l_skip9b - ; source: test_uword_equalities.p8:2926 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_351_afterif -+ - ; source: test_uword_equalities.p8:2927 success++ - inc p8b_main.p8v_success -label_asm_351_afterif - ; source: test_uword_equalities.p8:2930 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_353_else -+ - ; source: test_uword_equalities.p8:2931 success++ - inc p8b_main.p8v_success - bra label_asm_352_afterif -label_asm_353_else - ; source: test_uword_equalities.p8:2933 cx16.r0L++ - inc cx16.r0L -label_asm_352_afterif - ; source: test_uword_equalities.p8:2936 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl9c - cpy p8v_sources+2+1 - bne p8l_lbl9c - ; source: test_uword_equalities.p8:2938 goto skip9c - bra p8l_skip9c - ; source: test_uword_equalities.p8:2939 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2940 skip9c: -p8l_skip9c - ; source: test_uword_equalities.p8:2942 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2943 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2945 goto skip9d - bra p8l_skip9d - ; source: test_uword_equalities.p8:2946 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2947 skip9d: -p8l_skip9d - ; source: test_uword_equalities.p8:2949 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_354_afterif -+ - ; source: test_uword_equalities.p8:2950 success++ - inc p8b_main.p8v_success -label_asm_354_afterif - ; source: test_uword_equalities.p8:2953 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_356_else -+ - ; source: test_uword_equalities.p8:2954 success++ - inc p8b_main.p8v_success - bra label_asm_355_afterif -label_asm_356_else - ; source: test_uword_equalities.p8:2956 cx16.r0L++ - inc cx16.r0L -label_asm_355_afterif - ; source: test_uword_equalities.p8:2958 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_equalities.p8:2959 sources[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_sources,y - lda #>$ffff - sta p8v_sources+1,y - ; source: test_uword_equalities.p8:2960 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:2962 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl10a - cpy p8v_values+2+1 - bne p8l_lbl10a - ; source: test_uword_equalities.p8:2964 goto skip10a - bra p8l_skip10a - ; source: test_uword_equalities.p8:2965 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2966 skip10a: -p8l_skip10a - ; source: test_uword_equalities.p8:2968 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2969 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2971 goto skip10b - bra p8l_skip10b - ; source: test_uword_equalities.p8:2972 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2973 skip10b: -p8l_skip10b - ; source: test_uword_equalities.p8:2975 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_357_afterif -+ - ; source: test_uword_equalities.p8:2976 success++ - inc p8b_main.p8v_success -label_asm_357_afterif - ; source: test_uword_equalities.p8:2979 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_359_else -+ - ; source: test_uword_equalities.p8:2980 success++ - inc p8b_main.p8v_success - bra label_asm_358_afterif -label_asm_359_else - ; source: test_uword_equalities.p8:2982 cx16.r0L++ - inc cx16.r0L -label_asm_358_afterif - ; source: test_uword_equalities.p8:2985 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl10c - cpy p8v_sources+2+1 - bne p8l_lbl10c - ; source: test_uword_equalities.p8:2987 goto skip10c - bra p8l_skip10c - ; source: test_uword_equalities.p8:2988 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2989 skip10c: -p8l_skip10c - ; source: test_uword_equalities.p8:2991 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:2992 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:2994 goto skip10d - bra p8l_skip10d - ; source: test_uword_equalities.p8:2995 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:2996 skip10d: -p8l_skip10d - ; source: test_uword_equalities.p8:2998 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_360_afterif -+ - ; source: test_uword_equalities.p8:2999 success++ - inc p8b_main.p8v_success -label_asm_360_afterif - ; source: test_uword_equalities.p8:3002 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_362_else -+ - ; source: test_uword_equalities.p8:3003 success++ - inc p8b_main.p8v_success - bra label_asm_361_afterif -label_asm_362_else - ; source: test_uword_equalities.p8:3005 cx16.r0L++ - inc cx16.r0L -label_asm_361_afterif - ; source: test_uword_equalities.p8:3007 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_equalities.p8:3009 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl11a - cpy p8v_values+2+1 - bne p8l_lbl11a - ; source: test_uword_equalities.p8:3011 goto skip11a - bra p8l_skip11a - ; source: test_uword_equalities.p8:3012 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:3013 skip11a: -p8l_skip11a - ; source: test_uword_equalities.p8:3015 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:3016 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:3018 goto skip11b - bra p8l_skip11b - ; source: test_uword_equalities.p8:3019 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:3020 skip11b: -p8l_skip11b - ; source: test_uword_equalities.p8:3022 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_363_afterif -+ - ; source: test_uword_equalities.p8:3023 success++ - inc p8b_main.p8v_success -label_asm_363_afterif - ; source: test_uword_equalities.p8:3026 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_365_else -+ - ; source: test_uword_equalities.p8:3027 success++ - inc p8b_main.p8v_success - bra label_asm_364_afterif -label_asm_365_else - ; source: test_uword_equalities.p8:3029 cx16.r0L++ - inc cx16.r0L -label_asm_364_afterif - ; source: test_uword_equalities.p8:3032 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl11c - cpy p8v_sources+2+1 - bne p8l_lbl11c - ; source: test_uword_equalities.p8:3034 goto skip11c - bra p8l_skip11c - ; source: test_uword_equalities.p8:3035 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:3036 skip11c: -p8l_skip11c - ; source: test_uword_equalities.p8:3038 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:3039 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:3041 goto skip11d - bra p8l_skip11d - ; source: test_uword_equalities.p8:3042 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - ; source: test_uword_equalities.p8:3043 skip11d: -p8l_skip11d - ; source: test_uword_equalities.p8:3045 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_366_afterif -+ - ; source: test_uword_equalities.p8:3046 success++ - inc p8b_main.p8v_success -label_asm_366_afterif - ; source: test_uword_equalities.p8:3049 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_368_else -+ - ; source: test_uword_equalities.p8:3050 success++ - inc p8b_main.p8v_success - bra label_asm_367_afterif -label_asm_368_else - ; source: test_uword_equalities.p8:3052 cx16.r0L++ - inc cx16.r0L -label_asm_367_afterif - ; source: test_uword_equalities.p8:3054 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_equalities.p8:3056 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl12a - cpy p8v_values+2+1 - bne p8l_lbl12a - ; source: test_uword_equalities.p8:3058 goto skip12a - bra p8l_skip12a - ; source: test_uword_equalities.p8:3059 lbl12a: fail_uword(233,65535) -p8l_lbl12a - lda #<$e9 - ldy #>$e9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:3060 skip12a: -p8l_skip12a - ; source: test_uword_equalities.p8:3062 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:3063 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:3065 goto skip12b - bra p8l_skip12b - ; source: test_uword_equalities.p8:3066 lbl12b: fail_uword(234,65535) -p8l_lbl12b - lda #<$ea - ldy #>$ea - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:3067 skip12b: -p8l_skip12b - ; source: test_uword_equalities.p8:3069 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_369_afterif -+ - ; source: test_uword_equalities.p8:3070 fail_uword(235,65535) - lda #<$eb - ldy #>$eb - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_369_afterif - ; source: test_uword_equalities.p8:3073 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_371_else -+ - ; source: test_uword_equalities.p8:3074 fail_uword(236,65535) - lda #<$ec - ldy #>$ec - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_370_afterif -label_asm_371_else - ; source: test_uword_equalities.p8:3076 cx16.r0L++ - inc cx16.r0L -label_asm_370_afterif - ; source: test_uword_equalities.p8:3079 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl12c - cpy p8v_sources+2+1 - bne p8l_lbl12c - ; source: test_uword_equalities.p8:3081 goto skip12c - bra p8l_skip12c - ; source: test_uword_equalities.p8:3082 lbl12c: fail_uword(237,65535) -p8l_lbl12c - lda #<$ed - ldy #>$ed - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:3083 skip12c: -p8l_skip12c - ; source: test_uword_equalities.p8:3085 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_equalities.p8:3086 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_equalities.p8:3088 goto skip12d - bra p8l_skip12d - ; source: test_uword_equalities.p8:3089 lbl12d: fail_uword(238,65535) -p8l_lbl12d - lda #<$ee - ldy #>$ee - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_equalities.p8:3090 skip12d: -p8l_skip12d - ; source: test_uword_equalities.p8:3092 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_372_afterif -+ - ; source: test_uword_equalities.p8:3093 fail_uword(239,65535) - lda #<$ef - ldy #>$ef - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_372_afterif - ; source: test_uword_equalities.p8:3096 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_374_else -+ - ; source: test_uword_equalities.p8:3097 fail_uword(240,65535) - lda #<$f0 - ldy #>$f0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_373_afterif -label_asm_374_else - ; source: test_uword_equalities.p8:3099 cx16.r0L++ - inc cx16.r0L -label_asm_373_afterif - ; source: test_uword_equalities.p8:3101 verify_success(72) - lda #$48 - jmp p8b_main.p8s_verify_success - ; source: test_uword_equalities.p8:2524 sub test_not_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -p8v_sources .word $0000, $0000 -p8v_values .word $0000, $0000 - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $44, $41, $54, $41, $54, $59, $50, $45 - .byte $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[]: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[]: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 - - ; source: test_uword_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ; source: test_uword_equalities.p8:18 txt.print("==0: ") - ; source: test_uword_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_uword_equalities.p8:22 txt.print("\n==number: ") - ; source: test_uword_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_uword_equalities.p8:26 txt.print("\n==var: ") - ; source: test_uword_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_uword_equalities.p8:30 txt.print("\n==array[]: ") - ; source: test_uword_equalities.p8:32 txt.print("\n!=array[]: ") - ; source: test_uword_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_uword_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_uword_equalities.p8:45 txt.print(" **failed** ") - ; source: test_uword_equalities.p8:47 txt.print(" success, expected ") - ; source: test_uword_equalities.p8:53 txt.print(" **fail#") - ; source: test_uword_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_equalities.p8 b/compiler/test/comparisons/test_uword_equalities.p8 deleted file mode 100644 index 484a25250..000000000 --- a/compiler/test/comparisons/test_uword_equalities.p8 +++ /dev/null @@ -1,3105 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[]: ") - test_is_array() - txt.print("\n!=array[]: ") - test_not_array() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx, byte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_b(v1) - txt.print(" **") - } - - sub fail_ubyte(uword idx, ubyte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_ub(v1) - txt.print(" **") - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - sub fail_float(uword idx, float v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - floats.print(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - uword @shared x - success = 0 - - x=0 - ; direct jump - if x==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x==0 - success++ - - ; with else - if x==0 - success++ - else - cx16.r0L++ - - x = 9999 - ; direct jump - if x==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x==0 - success-- - - ; with else - if x==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - uword @shared x - success = 0 - - x=9999 - ; direct jump - if x!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x!=0 - success++ - - ; with else - if x!=0 - success++ - else - cx16.r0L++ - - x = 0 - ; direct jump - if x!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x!=0 - success-- - - ; with else - if x!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - uword @shared x - success = 0 - x=0 - ; direct jump - if x==1 - goto lbl1a - goto skip1a -lbl1a: fail_uword(1,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==1 - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(2,0) -skip1b: - ; no else - if x==1 - fail_uword(3,0) - - ; with else - if x==1 - fail_uword(4,0) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl2a - goto skip2a -lbl2a: fail_uword(5,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==30464 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(6,0) -skip2b: - ; no else - if x==30464 - fail_uword(7,0) - - ; with else - if x==30464 - fail_uword(8,0) - else - cx16.r0L++ - - ; direct jump - if x==65535 - goto lbl3a - goto skip3a -lbl3a: fail_uword(9,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==65535 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(10,0) -skip3b: - ; no else - if x==65535 - fail_uword(11,0) - - ; with else - if x==65535 - fail_uword(12,0) - else - cx16.r0L++ - - x=1 - ; direct jump - if x==1 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==1 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x==1 - success++ - - ; with else - if x==1 - success++ - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl5a - goto skip5a -lbl5a: fail_uword(13,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==30464 - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(14,1) -skip5b: - ; no else - if x==30464 - fail_uword(15,1) - - ; with else - if x==30464 - fail_uword(16,1) - else - cx16.r0L++ - - ; direct jump - if x==65535 - goto lbl6a - goto skip6a -lbl6a: fail_uword(17,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==65535 - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(18,1) -skip6b: - ; no else - if x==65535 - fail_uword(19,1) - - ; with else - if x==65535 - fail_uword(20,1) - else - cx16.r0L++ - - x=30464 - ; direct jump - if x==1 - goto lbl7a - goto skip7a -lbl7a: fail_uword(21,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==1 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(22,30464) -skip7b: - ; no else - if x==1 - fail_uword(23,30464) - - ; with else - if x==1 - fail_uword(24,30464) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==30464 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x==30464 - success++ - - ; with else - if x==30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x==65535 - goto lbl9a - goto skip9a -lbl9a: fail_uword(25,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==65535 - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(26,30464) -skip9b: - ; no else - if x==65535 - fail_uword(27,30464) - - ; with else - if x==65535 - fail_uword(28,30464) - else - cx16.r0L++ - - x=65535 - ; direct jump - if x==1 - goto lbl10a - goto skip10a -lbl10a: fail_uword(29,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==1 - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(30,65535) -skip10b: - ; no else - if x==1 - fail_uword(31,65535) - - ; with else - if x==1 - fail_uword(32,65535) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl11a - goto skip11a -lbl11a: fail_uword(33,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==30464 - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(34,65535) -skip11b: - ; no else - if x==30464 - fail_uword(35,65535) - - ; with else - if x==30464 - fail_uword(36,65535) - else - cx16.r0L++ - - ; direct jump - if x==65535 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==65535 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x==65535 - success++ - - ; with else - if x==65535 - success++ - else - cx16.r0L++ - - verify_success(12) -} - sub test_not_number() { - uword @shared x - success = 0 - x=0 - ; direct jump - if x!=1 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=1 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=1 - success++ - - ; with else - if x!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=30464 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=65535 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=65535 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=65535 - success++ - - ; with else - if x!=65535 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x!=1 - goto lbl4a - goto skip4a -lbl4a: fail_uword(37,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=1 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(38,1) -skip4b: - ; no else - if x!=1 - fail_uword(39,1) - - ; with else - if x!=1 - fail_uword(40,1) - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=30464 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=65535 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=65535 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=65535 - success++ - - ; with else - if x!=65535 - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x!=1 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=1 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=1 - success++ - - ; with else - if x!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl8a - goto skip8a -lbl8a: fail_uword(41,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=30464 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(42,30464) -skip8b: - ; no else - if x!=30464 - fail_uword(43,30464) - - ; with else - if x!=30464 - fail_uword(44,30464) - else - cx16.r0L++ - - ; direct jump - if x!=65535 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=65535 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=65535 - success++ - - ; with else - if x!=65535 - success++ - else - cx16.r0L++ - - x=65535 - ; direct jump - if x!=1 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=1 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x!=1 - success++ - - ; with else - if x!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=30464 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=65535 - goto lbl12a - goto skip12a -lbl12a: fail_uword(45,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=65535 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(46,65535) -skip12b: - ; no else - if x!=65535 - fail_uword(47,65535) - - ; with else - if x!=65535 - fail_uword(48,65535) - else - cx16.r0L++ - - verify_success(36) -} - sub test_is_var() { - uword @shared x, value - success = 0 - x=0 - value=1 - ; direct jump - if x==value - goto lbl1a - goto skip1a -lbl1a: fail_uword(49,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==value - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(50,0) -skip1b: - ; no else - if x==value - fail_uword(51,0) - - ; with else - if x==value - fail_uword(52,0) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl2a - goto skip2a -lbl2a: fail_uword(53,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==value - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(54,0) -skip2b: - ; no else - if x==value - fail_uword(55,0) - - ; with else - if x==value - fail_uword(56,0) - else - cx16.r0L++ - - value=65535 - ; direct jump - if x==value - goto lbl3a - goto skip3a -lbl3a: fail_uword(57,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==value - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(58,0) -skip3b: - ; no else - if x==value - fail_uword(59,0) - - ; with else - if x==value - fail_uword(60,0) - else - cx16.r0L++ - - x=1 - value=1 - ; direct jump - if x==value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl5a - goto skip5a -lbl5a: fail_uword(61,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==value - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(62,1) -skip5b: - ; no else - if x==value - fail_uword(63,1) - - ; with else - if x==value - fail_uword(64,1) - else - cx16.r0L++ - - value=65535 - ; direct jump - if x==value - goto lbl6a - goto skip6a -lbl6a: fail_uword(65,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==value - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(66,1) -skip6b: - ; no else - if x==value - fail_uword(67,1) - - ; with else - if x==value - fail_uword(68,1) - else - cx16.r0L++ - - x=30464 - value=1 - ; direct jump - if x==value - goto lbl7a - goto skip7a -lbl7a: fail_uword(69,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==value - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(70,30464) -skip7b: - ; no else - if x==value - fail_uword(71,30464) - - ; with else - if x==value - fail_uword(72,30464) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x==value - goto lbl9a - goto skip9a -lbl9a: fail_uword(73,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==value - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(74,30464) -skip9b: - ; no else - if x==value - fail_uword(75,30464) - - ; with else - if x==value - fail_uword(76,30464) - else - cx16.r0L++ - - x=65535 - value=1 - ; direct jump - if x==value - goto lbl10a - goto skip10a -lbl10a: fail_uword(77,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==value - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(78,65535) -skip10b: - ; no else - if x==value - fail_uword(79,65535) - - ; with else - if x==value - fail_uword(80,65535) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl11a - goto skip11a -lbl11a: fail_uword(81,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==value - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(82,65535) -skip11b: - ; no else - if x==value - fail_uword(83,65535) - - ; with else - if x==value - fail_uword(84,65535) - else - cx16.r0L++ - - value=65535 - ; direct jump - if x==value - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==value - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - verify_success(12) -} - sub test_not_var() { - uword @shared x, value - success = 0 - x=0 - value=1 - ; direct jump - if x!=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x!=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=1 - value=1 - ; direct jump - if x!=value - goto lbl4a - goto skip4a -lbl4a: fail_uword(85,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=value - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(86,1) -skip4b: - ; no else - if x!=value - fail_uword(87,1) - - ; with else - if x!=value - fail_uword(88,1) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x!=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=30464 - value=1 - ; direct jump - if x!=value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl8a - goto skip8a -lbl8a: fail_uword(89,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=value - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(90,30464) -skip8b: - ; no else - if x!=value - fail_uword(91,30464) - - ; with else - if x!=value - fail_uword(92,30464) - else - cx16.r0L++ - - value=65535 - ; direct jump - if x!=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=65535 - value=1 - ; direct jump - if x!=value - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=value - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=value - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x!=value - goto lbl12a - goto skip12a -lbl12a: fail_uword(93,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=value - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(94,65535) -skip12b: - ; no else - if x!=value - fail_uword(95,65535) - - ; with else - if x!=value - fail_uword(96,65535) - else - cx16.r0L++ - - verify_success(36) -} - sub test_is_expr() { - uword @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x==cx16.r4+1-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: fail_uword(97,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(98,0) -skip1b: - ; no else - if x==cx16.r4+1-cx16.r5 - fail_uword(99,0) - - ; with else - if x==cx16.r4+1-cx16.r5 - fail_uword(100,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+30464-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: fail_uword(101,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(102,0) -skip2b: - ; no else - if x==cx16.r4+30464-cx16.r5 - fail_uword(103,0) - - ; with else - if x==cx16.r4+30464-cx16.r5 - fail_uword(104,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+65535-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: fail_uword(105,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(106,0) -skip3b: - ; no else - if x==cx16.r4+65535-cx16.r5 - fail_uword(107,0) - - ; with else - if x==cx16.r4+65535-cx16.r5 - fail_uword(108,0) - else - cx16.r0L++ - - x=1 - ; direct jump - if x==cx16.r4+1-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x==cx16.r4+1-cx16.r5 - success++ - - ; with else - if x==cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+30464-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: fail_uword(109,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(110,1) -skip5b: - ; no else - if x==cx16.r4+30464-cx16.r5 - fail_uword(111,1) - - ; with else - if x==cx16.r4+30464-cx16.r5 - fail_uword(112,1) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+65535-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: fail_uword(113,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(114,1) -skip6b: - ; no else - if x==cx16.r4+65535-cx16.r5 - fail_uword(115,1) - - ; with else - if x==cx16.r4+65535-cx16.r5 - fail_uword(116,1) - else - cx16.r0L++ - - x=30464 - ; direct jump - if x==cx16.r4+1-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: fail_uword(117,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(118,30464) -skip7b: - ; no else - if x==cx16.r4+1-cx16.r5 - fail_uword(119,30464) - - ; with else - if x==cx16.r4+1-cx16.r5 - fail_uword(120,30464) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+30464-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x==cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x==cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+65535-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: fail_uword(121,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(122,30464) -skip9b: - ; no else - if x==cx16.r4+65535-cx16.r5 - fail_uword(123,30464) - - ; with else - if x==cx16.r4+65535-cx16.r5 - fail_uword(124,30464) - else - cx16.r0L++ - - x=65535 - ; direct jump - if x==cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: fail_uword(125,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(126,65535) -skip10b: - ; no else - if x==cx16.r4+1-cx16.r5 - fail_uword(127,65535) - - ; with else - if x==cx16.r4+1-cx16.r5 - fail_uword(128,65535) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: fail_uword(129,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(130,65535) -skip11b: - ; no else - if x==cx16.r4+30464-cx16.r5 - fail_uword(131,65535) - - ; with else - if x==cx16.r4+30464-cx16.r5 - fail_uword(132,65535) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x==cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x==cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - verify_success(12) -} - sub test_not_expr() { - uword @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x!=cx16.r4+1-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+30464-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+65535-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x!=cx16.r4+1-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: fail_uword(133,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(134,1) -skip4b: - ; no else - if x!=cx16.r4+1-cx16.r5 - fail_uword(135,1) - - ; with else - if x!=cx16.r4+1-cx16.r5 - fail_uword(136,1) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+30464-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+65535-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x!=cx16.r4+1-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+30464-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: fail_uword(137,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(138,30464) -skip8b: - ; no else - if x!=cx16.r4+30464-cx16.r5 - fail_uword(139,30464) - - ; with else - if x!=cx16.r4+30464-cx16.r5 - fail_uword(140,30464) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+65535-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - x=65535 - ; direct jump - if x!=cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x!=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x!=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: fail_uword(141,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(142,65535) -skip12b: - ; no else - if x!=cx16.r4+65535-cx16.r5 - fail_uword(143,65535) - - ; with else - if x!=cx16.r4+65535-cx16.r5 - fail_uword(144,65535) - else - cx16.r0L++ - - verify_success(36) -} - sub test_is_array() { - uword @shared x - uword[] values = [0, 0] - uword[] sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl1a - goto skip1a -lbl1a: fail_uword(145,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(146,0) -skip1b: - ; no else - if x==values[1] - fail_uword(147,0) - - ; with else - if x==values[1] - fail_uword(148,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: fail_uword(149,0) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_uword(150,0) -skip1d: - ; no else - if sources[1]==values[1] - fail_uword(151,0) - - ; with else - if sources[1]==values[1] - fail_uword(152,0) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(153,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(154,0) -skip2b: - ; no else - if x==values[1] - fail_uword(155,0) - - ; with else - if x==values[1] - fail_uword(156,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: fail_uword(157,0) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_uword(158,0) -skip2d: - ; no else - if sources[1]==values[1] - fail_uword(159,0) - - ; with else - if sources[1]==values[1] - fail_uword(160,0) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(161,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(162,0) -skip3b: - ; no else - if x==values[1] - fail_uword(163,0) - - ; with else - if x==values[1] - fail_uword(164,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl3c - goto skip3c -lbl3c: fail_uword(165,0) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]==values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_uword(166,0) -skip3d: - ; no else - if sources[1]==values[1] - fail_uword(167,0) - - ; with else - if sources[1]==values[1] - fail_uword(168,0) - else - cx16.r0L++ - - x=1 - sources[1]=1 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]==values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_uword(169,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(170,1) -skip5b: - ; no else - if x==values[1] - fail_uword(171,1) - - ; with else - if x==values[1] - fail_uword(172,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl5c - goto skip5c -lbl5c: fail_uword(173,1) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]==values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_uword(174,1) -skip5d: - ; no else - if sources[1]==values[1] - fail_uword(175,1) - - ; with else - if sources[1]==values[1] - fail_uword(176,1) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x==values[1] - goto lbl6a - goto skip6a -lbl6a: fail_uword(177,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(178,1) -skip6b: - ; no else - if x==values[1] - fail_uword(179,1) - - ; with else - if x==values[1] - fail_uword(180,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl6c - goto skip6c -lbl6c: fail_uword(181,1) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]==values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_uword(182,1) -skip6d: - ; no else - if sources[1]==values[1] - fail_uword(183,1) - - ; with else - if sources[1]==values[1] - fail_uword(184,1) - else - cx16.r0L++ - - x=30464 - sources[1]=30464 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(185,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(186,30464) -skip7b: - ; no else - if x==values[1] - fail_uword(187,30464) - - ; with else - if x==values[1] - fail_uword(188,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl7c - goto skip7c -lbl7c: fail_uword(189,30464) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]==values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_uword(190,30464) -skip7d: - ; no else - if sources[1]==values[1] - fail_uword(191,30464) - - ; with else - if sources[1]==values[1] - fail_uword(192,30464) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]==values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x==values[1] - goto lbl9a - goto skip9a -lbl9a: fail_uword(193,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(194,30464) -skip9b: - ; no else - if x==values[1] - fail_uword(195,30464) - - ; with else - if x==values[1] - fail_uword(196,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl9c - goto skip9c -lbl9c: fail_uword(197,30464) -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]==values[1] - goto cx16.r3 - goto skip9d -lbl9d: fail_uword(198,30464) -skip9d: - ; no else - if sources[1]==values[1] - fail_uword(199,30464) - - ; with else - if sources[1]==values[1] - fail_uword(200,30464) - else - cx16.r0L++ - - x=65535 - sources[1]=65535 - values[1]=1 - ; direct jump - if x==values[1] - goto lbl10a - goto skip10a -lbl10a: fail_uword(201,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(202,65535) -skip10b: - ; no else - if x==values[1] - fail_uword(203,65535) - - ; with else - if x==values[1] - fail_uword(204,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl10c - goto skip10c -lbl10c: fail_uword(205,65535) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]==values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_uword(206,65535) -skip10d: - ; no else - if sources[1]==values[1] - fail_uword(207,65535) - - ; with else - if sources[1]==values[1] - fail_uword(208,65535) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl11a - goto skip11a -lbl11a: fail_uword(209,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(210,65535) -skip11b: - ; no else - if x==values[1] - fail_uword(211,65535) - - ; with else - if x==values[1] - fail_uword(212,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl11c - goto skip11c -lbl11c: fail_uword(213,65535) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]==values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_uword(214,65535) -skip11d: - ; no else - if sources[1]==values[1] - fail_uword(215,65535) - - ; with else - if sources[1]==values[1] - fail_uword(216,65535) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x==values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl12c - goto skip12c -lbl12c: success++ -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]==values[1] - goto cx16.r3 - goto skip12d -lbl12d: success++ -skip12d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(24) -} - sub test_not_array() { - uword @shared x - uword[] values = [0, 0] - uword[] sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]!=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=1 - sources[1]=1 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(217,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(218,1) -skip4b: - ; no else - if x!=values[1] - fail_uword(219,1) - - ; with else - if x!=values[1] - fail_uword(220,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl4c - goto skip4c -lbl4c: fail_uword(221,1) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]!=values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_uword(222,1) -skip4d: - ; no else - if sources[1]!=values[1] - fail_uword(223,1) - - ; with else - if sources[1]!=values[1] - fail_uword(224,1) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]!=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x!=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]!=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=30464 - sources[1]=30464 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl7c - goto skip7c -lbl7c: success++ -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]!=values[1] - goto cx16.r3 - goto skip7d -lbl7d: success++ -skip7d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(225,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(226,30464) -skip8b: - ; no else - if x!=values[1] - fail_uword(227,30464) - - ; with else - if x!=values[1] - fail_uword(228,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl8c - goto skip8c -lbl8c: fail_uword(229,30464) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]!=values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_uword(230,30464) -skip8d: - ; no else - if sources[1]!=values[1] - fail_uword(231,30464) - - ; with else - if sources[1]!=values[1] - fail_uword(232,30464) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x!=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]!=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=65535 - sources[1]=65535 - values[1]=1 - ; direct jump - if x!=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]!=values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]!=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x!=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(233,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(234,65535) -skip12b: - ; no else - if x!=values[1] - fail_uword(235,65535) - - ; with else - if x!=values[1] - fail_uword(236,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl12c - goto skip12c -lbl12c: fail_uword(237,65535) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]!=values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_uword(238,65535) -skip12d: - ; no else - if sources[1]!=values[1] - fail_uword(239,65535) - - ; with else - if sources[1]!=values[1] - fail_uword(240,65535) - else - cx16.r0L++ - - verify_success(72) -} - -} - diff --git a/compiler/test/comparisons/test_uword_gt.asm b/compiler/test/comparisons/test_uword_gt.asm deleted file mode 100644 index 565844d9c..000000000 --- a/compiler/test/comparisons/test_uword_gt.asm +++ /dev/null @@ -1,12403 +0,0 @@ -; w65c02 assembly code for 'test_uword_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:43 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_gt.p8:9 ubyte success = 0 - ; source: test_uword_gt.p8:10 str datatype = "uword" - ; source: test_uword_gt.p8:11 uword @shared comparison - ; source: test_uword_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_gt.p8:14 txt.print("\ngreater-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #number: ") - ldy #>prog8_interned_strings.string_2 - lda #var: ") - ldy #>prog8_interned_strings.string_3 - lda #array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #0 - lda p8v_x - ora p8v_x+1 - bne p8l_lbl1a - ; source: test_uword_gt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_uword_gt.p8:79 lbl1a: fail_uword(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:80 skip1a: -p8l_skip1a - ; source: test_uword_gt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:83 if x>0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_uword_gt.p8:86 lbl1b: fail_uword(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:87 skip1b: -p8l_skip1b - ; source: test_uword_gt.p8:89 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_3_afterif - ; source: test_uword_gt.p8:90 fail_uword(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_3_afterif - ; source: test_uword_gt.p8:93 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_5_else - ; source: test_uword_gt.p8:94 fail_uword(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_gt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_uword_gt.p8:99 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc p8l_lbl2a - bne + - cmp p8v_x - bcc p8l_lbl2a -+ - ; source: test_uword_gt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_uword_gt.p8:102 lbl2a: fail_uword(5) -p8l_lbl2a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:103 skip2a: -p8l_skip2a - ; source: test_uword_gt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:106 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_uword_gt.p8:109 lbl2b: fail_uword(6) -p8l_lbl2b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:110 skip2b: -p8l_skip2b - ; source: test_uword_gt.p8:112 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_6_afterif - ; source: test_uword_gt.p8:113 fail_uword(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_6_afterif - ; source: test_uword_gt.p8:116 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_8_else - ; source: test_uword_gt.p8:117 fail_uword(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_gt.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_uword_gt.p8:122 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc p8l_lbl3a - bne + - cmp p8v_x - bcc p8l_lbl3a -+ - ; source: test_uword_gt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_uword_gt.p8:125 lbl3a: fail_uword(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:126 skip3a: -p8l_skip3a - ; source: test_uword_gt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:129 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_uword_gt.p8:132 lbl3b: fail_uword(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:133 skip3b: -p8l_skip3b - ; source: test_uword_gt.p8:135 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_9_afterif - ; source: test_uword_gt.p8:136 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_9_afterif - ; source: test_uword_gt.p8:139 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_11_else - ; source: test_uword_gt.p8:140 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_gt.p8:142 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_uword_gt.p8:145 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc p8l_lbl4a - bne + - cmp p8v_x - bcc p8l_lbl4a -+ - ; source: test_uword_gt.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_uword_gt.p8:148 lbl4a: fail_uword(13) -p8l_lbl4a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:149 skip4a: -p8l_skip4a - ; source: test_uword_gt.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:152 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_uword_gt.p8:155 lbl4b: fail_uword(14) -p8l_lbl4b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:156 skip4b: -p8l_skip4b - ; source: test_uword_gt.p8:158 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_12_afterif - ; source: test_uword_gt.p8:159 fail_uword(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_12_afterif - ; source: test_uword_gt.p8:162 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_14_else - ; source: test_uword_gt.p8:163 fail_uword(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_gt.p8:165 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_uword_gt.p8:167 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:169 if x>0 - ora p8v_x+1 - bne p8l_lbl5a - ; source: test_uword_gt.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_uword_gt.p8:172 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:173 skip5a: -p8l_skip5a - ; source: test_uword_gt.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:176 if x>0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_uword_gt.p8:179 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:180 skip5b: -p8l_skip5b - ; source: test_uword_gt.p8:182 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_15_afterif - ; source: test_uword_gt.p8:183 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_uword_gt.p8:186 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_17_else - ; source: test_uword_gt.p8:187 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_gt.p8:189 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_uword_gt.p8:192 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc p8l_lbl6a - bne + - cmp p8v_x - bcc p8l_lbl6a -+ - ; source: test_uword_gt.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_uword_gt.p8:195 lbl6a: fail_uword(17) -p8l_lbl6a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:196 skip6a: -p8l_skip6a - ; source: test_uword_gt.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:199 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_uword_gt.p8:202 lbl6b: fail_uword(18) -p8l_lbl6b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:203 skip6b: -p8l_skip6b - ; source: test_uword_gt.p8:205 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_18_afterif - ; source: test_uword_gt.p8:206 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_18_afterif - ; source: test_uword_gt.p8:209 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_20_else - ; source: test_uword_gt.p8:210 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_gt.p8:212 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_uword_gt.p8:215 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc p8l_lbl7a - bne + - cmp p8v_x - bcc p8l_lbl7a -+ - ; source: test_uword_gt.p8:217 goto skip7a - bra p8l_skip7a - ; source: test_uword_gt.p8:218 lbl7a: fail_uword(21) -p8l_lbl7a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:219 skip7a: -p8l_skip7a - ; source: test_uword_gt.p8:221 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:222 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:224 goto skip7b - bra p8l_skip7b - ; source: test_uword_gt.p8:225 lbl7b: fail_uword(22) -p8l_lbl7b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:226 skip7b: -p8l_skip7b - ; source: test_uword_gt.p8:228 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_21_afterif - ; source: test_uword_gt.p8:229 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_21_afterif - ; source: test_uword_gt.p8:232 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_23_else - ; source: test_uword_gt.p8:233 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_gt.p8:235 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_uword_gt.p8:238 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc p8l_lbl8a - bne + - cmp p8v_x - bcc p8l_lbl8a -+ - ; source: test_uword_gt.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_uword_gt.p8:241 lbl8a: fail_uword(25) -p8l_lbl8a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:242 skip8a: -p8l_skip8a - ; source: test_uword_gt.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:245 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_uword_gt.p8:248 lbl8b: fail_uword(26) -p8l_lbl8b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:249 skip8b: -p8l_skip8b - ; source: test_uword_gt.p8:251 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_24_afterif - ; source: test_uword_gt.p8:252 fail_uword(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_24_afterif - ; source: test_uword_gt.p8:255 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_26_else - ; source: test_uword_gt.p8:256 fail_uword(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_gt.p8:258 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_uword_gt.p8:260 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:262 if x>0 - ora p8v_x+1 - bne p8l_lbl9a - ; source: test_uword_gt.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_uword_gt.p8:265 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:266 skip9a: -p8l_skip9a - ; source: test_uword_gt.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:269 if x>0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_uword_gt.p8:272 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:273 skip9b: -p8l_skip9b - ; source: test_uword_gt.p8:275 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_27_afterif - ; source: test_uword_gt.p8:276 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_uword_gt.p8:279 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_29_else - ; source: test_uword_gt.p8:280 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_gt.p8:282 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_uword_gt.p8:285 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc p8l_lbl10a - bne + - cmp p8v_x - bcc p8l_lbl10a -+ - ; source: test_uword_gt.p8:287 goto skip10a - bra p8l_skip10a - ; source: test_uword_gt.p8:288 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:289 skip10a: -p8l_skip10a - ; source: test_uword_gt.p8:291 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:292 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:294 goto skip10b - bra p8l_skip10b - ; source: test_uword_gt.p8:295 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:296 skip10b: -p8l_skip10b - ; source: test_uword_gt.p8:298 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_30_afterif - ; source: test_uword_gt.p8:299 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_uword_gt.p8:302 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_32_else - ; source: test_uword_gt.p8:303 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_gt.p8:305 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_uword_gt.p8:308 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc p8l_lbl11a - bne + - cmp p8v_x - bcc p8l_lbl11a -+ - ; source: test_uword_gt.p8:310 goto skip11a - bra p8l_skip11a - ; source: test_uword_gt.p8:311 lbl11a: fail_uword(29) -p8l_lbl11a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:312 skip11a: -p8l_skip11a - ; source: test_uword_gt.p8:314 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:315 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:317 goto skip11b - bra p8l_skip11b - ; source: test_uword_gt.p8:318 lbl11b: fail_uword(30) -p8l_lbl11b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:319 skip11b: -p8l_skip11b - ; source: test_uword_gt.p8:321 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_33_afterif - ; source: test_uword_gt.p8:322 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_33_afterif - ; source: test_uword_gt.p8:325 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_35_else - ; source: test_uword_gt.p8:326 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_gt.p8:328 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_uword_gt.p8:331 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc p8l_lbl12a - bne + - cmp p8v_x - bcc p8l_lbl12a -+ - ; source: test_uword_gt.p8:333 goto skip12a - bra p8l_skip12a - ; source: test_uword_gt.p8:334 lbl12a: fail_uword(33) -p8l_lbl12a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:335 skip12a: -p8l_skip12a - ; source: test_uword_gt.p8:337 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:338 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:340 goto skip12b - bra p8l_skip12b - ; source: test_uword_gt.p8:341 lbl12b: fail_uword(34) -p8l_lbl12b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:342 skip12b: -p8l_skip12b - ; source: test_uword_gt.p8:344 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_36_afterif - ; source: test_uword_gt.p8:345 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_36_afterif - ; source: test_uword_gt.p8:348 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_38_else - ; source: test_uword_gt.p8:349 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_gt.p8:351 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_uword_gt.p8:353 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gt.p8:355 if x>0 - ora p8v_x+1 - bne p8l_lbl13a - ; source: test_uword_gt.p8:357 goto skip13a - bra p8l_skip13a - ; source: test_uword_gt.p8:358 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:359 skip13a: -p8l_skip13a - ; source: test_uword_gt.p8:361 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:362 if x>0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:364 goto skip13b - bra p8l_skip13b - ; source: test_uword_gt.p8:365 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:366 skip13b: -p8l_skip13b - ; source: test_uword_gt.p8:368 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_39_afterif - ; source: test_uword_gt.p8:369 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_uword_gt.p8:372 if x>0 - lda p8v_x - ora p8v_x+1 - beq label_asm_41_else - ; source: test_uword_gt.p8:373 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_gt.p8:375 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_uword_gt.p8:378 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc p8l_lbl14a - bne + - cmp p8v_x - bcc p8l_lbl14a -+ - ; source: test_uword_gt.p8:380 goto skip14a - bra p8l_skip14a - ; source: test_uword_gt.p8:381 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:382 skip14a: -p8l_skip14a - ; source: test_uword_gt.p8:384 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:385 if x>1 - ldy #>1 - lda #<1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:387 goto skip14b - bra p8l_skip14b - ; source: test_uword_gt.p8:388 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:389 skip14b: -p8l_skip14b - ; source: test_uword_gt.p8:391 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_42_afterif - ; source: test_uword_gt.p8:392 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_uword_gt.p8:395 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_44_else - ; source: test_uword_gt.p8:396 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_gt.p8:398 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_uword_gt.p8:401 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc p8l_lbl15a - bne + - cmp p8v_x - bcc p8l_lbl15a -+ - ; source: test_uword_gt.p8:403 goto skip15a - bra p8l_skip15a - ; source: test_uword_gt.p8:404 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:405 skip15a: -p8l_skip15a - ; source: test_uword_gt.p8:407 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:408 if x>30464 - ldy #>$7700 - lda #<$7700 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:410 goto skip15b - bra p8l_skip15b - ; source: test_uword_gt.p8:411 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:412 skip15b: -p8l_skip15b - ; source: test_uword_gt.p8:414 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_45_afterif - ; source: test_uword_gt.p8:415 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_uword_gt.p8:418 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_47_else - ; source: test_uword_gt.p8:419 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_gt.p8:421 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_uword_gt.p8:424 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc p8l_lbl16a - bne + - cmp p8v_x - bcc p8l_lbl16a -+ - ; source: test_uword_gt.p8:426 goto skip16a - bra p8l_skip16a - ; source: test_uword_gt.p8:427 lbl16a: fail_uword(37) -p8l_lbl16a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:428 skip16a: -p8l_skip16a - ; source: test_uword_gt.p8:430 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:431 if x>65535 - ldy #>$ffff - lda #<$ffff - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:433 goto skip16b - bra p8l_skip16b - ; source: test_uword_gt.p8:434 lbl16b: fail_uword(38) -p8l_lbl16b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:435 skip16b: -p8l_skip16b - ; source: test_uword_gt.p8:437 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_48_afterif - ; source: test_uword_gt.p8:438 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_48_afterif - ; source: test_uword_gt.p8:441 if x>65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_50_else - ; source: test_uword_gt.p8:442 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_gt.p8:444 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_uword_gt.p8:446 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_gt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_gt.p8:448 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_uword_gt.p8:449 uword @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_uword_gt.p8:450 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_gt.p8:451 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gt.p8:452 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gt.p8:454 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl1a - bne + - cmp p8v_x - bcc p8l_lbl1a -+ - ; source: test_uword_gt.p8:456 goto skip1a - bra p8l_skip1a - ; source: test_uword_gt.p8:457 lbl1a: fail_uword(41) -p8l_lbl1a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:458 skip1a: -p8l_skip1a - ; source: test_uword_gt.p8:460 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:461 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:463 goto skip1b - bra p8l_skip1b - ; source: test_uword_gt.p8:464 lbl1b: fail_uword(42) -p8l_lbl1b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:465 skip1b: -p8l_skip1b - ; source: test_uword_gt.p8:467 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_51_afterif - ; source: test_uword_gt.p8:468 fail_uword(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_51_afterif - ; source: test_uword_gt.p8:471 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_53_else - ; source: test_uword_gt.p8:472 fail_uword(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_gt.p8:474 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_uword_gt.p8:476 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:478 if x>value - cpy p8v_x+1 - bcc p8l_lbl2a - bne + - cmp p8v_x - bcc p8l_lbl2a -+ - ; source: test_uword_gt.p8:480 goto skip2a - bra p8l_skip2a - ; source: test_uword_gt.p8:481 lbl2a: fail_uword(45) -p8l_lbl2a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:482 skip2a: -p8l_skip2a - ; source: test_uword_gt.p8:484 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:485 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:487 goto skip2b - bra p8l_skip2b - ; source: test_uword_gt.p8:488 lbl2b: fail_uword(46) -p8l_lbl2b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:489 skip2b: -p8l_skip2b - ; source: test_uword_gt.p8:491 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_54_afterif - ; source: test_uword_gt.p8:492 fail_uword(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_54_afterif - ; source: test_uword_gt.p8:495 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_56_else - ; source: test_uword_gt.p8:496 fail_uword(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_gt.p8:498 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_uword_gt.p8:500 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:502 if x>value - cpy p8v_x+1 - bcc p8l_lbl3a - bne + - cmp p8v_x - bcc p8l_lbl3a -+ - ; source: test_uword_gt.p8:504 goto skip3a - bra p8l_skip3a - ; source: test_uword_gt.p8:505 lbl3a: fail_uword(49) -p8l_lbl3a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:506 skip3a: -p8l_skip3a - ; source: test_uword_gt.p8:508 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:509 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:511 goto skip3b - bra p8l_skip3b - ; source: test_uword_gt.p8:512 lbl3b: fail_uword(50) -p8l_lbl3b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:513 skip3b: -p8l_skip3b - ; source: test_uword_gt.p8:515 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_57_afterif - ; source: test_uword_gt.p8:516 fail_uword(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_uword -label_asm_57_afterif - ; source: test_uword_gt.p8:519 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_59_else - ; source: test_uword_gt.p8:520 fail_uword(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_uword - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_gt.p8:522 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_uword_gt.p8:524 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gt.p8:526 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl4a - bne + - cmp p8v_x - bcc p8l_lbl4a -+ - ; source: test_uword_gt.p8:528 goto skip4a - bra p8l_skip4a - ; source: test_uword_gt.p8:529 lbl4a: fail_uword(53) -p8l_lbl4a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:530 skip4a: -p8l_skip4a - ; source: test_uword_gt.p8:532 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:533 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:535 goto skip4b - bra p8l_skip4b - ; source: test_uword_gt.p8:536 lbl4b: fail_uword(54) -p8l_lbl4b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:537 skip4b: -p8l_skip4b - ; source: test_uword_gt.p8:539 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_60_afterif - ; source: test_uword_gt.p8:540 fail_uword(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_uword -label_asm_60_afterif - ; source: test_uword_gt.p8:543 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_62_else - ; source: test_uword_gt.p8:544 fail_uword(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_uword - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_gt.p8:546 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_uword_gt.p8:548 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:549 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gt.p8:551 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl5a - bne + - cmp p8v_x - bcc p8l_lbl5a -+ - ; source: test_uword_gt.p8:553 goto skip5a - bra p8l_skip5a - ; source: test_uword_gt.p8:554 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:555 skip5a: -p8l_skip5a - ; source: test_uword_gt.p8:557 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:558 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:560 goto skip5b - bra p8l_skip5b - ; source: test_uword_gt.p8:561 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:562 skip5b: -p8l_skip5b - ; source: test_uword_gt.p8:564 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_63_afterif - ; source: test_uword_gt.p8:565 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_uword_gt.p8:568 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_65_else - ; source: test_uword_gt.p8:569 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_gt.p8:571 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_uword_gt.p8:573 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:575 if x>value - cpy p8v_x+1 - bcc p8l_lbl6a - bne + - cmp p8v_x - bcc p8l_lbl6a -+ - ; source: test_uword_gt.p8:577 goto skip6a - bra p8l_skip6a - ; source: test_uword_gt.p8:578 lbl6a: fail_uword(57) -p8l_lbl6a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:579 skip6a: -p8l_skip6a - ; source: test_uword_gt.p8:581 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:582 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:584 goto skip6b - bra p8l_skip6b - ; source: test_uword_gt.p8:585 lbl6b: fail_uword(58) -p8l_lbl6b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:586 skip6b: -p8l_skip6b - ; source: test_uword_gt.p8:588 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_66_afterif - ; source: test_uword_gt.p8:589 fail_uword(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_uword -label_asm_66_afterif - ; source: test_uword_gt.p8:592 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_68_else - ; source: test_uword_gt.p8:593 fail_uword(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_uword - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_gt.p8:595 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_uword_gt.p8:597 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:599 if x>value - cpy p8v_x+1 - bcc p8l_lbl7a - bne + - cmp p8v_x - bcc p8l_lbl7a -+ - ; source: test_uword_gt.p8:601 goto skip7a - bra p8l_skip7a - ; source: test_uword_gt.p8:602 lbl7a: fail_uword(61) -p8l_lbl7a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:603 skip7a: -p8l_skip7a - ; source: test_uword_gt.p8:605 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:606 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:608 goto skip7b - bra p8l_skip7b - ; source: test_uword_gt.p8:609 lbl7b: fail_uword(62) -p8l_lbl7b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:610 skip7b: -p8l_skip7b - ; source: test_uword_gt.p8:612 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_69_afterif - ; source: test_uword_gt.p8:613 fail_uword(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_uword -label_asm_69_afterif - ; source: test_uword_gt.p8:616 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_71_else - ; source: test_uword_gt.p8:617 fail_uword(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_uword - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_gt.p8:619 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_uword_gt.p8:621 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gt.p8:623 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl8a - bne + - cmp p8v_x - bcc p8l_lbl8a -+ - ; source: test_uword_gt.p8:625 goto skip8a - bra p8l_skip8a - ; source: test_uword_gt.p8:626 lbl8a: fail_uword(65) -p8l_lbl8a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:627 skip8a: -p8l_skip8a - ; source: test_uword_gt.p8:629 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:630 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:632 goto skip8b - bra p8l_skip8b - ; source: test_uword_gt.p8:633 lbl8b: fail_uword(66) -p8l_lbl8b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:634 skip8b: -p8l_skip8b - ; source: test_uword_gt.p8:636 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_72_afterif - ; source: test_uword_gt.p8:637 fail_uword(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_uword -label_asm_72_afterif - ; source: test_uword_gt.p8:640 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_74_else - ; source: test_uword_gt.p8:641 fail_uword(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_uword - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_gt.p8:643 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_uword_gt.p8:645 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:646 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gt.p8:648 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl9a - bne + - cmp p8v_x - bcc p8l_lbl9a -+ - ; source: test_uword_gt.p8:650 goto skip9a - bra p8l_skip9a - ; source: test_uword_gt.p8:651 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:652 skip9a: -p8l_skip9a - ; source: test_uword_gt.p8:654 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:655 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:657 goto skip9b - bra p8l_skip9b - ; source: test_uword_gt.p8:658 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:659 skip9b: -p8l_skip9b - ; source: test_uword_gt.p8:661 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_75_afterif - ; source: test_uword_gt.p8:662 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_uword_gt.p8:665 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_77_else - ; source: test_uword_gt.p8:666 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_gt.p8:668 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_uword_gt.p8:670 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:672 if x>value - cpy p8v_x+1 - bcc p8l_lbl10a - bne + - cmp p8v_x - bcc p8l_lbl10a -+ - ; source: test_uword_gt.p8:674 goto skip10a - bra p8l_skip10a - ; source: test_uword_gt.p8:675 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:676 skip10a: -p8l_skip10a - ; source: test_uword_gt.p8:678 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:679 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:681 goto skip10b - bra p8l_skip10b - ; source: test_uword_gt.p8:682 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:683 skip10b: -p8l_skip10b - ; source: test_uword_gt.p8:685 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_78_afterif - ; source: test_uword_gt.p8:686 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_uword_gt.p8:689 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_80_else - ; source: test_uword_gt.p8:690 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_gt.p8:692 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_uword_gt.p8:694 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:696 if x>value - cpy p8v_x+1 - bcc p8l_lbl11a - bne + - cmp p8v_x - bcc p8l_lbl11a -+ - ; source: test_uword_gt.p8:698 goto skip11a - bra p8l_skip11a - ; source: test_uword_gt.p8:699 lbl11a: fail_uword(69) -p8l_lbl11a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:700 skip11a: -p8l_skip11a - ; source: test_uword_gt.p8:702 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:703 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:705 goto skip11b - bra p8l_skip11b - ; source: test_uword_gt.p8:706 lbl11b: fail_uword(70) -p8l_lbl11b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:707 skip11b: -p8l_skip11b - ; source: test_uword_gt.p8:709 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_81_afterif - ; source: test_uword_gt.p8:710 fail_uword(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_uword -label_asm_81_afterif - ; source: test_uword_gt.p8:713 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_83_else - ; source: test_uword_gt.p8:714 fail_uword(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_uword - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_gt.p8:716 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_uword_gt.p8:718 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gt.p8:720 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl12a - bne + - cmp p8v_x - bcc p8l_lbl12a -+ - ; source: test_uword_gt.p8:722 goto skip12a - bra p8l_skip12a - ; source: test_uword_gt.p8:723 lbl12a: fail_uword(73) -p8l_lbl12a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:724 skip12a: -p8l_skip12a - ; source: test_uword_gt.p8:726 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:727 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:729 goto skip12b - bra p8l_skip12b - ; source: test_uword_gt.p8:730 lbl12b: fail_uword(74) -p8l_lbl12b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:731 skip12b: -p8l_skip12b - ; source: test_uword_gt.p8:733 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_84_afterif - ; source: test_uword_gt.p8:734 fail_uword(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_uword -label_asm_84_afterif - ; source: test_uword_gt.p8:737 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_86_else - ; source: test_uword_gt.p8:738 fail_uword(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_uword - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_gt.p8:740 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_uword_gt.p8:742 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gt.p8:743 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gt.p8:745 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl13a - bne + - cmp p8v_x - bcc p8l_lbl13a -+ - ; source: test_uword_gt.p8:747 goto skip13a - bra p8l_skip13a - ; source: test_uword_gt.p8:748 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:749 skip13a: -p8l_skip13a - ; source: test_uword_gt.p8:751 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:752 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:754 goto skip13b - bra p8l_skip13b - ; source: test_uword_gt.p8:755 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:756 skip13b: -p8l_skip13b - ; source: test_uword_gt.p8:758 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_87_afterif - ; source: test_uword_gt.p8:759 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_uword_gt.p8:762 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_89_else - ; source: test_uword_gt.p8:763 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_gt.p8:765 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_uword_gt.p8:767 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:769 if x>value - cpy p8v_x+1 - bcc p8l_lbl14a - bne + - cmp p8v_x - bcc p8l_lbl14a -+ - ; source: test_uword_gt.p8:771 goto skip14a - bra p8l_skip14a - ; source: test_uword_gt.p8:772 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:773 skip14a: -p8l_skip14a - ; source: test_uword_gt.p8:775 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:776 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:778 goto skip14b - bra p8l_skip14b - ; source: test_uword_gt.p8:779 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:780 skip14b: -p8l_skip14b - ; source: test_uword_gt.p8:782 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_90_afterif - ; source: test_uword_gt.p8:783 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_uword_gt.p8:786 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_92_else - ; source: test_uword_gt.p8:787 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_gt.p8:789 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_uword_gt.p8:791 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gt.p8:793 if x>value - cpy p8v_x+1 - bcc p8l_lbl15a - bne + - cmp p8v_x - bcc p8l_lbl15a -+ - ; source: test_uword_gt.p8:795 goto skip15a - bra p8l_skip15a - ; source: test_uword_gt.p8:796 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:797 skip15a: -p8l_skip15a - ; source: test_uword_gt.p8:799 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:800 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:802 goto skip15b - bra p8l_skip15b - ; source: test_uword_gt.p8:803 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:804 skip15b: -p8l_skip15b - ; source: test_uword_gt.p8:806 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_93_afterif - ; source: test_uword_gt.p8:807 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_uword_gt.p8:810 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_95_else - ; source: test_uword_gt.p8:811 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_gt.p8:813 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_uword_gt.p8:815 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gt.p8:817 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc p8l_lbl16a - bne + - cmp p8v_x - bcc p8l_lbl16a -+ - ; source: test_uword_gt.p8:819 goto skip16a - bra p8l_skip16a - ; source: test_uword_gt.p8:820 lbl16a: fail_uword(77) -p8l_lbl16a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:821 skip16a: -p8l_skip16a - ; source: test_uword_gt.p8:823 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:824 if x>value - ldy p8v_value+1 - lda p8v_value - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:826 goto skip16b - bra p8l_skip16b - ; source: test_uword_gt.p8:827 lbl16b: fail_uword(78) -p8l_lbl16b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:828 skip16b: -p8l_skip16b - ; source: test_uword_gt.p8:830 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_96_afterif - ; source: test_uword_gt.p8:831 fail_uword(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_uword -label_asm_96_afterif - ; source: test_uword_gt.p8:834 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_98_else - ; source: test_uword_gt.p8:835 fail_uword(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_uword - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_gt.p8:837 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_uword_gt.p8:839 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_gt.p8:448 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .word ? -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_gt.p8:841 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_uword_gt.p8:842 uword @shared x - ; source: test_uword_gt.p8:843 uword[] values = [0, 0] - ; source: test_uword_gt.p8:842 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gt.p8:844 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_gt.p8:845 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gt.p8:846 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gt.p8:848 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl1a - bne + - cmp p8v_x - bcc p8l_lbl1a -+ - ; source: test_uword_gt.p8:850 goto skip1a - bra p8l_skip1a - ; source: test_uword_gt.p8:851 lbl1a: fail_uword(81) -p8l_lbl1a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:852 skip1a: -p8l_skip1a - ; source: test_uword_gt.p8:854 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:855 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:857 goto skip1b - bra p8l_skip1b - ; source: test_uword_gt.p8:858 lbl1b: fail_uword(82) -p8l_lbl1b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:859 skip1b: -p8l_skip1b - ; source: test_uword_gt.p8:861 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_99_afterif - ; source: test_uword_gt.p8:862 fail_uword(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_uword -label_asm_99_afterif - ; source: test_uword_gt.p8:865 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_101_else - ; source: test_uword_gt.p8:866 fail_uword(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_uword - bra label_asm_100_afterif -label_asm_101_else - ; source: test_uword_gt.p8:868 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_uword_gt.p8:870 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gt.p8:872 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl2a - bne + - cmp p8v_x - bcc p8l_lbl2a -+ - ; source: test_uword_gt.p8:874 goto skip2a - bra p8l_skip2a - ; source: test_uword_gt.p8:875 lbl2a: fail_uword(85) -p8l_lbl2a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:876 skip2a: -p8l_skip2a - ; source: test_uword_gt.p8:878 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:879 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:881 goto skip2b - bra p8l_skip2b - ; source: test_uword_gt.p8:882 lbl2b: fail_uword(86) -p8l_lbl2b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:883 skip2b: -p8l_skip2b - ; source: test_uword_gt.p8:885 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_102_afterif - ; source: test_uword_gt.p8:886 fail_uword(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_uword -label_asm_102_afterif - ; source: test_uword_gt.p8:889 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_104_else - ; source: test_uword_gt.p8:890 fail_uword(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_uword - bra label_asm_103_afterif -label_asm_104_else - ; source: test_uword_gt.p8:892 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_uword_gt.p8:894 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gt.p8:896 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl3a - bne + - cmp p8v_x - bcc p8l_lbl3a -+ - ; source: test_uword_gt.p8:898 goto skip3a - bra p8l_skip3a - ; source: test_uword_gt.p8:899 lbl3a: fail_uword(89) -p8l_lbl3a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:900 skip3a: -p8l_skip3a - ; source: test_uword_gt.p8:902 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:903 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:905 goto skip3b - bra p8l_skip3b - ; source: test_uword_gt.p8:906 lbl3b: fail_uword(90) -p8l_lbl3b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:907 skip3b: -p8l_skip3b - ; source: test_uword_gt.p8:909 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_105_afterif - ; source: test_uword_gt.p8:910 fail_uword(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_uword -label_asm_105_afterif - ; source: test_uword_gt.p8:913 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_107_else - ; source: test_uword_gt.p8:914 fail_uword(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_uword - bra label_asm_106_afterif -label_asm_107_else - ; source: test_uword_gt.p8:916 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_uword_gt.p8:918 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gt.p8:920 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl4a - bne + - cmp p8v_x - bcc p8l_lbl4a -+ - ; source: test_uword_gt.p8:922 goto skip4a - bra p8l_skip4a - ; source: test_uword_gt.p8:923 lbl4a: fail_uword(93) -p8l_lbl4a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:924 skip4a: -p8l_skip4a - ; source: test_uword_gt.p8:926 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:927 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:929 goto skip4b - bra p8l_skip4b - ; source: test_uword_gt.p8:930 lbl4b: fail_uword(94) -p8l_lbl4b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:931 skip4b: -p8l_skip4b - ; source: test_uword_gt.p8:933 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_108_afterif - ; source: test_uword_gt.p8:934 fail_uword(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_uword -label_asm_108_afterif - ; source: test_uword_gt.p8:937 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_110_else - ; source: test_uword_gt.p8:938 fail_uword(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_uword - bra label_asm_109_afterif -label_asm_110_else - ; source: test_uword_gt.p8:940 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_uword_gt.p8:942 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:943 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gt.p8:945 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl5a - bne + - cmp p8v_x - bcc p8l_lbl5a -+ - ; source: test_uword_gt.p8:947 goto skip5a - bra p8l_skip5a - ; source: test_uword_gt.p8:948 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:949 skip5a: -p8l_skip5a - ; source: test_uword_gt.p8:951 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:952 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:954 goto skip5b - bra p8l_skip5b - ; source: test_uword_gt.p8:955 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:956 skip5b: -p8l_skip5b - ; source: test_uword_gt.p8:958 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_111_afterif - ; source: test_uword_gt.p8:959 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_uword_gt.p8:962 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_113_else - ; source: test_uword_gt.p8:963 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_uword_gt.p8:965 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_uword_gt.p8:967 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gt.p8:969 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl6a - bne + - cmp p8v_x - bcc p8l_lbl6a -+ - ; source: test_uword_gt.p8:971 goto skip6a - bra p8l_skip6a - ; source: test_uword_gt.p8:972 lbl6a: fail_uword(97) -p8l_lbl6a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:973 skip6a: -p8l_skip6a - ; source: test_uword_gt.p8:975 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:976 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:978 goto skip6b - bra p8l_skip6b - ; source: test_uword_gt.p8:979 lbl6b: fail_uword(98) -p8l_lbl6b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:980 skip6b: -p8l_skip6b - ; source: test_uword_gt.p8:982 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_114_afterif - ; source: test_uword_gt.p8:983 fail_uword(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_uword -label_asm_114_afterif - ; source: test_uword_gt.p8:986 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_116_else - ; source: test_uword_gt.p8:987 fail_uword(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_uword - bra label_asm_115_afterif -label_asm_116_else - ; source: test_uword_gt.p8:989 success++ - inc p8b_main.p8v_success -label_asm_115_afterif - ; source: test_uword_gt.p8:991 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gt.p8:993 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl7a - bne + - cmp p8v_x - bcc p8l_lbl7a -+ - ; source: test_uword_gt.p8:995 goto skip7a - bra p8l_skip7a - ; source: test_uword_gt.p8:996 lbl7a: fail_uword(101) -p8l_lbl7a - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:997 skip7a: -p8l_skip7a - ; source: test_uword_gt.p8:999 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1000 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1002 goto skip7b - bra p8l_skip7b - ; source: test_uword_gt.p8:1003 lbl7b: fail_uword(102) -p8l_lbl7b - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1004 skip7b: -p8l_skip7b - ; source: test_uword_gt.p8:1006 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_117_afterif - ; source: test_uword_gt.p8:1007 fail_uword(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_uword -label_asm_117_afterif - ; source: test_uword_gt.p8:1010 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_119_else - ; source: test_uword_gt.p8:1011 fail_uword(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_uword - bra label_asm_118_afterif -label_asm_119_else - ; source: test_uword_gt.p8:1013 success++ - inc p8b_main.p8v_success -label_asm_118_afterif - ; source: test_uword_gt.p8:1015 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gt.p8:1017 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl8a - bne + - cmp p8v_x - bcc p8l_lbl8a -+ - ; source: test_uword_gt.p8:1019 goto skip8a - bra p8l_skip8a - ; source: test_uword_gt.p8:1020 lbl8a: fail_uword(105) -p8l_lbl8a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1021 skip8a: -p8l_skip8a - ; source: test_uword_gt.p8:1023 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1024 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1026 goto skip8b - bra p8l_skip8b - ; source: test_uword_gt.p8:1027 lbl8b: fail_uword(106) -p8l_lbl8b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1028 skip8b: -p8l_skip8b - ; source: test_uword_gt.p8:1030 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_120_afterif - ; source: test_uword_gt.p8:1031 fail_uword(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_uword -label_asm_120_afterif - ; source: test_uword_gt.p8:1034 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_122_else - ; source: test_uword_gt.p8:1035 fail_uword(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_uword - bra label_asm_121_afterif -label_asm_122_else - ; source: test_uword_gt.p8:1037 success++ - inc p8b_main.p8v_success -label_asm_121_afterif - ; source: test_uword_gt.p8:1039 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:1040 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gt.p8:1042 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl9a - bne + - cmp p8v_x - bcc p8l_lbl9a -+ - ; source: test_uword_gt.p8:1044 goto skip9a - bra p8l_skip9a - ; source: test_uword_gt.p8:1045 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1046 skip9a: -p8l_skip9a - ; source: test_uword_gt.p8:1048 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1049 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1051 goto skip9b - bra p8l_skip9b - ; source: test_uword_gt.p8:1052 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1053 skip9b: -p8l_skip9b - ; source: test_uword_gt.p8:1055 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_123_afterif - ; source: test_uword_gt.p8:1056 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_uword_gt.p8:1059 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_125_else - ; source: test_uword_gt.p8:1060 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_uword_gt.p8:1062 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_uword_gt.p8:1064 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gt.p8:1066 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl10a - bne + - cmp p8v_x - bcc p8l_lbl10a -+ - ; source: test_uword_gt.p8:1068 goto skip10a - bra p8l_skip10a - ; source: test_uword_gt.p8:1069 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1070 skip10a: -p8l_skip10a - ; source: test_uword_gt.p8:1072 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1073 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1075 goto skip10b - bra p8l_skip10b - ; source: test_uword_gt.p8:1076 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1077 skip10b: -p8l_skip10b - ; source: test_uword_gt.p8:1079 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_126_afterif - ; source: test_uword_gt.p8:1080 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_uword_gt.p8:1083 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_128_else - ; source: test_uword_gt.p8:1084 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_uword_gt.p8:1086 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_uword_gt.p8:1088 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gt.p8:1090 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl11a - bne + - cmp p8v_x - bcc p8l_lbl11a -+ - ; source: test_uword_gt.p8:1092 goto skip11a - bra p8l_skip11a - ; source: test_uword_gt.p8:1093 lbl11a: fail_uword(109) -p8l_lbl11a - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1094 skip11a: -p8l_skip11a - ; source: test_uword_gt.p8:1096 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1097 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1099 goto skip11b - bra p8l_skip11b - ; source: test_uword_gt.p8:1100 lbl11b: fail_uword(110) -p8l_lbl11b - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1101 skip11b: -p8l_skip11b - ; source: test_uword_gt.p8:1103 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_129_afterif - ; source: test_uword_gt.p8:1104 fail_uword(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_uword -label_asm_129_afterif - ; source: test_uword_gt.p8:1107 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_131_else - ; source: test_uword_gt.p8:1108 fail_uword(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_uword - bra label_asm_130_afterif -label_asm_131_else - ; source: test_uword_gt.p8:1110 success++ - inc p8b_main.p8v_success -label_asm_130_afterif - ; source: test_uword_gt.p8:1112 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gt.p8:1114 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl12a - bne + - cmp p8v_x - bcc p8l_lbl12a -+ - ; source: test_uword_gt.p8:1116 goto skip12a - bra p8l_skip12a - ; source: test_uword_gt.p8:1117 lbl12a: fail_uword(113) -p8l_lbl12a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1118 skip12a: -p8l_skip12a - ; source: test_uword_gt.p8:1120 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1121 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1123 goto skip12b - bra p8l_skip12b - ; source: test_uword_gt.p8:1124 lbl12b: fail_uword(114) -p8l_lbl12b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1125 skip12b: -p8l_skip12b - ; source: test_uword_gt.p8:1127 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_132_afterif - ; source: test_uword_gt.p8:1128 fail_uword(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_uword -label_asm_132_afterif - ; source: test_uword_gt.p8:1131 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_134_else - ; source: test_uword_gt.p8:1132 fail_uword(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_uword - bra label_asm_133_afterif -label_asm_134_else - ; source: test_uword_gt.p8:1134 success++ - inc p8b_main.p8v_success -label_asm_133_afterif - ; source: test_uword_gt.p8:1136 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gt.p8:1137 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gt.p8:1139 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl13a - bne + - cmp p8v_x - bcc p8l_lbl13a -+ - ; source: test_uword_gt.p8:1141 goto skip13a - bra p8l_skip13a - ; source: test_uword_gt.p8:1142 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1143 skip13a: -p8l_skip13a - ; source: test_uword_gt.p8:1145 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1146 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1148 goto skip13b - bra p8l_skip13b - ; source: test_uword_gt.p8:1149 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1150 skip13b: -p8l_skip13b - ; source: test_uword_gt.p8:1152 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_135_afterif - ; source: test_uword_gt.p8:1153 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_uword_gt.p8:1156 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_137_else - ; source: test_uword_gt.p8:1157 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_uword_gt.p8:1159 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_uword_gt.p8:1161 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gt.p8:1163 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl14a - bne + - cmp p8v_x - bcc p8l_lbl14a -+ - ; source: test_uword_gt.p8:1165 goto skip14a - bra p8l_skip14a - ; source: test_uword_gt.p8:1166 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1167 skip14a: -p8l_skip14a - ; source: test_uword_gt.p8:1169 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1170 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1172 goto skip14b - bra p8l_skip14b - ; source: test_uword_gt.p8:1173 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1174 skip14b: -p8l_skip14b - ; source: test_uword_gt.p8:1176 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_138_afterif - ; source: test_uword_gt.p8:1177 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_uword_gt.p8:1180 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_140_else - ; source: test_uword_gt.p8:1181 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_uword_gt.p8:1183 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_uword_gt.p8:1185 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gt.p8:1187 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl15a - bne + - cmp p8v_x - bcc p8l_lbl15a -+ - ; source: test_uword_gt.p8:1189 goto skip15a - bra p8l_skip15a - ; source: test_uword_gt.p8:1190 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1191 skip15a: -p8l_skip15a - ; source: test_uword_gt.p8:1193 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1194 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1196 goto skip15b - bra p8l_skip15b - ; source: test_uword_gt.p8:1197 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1198 skip15b: -p8l_skip15b - ; source: test_uword_gt.p8:1200 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_141_afterif - ; source: test_uword_gt.p8:1201 success++ - inc p8b_main.p8v_success -label_asm_141_afterif - ; source: test_uword_gt.p8:1204 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_143_else - ; source: test_uword_gt.p8:1205 success++ - inc p8b_main.p8v_success - bra label_asm_142_afterif -label_asm_143_else - ; source: test_uword_gt.p8:1207 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_uword_gt.p8:1209 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gt.p8:1211 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc p8l_lbl16a - bne + - cmp p8v_x - bcc p8l_lbl16a -+ - ; source: test_uword_gt.p8:1213 goto skip16a - bra p8l_skip16a - ; source: test_uword_gt.p8:1214 lbl16a: fail_uword(117) -p8l_lbl16a - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1215 skip16a: -p8l_skip16a - ; source: test_uword_gt.p8:1217 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1218 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1220 goto skip16b - bra p8l_skip16b - ; source: test_uword_gt.p8:1221 lbl16b: fail_uword(118) -p8l_lbl16b - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1222 skip16b: -p8l_skip16b - ; source: test_uword_gt.p8:1224 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_144_afterif - ; source: test_uword_gt.p8:1225 fail_uword(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_uword -label_asm_144_afterif - ; source: test_uword_gt.p8:1228 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_146_else - ; source: test_uword_gt.p8:1229 fail_uword(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_uword - bra label_asm_145_afterif -label_asm_146_else - ; source: test_uword_gt.p8:1231 success++ - inc p8b_main.p8v_success -label_asm_145_afterif - ; source: test_uword_gt.p8:1233 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_gt.p8:841 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -p8v_values .word $0000, $0000 - .pend - ; source: test_uword_gt.p8:1235 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_uword_gt.p8:1236 uword @shared x - ; source: test_uword_gt.p8:1239 float @shared f4 = 1.0 - ; source: test_uword_gt.p8:1240 float @shared f5 = 1.0 - ; source: test_uword_gt.p8:1236 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gt.p8:1237 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_gt.p8:1238 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_gt.p8:1239 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_uword_gt.p8:1240 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_uword_gt.p8:1241 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_gt.p8:1242 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gt.p8:1244 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl1a - bne + - cmp p8v_x - bcc p8l_lbl1a -+ - ; source: test_uword_gt.p8:1246 goto skip1a - bra p8l_skip1a - ; source: test_uword_gt.p8:1247 lbl1a: fail_uword(121) -p8l_lbl1a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1248 skip1a: -p8l_skip1a - ; source: test_uword_gt.p8:1250 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1251 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1253 goto skip1b - bra p8l_skip1b - ; source: test_uword_gt.p8:1254 lbl1b: fail_uword(122) -p8l_lbl1b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1255 skip1b: -p8l_skip1b - ; source: test_uword_gt.p8:1257 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_147_afterif - ; source: test_uword_gt.p8:1258 fail_uword(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_uword -label_asm_147_afterif - ; source: test_uword_gt.p8:1261 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_149_else - ; source: test_uword_gt.p8:1262 fail_uword(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_uword - bra label_asm_148_afterif -label_asm_149_else - ; source: test_uword_gt.p8:1264 success++ - inc p8b_main.p8v_success -label_asm_148_afterif - ; source: test_uword_gt.p8:1267 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl2a - bne + - cmp p8v_x - bcc p8l_lbl2a -+ - ; source: test_uword_gt.p8:1269 goto skip2a - bra p8l_skip2a - ; source: test_uword_gt.p8:1270 lbl2a: fail_uword(125) -p8l_lbl2a - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1271 skip2a: -p8l_skip2a - ; source: test_uword_gt.p8:1273 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1274 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1276 goto skip2b - bra p8l_skip2b - ; source: test_uword_gt.p8:1277 lbl2b: fail_uword(126) -p8l_lbl2b - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1278 skip2b: -p8l_skip2b - ; source: test_uword_gt.p8:1280 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_150_afterif - ; source: test_uword_gt.p8:1281 fail_uword(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_uword -label_asm_150_afterif - ; source: test_uword_gt.p8:1284 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_152_else - ; source: test_uword_gt.p8:1285 fail_uword(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_uword - bra label_asm_151_afterif -label_asm_152_else - ; source: test_uword_gt.p8:1287 success++ - inc p8b_main.p8v_success -label_asm_151_afterif - ; source: test_uword_gt.p8:1290 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl3a - bne + - cmp p8v_x - bcc p8l_lbl3a -+ - ; source: test_uword_gt.p8:1292 goto skip3a - bra p8l_skip3a - ; source: test_uword_gt.p8:1293 lbl3a: fail_uword(129) -p8l_lbl3a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1294 skip3a: -p8l_skip3a - ; source: test_uword_gt.p8:1296 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1297 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1299 goto skip3b - bra p8l_skip3b - ; source: test_uword_gt.p8:1300 lbl3b: fail_uword(130) -p8l_lbl3b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1301 skip3b: -p8l_skip3b - ; source: test_uword_gt.p8:1303 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_153_afterif - ; source: test_uword_gt.p8:1304 fail_uword(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_uword -label_asm_153_afterif - ; source: test_uword_gt.p8:1307 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_155_else - ; source: test_uword_gt.p8:1308 fail_uword(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_uword - bra label_asm_154_afterif -label_asm_155_else - ; source: test_uword_gt.p8:1310 success++ - inc p8b_main.p8v_success -label_asm_154_afterif - ; source: test_uword_gt.p8:1313 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl4a - bne + - cmp p8v_x - bcc p8l_lbl4a -+ - ; source: test_uword_gt.p8:1315 goto skip4a - bra p8l_skip4a - ; source: test_uword_gt.p8:1316 lbl4a: fail_uword(133) -p8l_lbl4a - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1317 skip4a: -p8l_skip4a - ; source: test_uword_gt.p8:1319 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1320 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1322 goto skip4b - bra p8l_skip4b - ; source: test_uword_gt.p8:1323 lbl4b: fail_uword(134) -p8l_lbl4b - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1324 skip4b: -p8l_skip4b - ; source: test_uword_gt.p8:1326 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_156_afterif - ; source: test_uword_gt.p8:1327 fail_uword(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_uword -label_asm_156_afterif - ; source: test_uword_gt.p8:1330 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_158_else - ; source: test_uword_gt.p8:1331 fail_uword(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_uword - bra label_asm_157_afterif -label_asm_158_else - ; source: test_uword_gt.p8:1333 success++ - inc p8b_main.p8v_success -label_asm_157_afterif - ; source: test_uword_gt.p8:1335 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:1337 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl5a - bne + - cmp p8v_x - bcc p8l_lbl5a -+ - ; source: test_uword_gt.p8:1339 goto skip5a - bra p8l_skip5a - ; source: test_uword_gt.p8:1340 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1341 skip5a: -p8l_skip5a - ; source: test_uword_gt.p8:1343 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1344 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1346 goto skip5b - bra p8l_skip5b - ; source: test_uword_gt.p8:1347 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1348 skip5b: -p8l_skip5b - ; source: test_uword_gt.p8:1350 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_159_afterif - ; source: test_uword_gt.p8:1351 success++ - inc p8b_main.p8v_success -label_asm_159_afterif - ; source: test_uword_gt.p8:1354 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_161_else - ; source: test_uword_gt.p8:1355 success++ - inc p8b_main.p8v_success - bra label_asm_160_afterif -label_asm_161_else - ; source: test_uword_gt.p8:1357 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_uword_gt.p8:1360 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl6a - bne + - cmp p8v_x - bcc p8l_lbl6a -+ - ; source: test_uword_gt.p8:1362 goto skip6a - bra p8l_skip6a - ; source: test_uword_gt.p8:1363 lbl6a: fail_uword(137) -p8l_lbl6a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1364 skip6a: -p8l_skip6a - ; source: test_uword_gt.p8:1366 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1367 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1369 goto skip6b - bra p8l_skip6b - ; source: test_uword_gt.p8:1370 lbl6b: fail_uword(138) -p8l_lbl6b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1371 skip6b: -p8l_skip6b - ; source: test_uword_gt.p8:1373 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_162_afterif - ; source: test_uword_gt.p8:1374 fail_uword(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_uword -label_asm_162_afterif - ; source: test_uword_gt.p8:1377 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_164_else - ; source: test_uword_gt.p8:1378 fail_uword(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_uword - bra label_asm_163_afterif -label_asm_164_else - ; source: test_uword_gt.p8:1380 success++ - inc p8b_main.p8v_success -label_asm_163_afterif - ; source: test_uword_gt.p8:1383 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl7a - bne + - cmp p8v_x - bcc p8l_lbl7a -+ - ; source: test_uword_gt.p8:1385 goto skip7a - bra p8l_skip7a - ; source: test_uword_gt.p8:1386 lbl7a: fail_uword(141) -p8l_lbl7a - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1387 skip7a: -p8l_skip7a - ; source: test_uword_gt.p8:1389 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1390 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1392 goto skip7b - bra p8l_skip7b - ; source: test_uword_gt.p8:1393 lbl7b: fail_uword(142) -p8l_lbl7b - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1394 skip7b: -p8l_skip7b - ; source: test_uword_gt.p8:1396 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_165_afterif - ; source: test_uword_gt.p8:1397 fail_uword(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_uword -label_asm_165_afterif - ; source: test_uword_gt.p8:1400 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_167_else - ; source: test_uword_gt.p8:1401 fail_uword(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_uword - bra label_asm_166_afterif -label_asm_167_else - ; source: test_uword_gt.p8:1403 success++ - inc p8b_main.p8v_success -label_asm_166_afterif - ; source: test_uword_gt.p8:1406 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl8a - bne + - cmp p8v_x - bcc p8l_lbl8a -+ - ; source: test_uword_gt.p8:1408 goto skip8a - bra p8l_skip8a - ; source: test_uword_gt.p8:1409 lbl8a: fail_uword(145) -p8l_lbl8a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1410 skip8a: -p8l_skip8a - ; source: test_uword_gt.p8:1412 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1413 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1415 goto skip8b - bra p8l_skip8b - ; source: test_uword_gt.p8:1416 lbl8b: fail_uword(146) -p8l_lbl8b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1417 skip8b: -p8l_skip8b - ; source: test_uword_gt.p8:1419 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_168_afterif - ; source: test_uword_gt.p8:1420 fail_uword(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_uword -label_asm_168_afterif - ; source: test_uword_gt.p8:1423 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_170_else - ; source: test_uword_gt.p8:1424 fail_uword(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_uword - bra label_asm_169_afterif -label_asm_170_else - ; source: test_uword_gt.p8:1426 success++ - inc p8b_main.p8v_success -label_asm_169_afterif - ; source: test_uword_gt.p8:1428 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gt.p8:1430 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl9a - bne + - cmp p8v_x - bcc p8l_lbl9a -+ - ; source: test_uword_gt.p8:1432 goto skip9a - bra p8l_skip9a - ; source: test_uword_gt.p8:1433 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1434 skip9a: -p8l_skip9a - ; source: test_uword_gt.p8:1436 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1437 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1439 goto skip9b - bra p8l_skip9b - ; source: test_uword_gt.p8:1440 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1441 skip9b: -p8l_skip9b - ; source: test_uword_gt.p8:1443 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_171_afterif - ; source: test_uword_gt.p8:1444 success++ - inc p8b_main.p8v_success -label_asm_171_afterif - ; source: test_uword_gt.p8:1447 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_173_else - ; source: test_uword_gt.p8:1448 success++ - inc p8b_main.p8v_success - bra label_asm_172_afterif -label_asm_173_else - ; source: test_uword_gt.p8:1450 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_uword_gt.p8:1453 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl10a - bne + - cmp p8v_x - bcc p8l_lbl10a -+ - ; source: test_uword_gt.p8:1455 goto skip10a - bra p8l_skip10a - ; source: test_uword_gt.p8:1456 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1457 skip10a: -p8l_skip10a - ; source: test_uword_gt.p8:1459 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1460 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1462 goto skip10b - bra p8l_skip10b - ; source: test_uword_gt.p8:1463 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1464 skip10b: -p8l_skip10b - ; source: test_uword_gt.p8:1466 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_174_afterif - ; source: test_uword_gt.p8:1467 success++ - inc p8b_main.p8v_success -label_asm_174_afterif - ; source: test_uword_gt.p8:1470 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_176_else - ; source: test_uword_gt.p8:1471 success++ - inc p8b_main.p8v_success - bra label_asm_175_afterif -label_asm_176_else - ; source: test_uword_gt.p8:1473 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_uword_gt.p8:1476 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl11a - bne + - cmp p8v_x - bcc p8l_lbl11a -+ - ; source: test_uword_gt.p8:1478 goto skip11a - bra p8l_skip11a - ; source: test_uword_gt.p8:1479 lbl11a: fail_uword(149) -p8l_lbl11a - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1480 skip11a: -p8l_skip11a - ; source: test_uword_gt.p8:1482 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1483 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1485 goto skip11b - bra p8l_skip11b - ; source: test_uword_gt.p8:1486 lbl11b: fail_uword(150) -p8l_lbl11b - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1487 skip11b: -p8l_skip11b - ; source: test_uword_gt.p8:1489 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_177_afterif - ; source: test_uword_gt.p8:1490 fail_uword(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_uword -label_asm_177_afterif - ; source: test_uword_gt.p8:1493 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_179_else - ; source: test_uword_gt.p8:1494 fail_uword(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_uword - bra label_asm_178_afterif -label_asm_179_else - ; source: test_uword_gt.p8:1496 success++ - inc p8b_main.p8v_success -label_asm_178_afterif - ; source: test_uword_gt.p8:1499 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl12a - bne + - cmp p8v_x - bcc p8l_lbl12a -+ - ; source: test_uword_gt.p8:1501 goto skip12a - bra p8l_skip12a - ; source: test_uword_gt.p8:1502 lbl12a: fail_uword(153) -p8l_lbl12a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1503 skip12a: -p8l_skip12a - ; source: test_uword_gt.p8:1505 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1506 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1508 goto skip12b - bra p8l_skip12b - ; source: test_uword_gt.p8:1509 lbl12b: fail_uword(154) -p8l_lbl12b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1510 skip12b: -p8l_skip12b - ; source: test_uword_gt.p8:1512 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_180_afterif - ; source: test_uword_gt.p8:1513 fail_uword(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_uword -label_asm_180_afterif - ; source: test_uword_gt.p8:1516 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_182_else - ; source: test_uword_gt.p8:1517 fail_uword(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_uword - bra label_asm_181_afterif -label_asm_182_else - ; source: test_uword_gt.p8:1519 success++ - inc p8b_main.p8v_success -label_asm_181_afterif - ; source: test_uword_gt.p8:1521 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gt.p8:1523 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl13a - bne + - cmp p8v_x - bcc p8l_lbl13a -+ - ; source: test_uword_gt.p8:1525 goto skip13a - bra p8l_skip13a - ; source: test_uword_gt.p8:1526 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1527 skip13a: -p8l_skip13a - ; source: test_uword_gt.p8:1529 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1530 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1532 goto skip13b - bra p8l_skip13b - ; source: test_uword_gt.p8:1533 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1534 skip13b: -p8l_skip13b - ; source: test_uword_gt.p8:1536 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_183_afterif - ; source: test_uword_gt.p8:1537 success++ - inc p8b_main.p8v_success -label_asm_183_afterif - ; source: test_uword_gt.p8:1540 if x>cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_185_else - ; source: test_uword_gt.p8:1541 success++ - inc p8b_main.p8v_success - bra label_asm_184_afterif -label_asm_185_else - ; source: test_uword_gt.p8:1543 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_uword_gt.p8:1546 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl14a - bne + - cmp p8v_x - bcc p8l_lbl14a -+ - ; source: test_uword_gt.p8:1548 goto skip14a - bra p8l_skip14a - ; source: test_uword_gt.p8:1549 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1550 skip14a: -p8l_skip14a - ; source: test_uword_gt.p8:1552 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1553 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1555 goto skip14b - bra p8l_skip14b - ; source: test_uword_gt.p8:1556 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1557 skip14b: -p8l_skip14b - ; source: test_uword_gt.p8:1559 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_186_afterif - ; source: test_uword_gt.p8:1560 success++ - inc p8b_main.p8v_success -label_asm_186_afterif - ; source: test_uword_gt.p8:1563 if x>cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_188_else - ; source: test_uword_gt.p8:1564 success++ - inc p8b_main.p8v_success - bra label_asm_187_afterif -label_asm_188_else - ; source: test_uword_gt.p8:1566 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_uword_gt.p8:1569 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl15a - bne + - cmp p8v_x - bcc p8l_lbl15a -+ - ; source: test_uword_gt.p8:1571 goto skip15a - bra p8l_skip15a - ; source: test_uword_gt.p8:1572 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1573 skip15a: -p8l_skip15a - ; source: test_uword_gt.p8:1575 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1576 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1578 goto skip15b - bra p8l_skip15b - ; source: test_uword_gt.p8:1579 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gt.p8:1580 skip15b: -p8l_skip15b - ; source: test_uword_gt.p8:1582 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_189_afterif - ; source: test_uword_gt.p8:1583 success++ - inc p8b_main.p8v_success -label_asm_189_afterif - ; source: test_uword_gt.p8:1586 if x>cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_191_else - ; source: test_uword_gt.p8:1587 success++ - inc p8b_main.p8v_success - bra label_asm_190_afterif -label_asm_191_else - ; source: test_uword_gt.p8:1589 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_uword_gt.p8:1592 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc p8l_lbl16a - bne + - cmp p8v_x - bcc p8l_lbl16a -+ - ; source: test_uword_gt.p8:1594 goto skip16a - bra p8l_skip16a - ; source: test_uword_gt.p8:1595 lbl16a: fail_uword(157) -p8l_lbl16a - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1596 skip16a: -p8l_skip16a - ; source: test_uword_gt.p8:1598 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gt.p8:1599 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_gt.p8:1601 goto skip16b - bra p8l_skip16b - ; source: test_uword_gt.p8:1602 lbl16b: fail_uword(158) -p8l_lbl16b - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gt.p8:1603 skip16b: -p8l_skip16b - ; source: test_uword_gt.p8:1605 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_192_afterif - ; source: test_uword_gt.p8:1606 fail_uword(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_uword -label_asm_192_afterif - ; source: test_uword_gt.p8:1609 if x>cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_194_else - ; source: test_uword_gt.p8:1610 fail_uword(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_uword - bra label_asm_193_afterif -label_asm_194_else - ; source: test_uword_gt.p8:1612 success++ - inc p8b_main.p8v_success -label_asm_193_afterif - ; source: test_uword_gt.p8:1614 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_gt.p8:1235 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .word ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>number: " - .byte $0d, $3e, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>var: " - .byte $0d, $3e, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>expr: " - .byte $0d, $3e, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_uword_gt.p8:14 txt.print("\ngreater-than tests for: ") - ; source: test_uword_gt.p8:18 txt.print("\n>number: ") - ; source: test_uword_gt.p8:20 txt.print("\n>var: ") - ; source: test_uword_gt.p8:22 txt.print("\n>array[]: ") - ; source: test_uword_gt.p8:24 txt.print("\n>expr: ") - ; source: test_uword_gt.p8:33 txt.print(" **failed** ") - ; source: test_uword_gt.p8:35 txt.print(" success, expected ") - ; source: test_uword_gt.p8:41 txt.print(" **fail#") - ; source: test_uword_gt.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_gt.p8 b/compiler/test/comparisons/test_uword_gt.p8 deleted file mode 100644 index f12c97914..000000000 --- a/compiler/test/comparisons/test_uword_gt.p8 +++ /dev/null @@ -1,1618 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>number: ") - test_cmp_number() - txt.print("\n>var: ") - test_cmp_var() - txt.print("\n>array[]: ") - test_cmp_array() - txt.print("\n>expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - uword @shared x - success = 0 - x=0 - ; direct jump - if x>0 - goto lbl1a - goto skip1a -lbl1a: fail_uword(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>0 - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(2) -skip1b: - ; no else - if x>0 - fail_uword(3) - - ; with else - if x>0 - fail_uword(4) - else - success++ - - ; direct jump - if x>1 - goto lbl2a - goto skip2a -lbl2a: fail_uword(5) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>1 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(6) -skip2b: - ; no else - if x>1 - fail_uword(7) - - ; with else - if x>1 - fail_uword(8) - else - success++ - - ; direct jump - if x>30464 - goto lbl3a - goto skip3a -lbl3a: fail_uword(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>30464 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(10) -skip3b: - ; no else - if x>30464 - fail_uword(11) - - ; with else - if x>30464 - fail_uword(12) - else - success++ - - ; direct jump - if x>65535 - goto lbl4a - goto skip4a -lbl4a: fail_uword(13) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>65535 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(14) -skip4b: - ; no else - if x>65535 - fail_uword(15) - - ; with else - if x>65535 - fail_uword(16) - else - success++ - - x=1 - ; direct jump - if x>0 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>0 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl6a - goto skip6a -lbl6a: fail_uword(17) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>1 - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(18) -skip6b: - ; no else - if x>1 - fail_uword(19) - - ; with else - if x>1 - fail_uword(20) - else - success++ - - ; direct jump - if x>30464 - goto lbl7a - goto skip7a -lbl7a: fail_uword(21) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>30464 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(22) -skip7b: - ; no else - if x>30464 - fail_uword(23) - - ; with else - if x>30464 - fail_uword(24) - else - success++ - - ; direct jump - if x>65535 - goto lbl8a - goto skip8a -lbl8a: fail_uword(25) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>65535 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(26) -skip8b: - ; no else - if x>65535 - fail_uword(27) - - ; with else - if x>65535 - fail_uword(28) - else - success++ - - x=30464 - ; direct jump - if x>0 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>0 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>1 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>1 - success++ - - ; with else - if x>1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>30464 - goto lbl11a - goto skip11a -lbl11a: fail_uword(29) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>30464 - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(30) -skip11b: - ; no else - if x>30464 - fail_uword(31) - - ; with else - if x>30464 - fail_uword(32) - else - success++ - - ; direct jump - if x>65535 - goto lbl12a - goto skip12a -lbl12a: fail_uword(33) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>65535 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(34) -skip12b: - ; no else - if x>65535 - fail_uword(35) - - ; with else - if x>65535 - fail_uword(36) - else - success++ - - x=65535 - ; direct jump - if x>0 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>0 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>1 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>1 - success++ - - ; with else - if x>1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>30464 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>30464 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>30464 - success++ - - ; with else - if x>30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x>65535 - goto lbl16a - goto skip16a -lbl16a: fail_uword(37) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>65535 - goto cx16.r3 - goto skip16b -lbl16b: fail_uword(38) -skip16b: - ; no else - if x>65535 - fail_uword(39) - - ; with else - if x>65535 - fail_uword(40) - else - success++ - - verify_success(34) -} - sub test_cmp_var() { - uword @shared x, value - success = 0 - x=0 - value=0 - ; direct jump - if x>value - goto lbl1a - goto skip1a -lbl1a: fail_uword(41) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>value - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(42) -skip1b: - ; no else - if x>value - fail_uword(43) - - ; with else - if x>value - fail_uword(44) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl2a - goto skip2a -lbl2a: fail_uword(45) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>value - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(46) -skip2b: - ; no else - if x>value - fail_uword(47) - - ; with else - if x>value - fail_uword(48) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl3a - goto skip3a -lbl3a: fail_uword(49) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>value - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(50) -skip3b: - ; no else - if x>value - fail_uword(51) - - ; with else - if x>value - fail_uword(52) - else - success++ - - value=65535 - ; direct jump - if x>value - goto lbl4a - goto skip4a -lbl4a: fail_uword(53) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>value - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(54) -skip4b: - ; no else - if x>value - fail_uword(55) - - ; with else - if x>value - fail_uword(56) - else - success++ - - x=1 - value=0 - ; direct jump - if x>value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl6a - goto skip6a -lbl6a: fail_uword(57) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>value - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(58) -skip6b: - ; no else - if x>value - fail_uword(59) - - ; with else - if x>value - fail_uword(60) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl7a - goto skip7a -lbl7a: fail_uword(61) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>value - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(62) -skip7b: - ; no else - if x>value - fail_uword(63) - - ; with else - if x>value - fail_uword(64) - else - success++ - - value=65535 - ; direct jump - if x>value - goto lbl8a - goto skip8a -lbl8a: fail_uword(65) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>value - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(66) -skip8b: - ; no else - if x>value - fail_uword(67) - - ; with else - if x>value - fail_uword(68) - else - success++ - - x=30464 - value=0 - ; direct jump - if x>value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>value - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>value - goto lbl11a - goto skip11a -lbl11a: fail_uword(69) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>value - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(70) -skip11b: - ; no else - if x>value - fail_uword(71) - - ; with else - if x>value - fail_uword(72) - else - success++ - - value=65535 - ; direct jump - if x>value - goto lbl12a - goto skip12a -lbl12a: fail_uword(73) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>value - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(74) -skip12b: - ; no else - if x>value - fail_uword(75) - - ; with else - if x>value - fail_uword(76) - else - success++ - - x=65535 - value=0 - ; direct jump - if x>value - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>value - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>value - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>value - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>value - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x>value - goto lbl16a - goto skip16a -lbl16a: fail_uword(77) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>value - goto cx16.r3 - goto skip16b -lbl16b: fail_uword(78) -skip16b: - ; no else - if x>value - fail_uword(79) - - ; with else - if x>value - fail_uword(80) - else - success++ - - verify_success(34) -} - sub test_cmp_array() { - uword @shared x - uword[] values = [0, 0] - success = 0 - x=0 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_uword(81) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(82) -skip1b: - ; no else - if x>values[1] - fail_uword(83) - - ; with else - if x>values[1] - fail_uword(84) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(85) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(86) -skip2b: - ; no else - if x>values[1] - fail_uword(87) - - ; with else - if x>values[1] - fail_uword(88) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(89) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(90) -skip3b: - ; no else - if x>values[1] - fail_uword(91) - - ; with else - if x>values[1] - fail_uword(92) - else - success++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(93) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(94) -skip4b: - ; no else - if x>values[1] - fail_uword(95) - - ; with else - if x>values[1] - fail_uword(96) - else - success++ - - x=1 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl6a - goto skip6a -lbl6a: fail_uword(97) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(98) -skip6b: - ; no else - if x>values[1] - fail_uword(99) - - ; with else - if x>values[1] - fail_uword(100) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(101) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(102) -skip7b: - ; no else - if x>values[1] - fail_uword(103) - - ; with else - if x>values[1] - fail_uword(104) - else - success++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(105) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(106) -skip8b: - ; no else - if x>values[1] - fail_uword(107) - - ; with else - if x>values[1] - fail_uword(108) - else - success++ - - x=30464 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl11a - goto skip11a -lbl11a: fail_uword(109) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(110) -skip11b: - ; no else - if x>values[1] - fail_uword(111) - - ; with else - if x>values[1] - fail_uword(112) - else - success++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(113) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(114) -skip12b: - ; no else - if x>values[1] - fail_uword(115) - - ; with else - if x>values[1] - fail_uword(116) - else - success++ - - x=65535 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl16a - goto skip16a -lbl16a: fail_uword(117) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_uword(118) -skip16b: - ; no else - if x>values[1] - fail_uword(119) - - ; with else - if x>values[1] - fail_uword(120) - else - success++ - - verify_success(34) -} - sub test_cmp_expr() { - uword @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x>cx16.r4+0-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: fail_uword(121) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(122) -skip1b: - ; no else - if x>cx16.r4+0-cx16.r5 - fail_uword(123) - - ; with else - if x>cx16.r4+0-cx16.r5 - fail_uword(124) - else - success++ - - ; direct jump - if x>cx16.r4+1-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: fail_uword(125) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(126) -skip2b: - ; no else - if x>cx16.r4+1-cx16.r5 - fail_uword(127) - - ; with else - if x>cx16.r4+1-cx16.r5 - fail_uword(128) - else - success++ - - ; direct jump - if x>cx16.r4+30464-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: fail_uword(129) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(130) -skip3b: - ; no else - if x>cx16.r4+30464-cx16.r5 - fail_uword(131) - - ; with else - if x>cx16.r4+30464-cx16.r5 - fail_uword(132) - else - success++ - - ; direct jump - if x>cx16.r4+65535-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: fail_uword(133) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(134) -skip4b: - ; no else - if x>cx16.r4+65535-cx16.r5 - fail_uword(135) - - ; with else - if x>cx16.r4+65535-cx16.r5 - fail_uword(136) - else - success++ - - x=1 - ; direct jump - if x>cx16.r4+0-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4+1-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: fail_uword(137) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(138) -skip6b: - ; no else - if x>cx16.r4+1-cx16.r5 - fail_uword(139) - - ; with else - if x>cx16.r4+1-cx16.r5 - fail_uword(140) - else - success++ - - ; direct jump - if x>cx16.r4+30464-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: fail_uword(141) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(142) -skip7b: - ; no else - if x>cx16.r4+30464-cx16.r5 - fail_uword(143) - - ; with else - if x>cx16.r4+30464-cx16.r5 - fail_uword(144) - else - success++ - - ; direct jump - if x>cx16.r4+65535-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: fail_uword(145) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(146) -skip8b: - ; no else - if x>cx16.r4+65535-cx16.r5 - fail_uword(147) - - ; with else - if x>cx16.r4+65535-cx16.r5 - fail_uword(148) - else - success++ - - x=30464 - ; direct jump - if x>cx16.r4+0-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>cx16.r4+1-cx16.r5 - success++ - - ; with else - if x>cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: fail_uword(149) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(150) -skip11b: - ; no else - if x>cx16.r4+30464-cx16.r5 - fail_uword(151) - - ; with else - if x>cx16.r4+30464-cx16.r5 - fail_uword(152) - else - success++ - - ; direct jump - if x>cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: fail_uword(153) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(154) -skip12b: - ; no else - if x>cx16.r4+65535-cx16.r5 - fail_uword(155) - - ; with else - if x>cx16.r4+65535-cx16.r5 - fail_uword(156) - else - success++ - - x=65535 - ; direct jump - if x>cx16.r4+0-cx16.r5 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4+1-cx16.r5 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>cx16.r4+1-cx16.r5 - success++ - - ; with else - if x>cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4+30464-cx16.r5 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x>cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4+65535-cx16.r5 - goto lbl16a - goto skip16a -lbl16a: fail_uword(157) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip16b -lbl16b: fail_uword(158) -skip16b: - ; no else - if x>cx16.r4+65535-cx16.r5 - fail_uword(159) - - ; with else - if x>cx16.r4+65535-cx16.r5 - fail_uword(160) - else - success++ - - verify_success(34) -} - -} - diff --git a/compiler/test/comparisons/test_uword_gte.asm b/compiler/test/comparisons/test_uword_gte.asm deleted file mode 100644 index 5a0e2d4b1..000000000 --- a/compiler/test/comparisons/test_uword_gte.asm +++ /dev/null @@ -1,12498 +0,0 @@ -; w65c02 assembly code for 'test_uword_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:43 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_gte.p8:9 ubyte success = 0 - ; source: test_uword_gte.p8:10 str datatype = "uword" - ; source: test_uword_gte.p8:11 uword @shared comparison - ; source: test_uword_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=number: ") - ldy #>prog8_interned_strings.string_2 - lda #=var: ") - ldy #>prog8_interned_strings.string_3 - lda #=array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #=expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:84 goto cx16.r3 - jmp (cx16.r3) - ; source: test_uword_gte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_uword_gte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:87 skip1b: -p8l_skip1b - ; source: test_uword_gte.p8:90 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:94 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:99 if x>=1 - lda p8v_x - ora p8v_x+1 - bne p8l_lbl2a - ; source: test_uword_gte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_uword_gte.p8:102 lbl2a: fail_uword(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:103 skip2a: -p8l_skip2a - ; source: test_uword_gte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:106 if x>=1 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_uword_gte.p8:109 lbl2b: fail_uword(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:110 skip2b: -p8l_skip2b - ; source: test_uword_gte.p8:112 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_3_afterif - ; source: test_uword_gte.p8:113 fail_uword(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_3_afterif - ; source: test_uword_gte.p8:116 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_5_else - ; source: test_uword_gte.p8:117 fail_uword(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_gte.p8:119 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_uword_gte.p8:122 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs p8l_lbl3a - ; source: test_uword_gte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_uword_gte.p8:125 lbl3a: fail_uword(5) -p8l_lbl3a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:126 skip3a: -p8l_skip3a - ; source: test_uword_gte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:129 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_uword_gte.p8:132 lbl3b: fail_uword(6) -p8l_lbl3b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:133 skip3b: -p8l_skip3b - ; source: test_uword_gte.p8:135 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_6_afterif - ; source: test_uword_gte.p8:136 fail_uword(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_6_afterif - ; source: test_uword_gte.p8:139 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_8_else - ; source: test_uword_gte.p8:140 fail_uword(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_gte.p8:142 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_uword_gte.p8:145 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs p8l_lbl4a - ; source: test_uword_gte.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_uword_gte.p8:148 lbl4a: fail_uword(9) -p8l_lbl4a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:149 skip4a: -p8l_skip4a - ; source: test_uword_gte.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:152 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_uword_gte.p8:155 lbl4b: fail_uword(10) -p8l_lbl4b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:156 skip4b: -p8l_skip4b - ; source: test_uword_gte.p8:158 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_9_afterif - ; source: test_uword_gte.p8:159 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_9_afterif - ; source: test_uword_gte.p8:162 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_11_else - ; source: test_uword_gte.p8:163 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_gte.p8:165 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_uword_gte.p8:167 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:170 goto lbl5a - bra p8l_lbl5a - ; source: test_uword_gte.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_uword_gte.p8:172 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:173 skip5a: -p8l_skip5a - ; source: test_uword_gte.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:177 goto cx16.r3 - jmp (cx16.r3) - ; source: test_uword_gte.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_uword_gte.p8:179 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:180 skip5b: -p8l_skip5b - ; source: test_uword_gte.p8:183 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:187 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:192 if x>=1 - lda p8v_x - ora p8v_x+1 - bne p8l_lbl6a - ; source: test_uword_gte.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_uword_gte.p8:195 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:196 skip6a: -p8l_skip6a - ; source: test_uword_gte.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:199 if x>=1 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_uword_gte.p8:202 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:203 skip6b: -p8l_skip6b - ; source: test_uword_gte.p8:205 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_12_afterif - ; source: test_uword_gte.p8:206 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_uword_gte.p8:209 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_14_else - ; source: test_uword_gte.p8:210 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_gte.p8:212 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_uword_gte.p8:215 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs p8l_lbl7a - ; source: test_uword_gte.p8:217 goto skip7a - bra p8l_skip7a - ; source: test_uword_gte.p8:218 lbl7a: fail_uword(13) -p8l_lbl7a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:219 skip7a: -p8l_skip7a - ; source: test_uword_gte.p8:221 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:222 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:224 goto skip7b - bra p8l_skip7b - ; source: test_uword_gte.p8:225 lbl7b: fail_uword(14) -p8l_lbl7b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:226 skip7b: -p8l_skip7b - ; source: test_uword_gte.p8:228 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_15_afterif - ; source: test_uword_gte.p8:229 fail_uword(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_15_afterif - ; source: test_uword_gte.p8:232 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_17_else - ; source: test_uword_gte.p8:233 fail_uword(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_gte.p8:235 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_uword_gte.p8:238 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs p8l_lbl8a - ; source: test_uword_gte.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_uword_gte.p8:241 lbl8a: fail_uword(17) -p8l_lbl8a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:242 skip8a: -p8l_skip8a - ; source: test_uword_gte.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:245 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_uword_gte.p8:248 lbl8b: fail_uword(18) -p8l_lbl8b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:249 skip8b: -p8l_skip8b - ; source: test_uword_gte.p8:251 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_18_afterif - ; source: test_uword_gte.p8:252 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_18_afterif - ; source: test_uword_gte.p8:255 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_20_else - ; source: test_uword_gte.p8:256 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_gte.p8:258 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_uword_gte.p8:260 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:263 goto lbl9a - bra p8l_lbl9a - ; source: test_uword_gte.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_uword_gte.p8:265 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:266 skip9a: -p8l_skip9a - ; source: test_uword_gte.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:270 goto cx16.r3 - jmp (cx16.r3) - ; source: test_uword_gte.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_uword_gte.p8:272 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:273 skip9b: -p8l_skip9b - ; source: test_uword_gte.p8:276 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:280 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:285 if x>=1 - lda p8v_x - ora p8v_x+1 - bne p8l_lbl10a - ; source: test_uword_gte.p8:287 goto skip10a - bra p8l_skip10a - ; source: test_uword_gte.p8:288 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:289 skip10a: -p8l_skip10a - ; source: test_uword_gte.p8:291 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:292 if x>=1 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:294 goto skip10b - bra p8l_skip10b - ; source: test_uword_gte.p8:295 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:296 skip10b: -p8l_skip10b - ; source: test_uword_gte.p8:298 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_21_afterif - ; source: test_uword_gte.p8:299 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_uword_gte.p8:302 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_23_else - ; source: test_uword_gte.p8:303 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_gte.p8:305 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_uword_gte.p8:308 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs p8l_lbl11a - ; source: test_uword_gte.p8:310 goto skip11a - bra p8l_skip11a - ; source: test_uword_gte.p8:311 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:312 skip11a: -p8l_skip11a - ; source: test_uword_gte.p8:314 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:315 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:317 goto skip11b - bra p8l_skip11b - ; source: test_uword_gte.p8:318 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:319 skip11b: -p8l_skip11b - ; source: test_uword_gte.p8:321 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_24_afterif - ; source: test_uword_gte.p8:322 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_uword_gte.p8:325 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_26_else - ; source: test_uword_gte.p8:326 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_gte.p8:328 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_uword_gte.p8:331 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs p8l_lbl12a - ; source: test_uword_gte.p8:333 goto skip12a - bra p8l_skip12a - ; source: test_uword_gte.p8:334 lbl12a: fail_uword(21) -p8l_lbl12a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:335 skip12a: -p8l_skip12a - ; source: test_uword_gte.p8:337 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:338 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:340 goto skip12b - bra p8l_skip12b - ; source: test_uword_gte.p8:341 lbl12b: fail_uword(22) -p8l_lbl12b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:342 skip12b: -p8l_skip12b - ; source: test_uword_gte.p8:344 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_27_afterif - ; source: test_uword_gte.p8:345 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_27_afterif - ; source: test_uword_gte.p8:348 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_29_else - ; source: test_uword_gte.p8:349 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_gte.p8:351 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_uword_gte.p8:353 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gte.p8:356 goto lbl13a - bra p8l_lbl13a - ; source: test_uword_gte.p8:357 goto skip13a - bra p8l_skip13a - ; source: test_uword_gte.p8:358 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:359 skip13a: -p8l_skip13a - ; source: test_uword_gte.p8:361 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:363 goto cx16.r3 - jmp (cx16.r3) - ; source: test_uword_gte.p8:364 goto skip13b - bra p8l_skip13b - ; source: test_uword_gte.p8:365 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:366 skip13b: -p8l_skip13b - ; source: test_uword_gte.p8:369 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:373 success++ - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:378 if x>=1 - lda p8v_x - ora p8v_x+1 - bne p8l_lbl14a - ; source: test_uword_gte.p8:380 goto skip14a - bra p8l_skip14a - ; source: test_uword_gte.p8:381 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:382 skip14a: -p8l_skip14a - ; source: test_uword_gte.p8:384 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:385 if x>=1 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:387 goto skip14b - bra p8l_skip14b - ; source: test_uword_gte.p8:388 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:389 skip14b: -p8l_skip14b - ; source: test_uword_gte.p8:391 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_30_afterif - ; source: test_uword_gte.p8:392 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_uword_gte.p8:395 if x>=1 - lda p8v_x - ora p8v_x+1 - beq label_asm_32_else - ; source: test_uword_gte.p8:396 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_gte.p8:398 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_uword_gte.p8:401 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs p8l_lbl15a - ; source: test_uword_gte.p8:403 goto skip15a - bra p8l_skip15a - ; source: test_uword_gte.p8:404 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:405 skip15a: -p8l_skip15a - ; source: test_uword_gte.p8:407 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:408 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:410 goto skip15b - bra p8l_skip15b - ; source: test_uword_gte.p8:411 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:412 skip15b: -p8l_skip15b - ; source: test_uword_gte.p8:414 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_33_afterif - ; source: test_uword_gte.p8:415 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_uword_gte.p8:418 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcc label_asm_35_else - ; source: test_uword_gte.p8:419 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_gte.p8:421 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_uword_gte.p8:424 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs p8l_lbl16a - ; source: test_uword_gte.p8:426 goto skip16a - bra p8l_skip16a - ; source: test_uword_gte.p8:427 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:428 skip16a: -p8l_skip16a - ; source: test_uword_gte.p8:430 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:431 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:433 goto skip16b - bra p8l_skip16b - ; source: test_uword_gte.p8:434 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:435 skip16b: -p8l_skip16b - ; source: test_uword_gte.p8:437 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_36_afterif - ; source: test_uword_gte.p8:438 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_uword_gte.p8:441 if x>=65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcc label_asm_38_else - ; source: test_uword_gte.p8:442 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_gte.p8:444 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_uword_gte.p8:446 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_gte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_gte.p8:448 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_uword_gte.p8:449 uword @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_uword_gte.p8:450 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_gte.p8:451 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gte.p8:452 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gte.p8:454 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl1a - ; source: test_uword_gte.p8:456 goto skip1a - bra p8l_skip1a - ; source: test_uword_gte.p8:457 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:458 skip1a: -p8l_skip1a - ; source: test_uword_gte.p8:460 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:461 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:463 goto skip1b - bra p8l_skip1b - ; source: test_uword_gte.p8:464 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:465 skip1b: -p8l_skip1b - ; source: test_uword_gte.p8:467 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_39_afterif - ; source: test_uword_gte.p8:468 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_uword_gte.p8:471 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_41_else - ; source: test_uword_gte.p8:472 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_gte.p8:474 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_uword_gte.p8:476 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:478 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl2a - ; source: test_uword_gte.p8:480 goto skip2a - bra p8l_skip2a - ; source: test_uword_gte.p8:481 lbl2a: fail_uword(25) -p8l_lbl2a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:482 skip2a: -p8l_skip2a - ; source: test_uword_gte.p8:484 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:485 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:487 goto skip2b - bra p8l_skip2b - ; source: test_uword_gte.p8:488 lbl2b: fail_uword(26) -p8l_lbl2b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:489 skip2b: -p8l_skip2b - ; source: test_uword_gte.p8:491 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_42_afterif - ; source: test_uword_gte.p8:492 fail_uword(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_42_afterif - ; source: test_uword_gte.p8:495 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_44_else - ; source: test_uword_gte.p8:496 fail_uword(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_gte.p8:498 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_uword_gte.p8:500 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:502 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl3a - ; source: test_uword_gte.p8:504 goto skip3a - bra p8l_skip3a - ; source: test_uword_gte.p8:505 lbl3a: fail_uword(29) -p8l_lbl3a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:506 skip3a: -p8l_skip3a - ; source: test_uword_gte.p8:508 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:509 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:511 goto skip3b - bra p8l_skip3b - ; source: test_uword_gte.p8:512 lbl3b: fail_uword(30) -p8l_lbl3b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:513 skip3b: -p8l_skip3b - ; source: test_uword_gte.p8:515 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_45_afterif - ; source: test_uword_gte.p8:516 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_45_afterif - ; source: test_uword_gte.p8:519 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_47_else - ; source: test_uword_gte.p8:520 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_gte.p8:522 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_uword_gte.p8:524 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gte.p8:526 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl4a - ; source: test_uword_gte.p8:528 goto skip4a - bra p8l_skip4a - ; source: test_uword_gte.p8:529 lbl4a: fail_uword(33) -p8l_lbl4a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:530 skip4a: -p8l_skip4a - ; source: test_uword_gte.p8:532 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:533 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:535 goto skip4b - bra p8l_skip4b - ; source: test_uword_gte.p8:536 lbl4b: fail_uword(34) -p8l_lbl4b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:537 skip4b: -p8l_skip4b - ; source: test_uword_gte.p8:539 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_48_afterif - ; source: test_uword_gte.p8:540 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_48_afterif - ; source: test_uword_gte.p8:543 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_50_else - ; source: test_uword_gte.p8:544 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_gte.p8:546 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_uword_gte.p8:548 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:549 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gte.p8:551 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl5a - ; source: test_uword_gte.p8:553 goto skip5a - bra p8l_skip5a - ; source: test_uword_gte.p8:554 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:555 skip5a: -p8l_skip5a - ; source: test_uword_gte.p8:557 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:558 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:560 goto skip5b - bra p8l_skip5b - ; source: test_uword_gte.p8:561 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:562 skip5b: -p8l_skip5b - ; source: test_uword_gte.p8:564 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_51_afterif - ; source: test_uword_gte.p8:565 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_uword_gte.p8:568 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_53_else - ; source: test_uword_gte.p8:569 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_gte.p8:571 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_uword_gte.p8:573 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:575 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl6a - ; source: test_uword_gte.p8:577 goto skip6a - bra p8l_skip6a - ; source: test_uword_gte.p8:578 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:579 skip6a: -p8l_skip6a - ; source: test_uword_gte.p8:581 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:582 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:584 goto skip6b - bra p8l_skip6b - ; source: test_uword_gte.p8:585 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:586 skip6b: -p8l_skip6b - ; source: test_uword_gte.p8:588 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_54_afterif - ; source: test_uword_gte.p8:589 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_uword_gte.p8:592 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_56_else - ; source: test_uword_gte.p8:593 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_gte.p8:595 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_uword_gte.p8:597 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:599 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl7a - ; source: test_uword_gte.p8:601 goto skip7a - bra p8l_skip7a - ; source: test_uword_gte.p8:602 lbl7a: fail_uword(37) -p8l_lbl7a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:603 skip7a: -p8l_skip7a - ; source: test_uword_gte.p8:605 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:606 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:608 goto skip7b - bra p8l_skip7b - ; source: test_uword_gte.p8:609 lbl7b: fail_uword(38) -p8l_lbl7b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:610 skip7b: -p8l_skip7b - ; source: test_uword_gte.p8:612 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_57_afterif - ; source: test_uword_gte.p8:613 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_57_afterif - ; source: test_uword_gte.p8:616 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_59_else - ; source: test_uword_gte.p8:617 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_gte.p8:619 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_uword_gte.p8:621 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gte.p8:623 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl8a - ; source: test_uword_gte.p8:625 goto skip8a - bra p8l_skip8a - ; source: test_uword_gte.p8:626 lbl8a: fail_uword(41) -p8l_lbl8a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:627 skip8a: -p8l_skip8a - ; source: test_uword_gte.p8:629 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:630 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:632 goto skip8b - bra p8l_skip8b - ; source: test_uword_gte.p8:633 lbl8b: fail_uword(42) -p8l_lbl8b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:634 skip8b: -p8l_skip8b - ; source: test_uword_gte.p8:636 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_60_afterif - ; source: test_uword_gte.p8:637 fail_uword(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_60_afterif - ; source: test_uword_gte.p8:640 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_62_else - ; source: test_uword_gte.p8:641 fail_uword(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_gte.p8:643 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_uword_gte.p8:645 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:646 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gte.p8:648 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl9a - ; source: test_uword_gte.p8:650 goto skip9a - bra p8l_skip9a - ; source: test_uword_gte.p8:651 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:652 skip9a: -p8l_skip9a - ; source: test_uword_gte.p8:654 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:655 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:657 goto skip9b - bra p8l_skip9b - ; source: test_uword_gte.p8:658 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:659 skip9b: -p8l_skip9b - ; source: test_uword_gte.p8:661 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_63_afterif - ; source: test_uword_gte.p8:662 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_uword_gte.p8:665 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_65_else - ; source: test_uword_gte.p8:666 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_gte.p8:668 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_uword_gte.p8:670 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:672 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl10a - ; source: test_uword_gte.p8:674 goto skip10a - bra p8l_skip10a - ; source: test_uword_gte.p8:675 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:676 skip10a: -p8l_skip10a - ; source: test_uword_gte.p8:678 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:679 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:681 goto skip10b - bra p8l_skip10b - ; source: test_uword_gte.p8:682 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:683 skip10b: -p8l_skip10b - ; source: test_uword_gte.p8:685 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_66_afterif - ; source: test_uword_gte.p8:686 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_uword_gte.p8:689 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_68_else - ; source: test_uword_gte.p8:690 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_gte.p8:692 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_uword_gte.p8:694 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:696 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl11a - ; source: test_uword_gte.p8:698 goto skip11a - bra p8l_skip11a - ; source: test_uword_gte.p8:699 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:700 skip11a: -p8l_skip11a - ; source: test_uword_gte.p8:702 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:703 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:705 goto skip11b - bra p8l_skip11b - ; source: test_uword_gte.p8:706 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:707 skip11b: -p8l_skip11b - ; source: test_uword_gte.p8:709 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_69_afterif - ; source: test_uword_gte.p8:710 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_uword_gte.p8:713 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_71_else - ; source: test_uword_gte.p8:714 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_gte.p8:716 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_uword_gte.p8:718 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gte.p8:720 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl12a - ; source: test_uword_gte.p8:722 goto skip12a - bra p8l_skip12a - ; source: test_uword_gte.p8:723 lbl12a: fail_uword(45) -p8l_lbl12a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:724 skip12a: -p8l_skip12a - ; source: test_uword_gte.p8:726 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:727 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:729 goto skip12b - bra p8l_skip12b - ; source: test_uword_gte.p8:730 lbl12b: fail_uword(46) -p8l_lbl12b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:731 skip12b: -p8l_skip12b - ; source: test_uword_gte.p8:733 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_72_afterif - ; source: test_uword_gte.p8:734 fail_uword(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_72_afterif - ; source: test_uword_gte.p8:737 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_74_else - ; source: test_uword_gte.p8:738 fail_uword(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_gte.p8:740 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_uword_gte.p8:742 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gte.p8:743 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_gte.p8:745 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl13a - ; source: test_uword_gte.p8:747 goto skip13a - bra p8l_skip13a - ; source: test_uword_gte.p8:748 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:749 skip13a: -p8l_skip13a - ; source: test_uword_gte.p8:751 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:752 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:754 goto skip13b - bra p8l_skip13b - ; source: test_uword_gte.p8:755 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:756 skip13b: -p8l_skip13b - ; source: test_uword_gte.p8:758 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_75_afterif - ; source: test_uword_gte.p8:759 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_uword_gte.p8:762 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_77_else - ; source: test_uword_gte.p8:763 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_gte.p8:765 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_uword_gte.p8:767 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:769 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl14a - ; source: test_uword_gte.p8:771 goto skip14a - bra p8l_skip14a - ; source: test_uword_gte.p8:772 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:773 skip14a: -p8l_skip14a - ; source: test_uword_gte.p8:775 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:776 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:778 goto skip14b - bra p8l_skip14b - ; source: test_uword_gte.p8:779 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:780 skip14b: -p8l_skip14b - ; source: test_uword_gte.p8:782 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_78_afterif - ; source: test_uword_gte.p8:783 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_uword_gte.p8:786 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_80_else - ; source: test_uword_gte.p8:787 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_gte.p8:789 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_uword_gte.p8:791 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_gte.p8:793 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl15a - ; source: test_uword_gte.p8:795 goto skip15a - bra p8l_skip15a - ; source: test_uword_gte.p8:796 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:797 skip15a: -p8l_skip15a - ; source: test_uword_gte.p8:799 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:800 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:802 goto skip15b - bra p8l_skip15b - ; source: test_uword_gte.p8:803 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:804 skip15b: -p8l_skip15b - ; source: test_uword_gte.p8:806 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_81_afterif - ; source: test_uword_gte.p8:807 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_uword_gte.p8:810 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_83_else - ; source: test_uword_gte.p8:811 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_gte.p8:813 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_uword_gte.p8:815 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_gte.p8:817 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcs p8l_lbl16a - ; source: test_uword_gte.p8:819 goto skip16a - bra p8l_skip16a - ; source: test_uword_gte.p8:820 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:821 skip16a: -p8l_skip16a - ; source: test_uword_gte.p8:823 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:824 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:826 goto skip16b - bra p8l_skip16b - ; source: test_uword_gte.p8:827 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:828 skip16b: -p8l_skip16b - ; source: test_uword_gte.p8:830 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_84_afterif - ; source: test_uword_gte.p8:831 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_uword_gte.p8:834 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bcc label_asm_86_else - ; source: test_uword_gte.p8:835 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_gte.p8:837 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_uword_gte.p8:839 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_gte.p8:448 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .word ? -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_gte.p8:841 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_uword_gte.p8:842 uword @shared x - ; source: test_uword_gte.p8:843 uword[] values = [0, 0] - ; source: test_uword_gte.p8:842 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gte.p8:844 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_gte.p8:845 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gte.p8:846 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gte.p8:848 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl1a - ; source: test_uword_gte.p8:850 goto skip1a - bra p8l_skip1a - ; source: test_uword_gte.p8:851 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:852 skip1a: -p8l_skip1a - ; source: test_uword_gte.p8:854 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:855 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:857 goto skip1b - bra p8l_skip1b - ; source: test_uword_gte.p8:858 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:859 skip1b: -p8l_skip1b - ; source: test_uword_gte.p8:861 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_87_afterif - ; source: test_uword_gte.p8:862 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_uword_gte.p8:865 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_89_else - ; source: test_uword_gte.p8:866 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_gte.p8:868 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_uword_gte.p8:870 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gte.p8:872 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl2a - ; source: test_uword_gte.p8:874 goto skip2a - bra p8l_skip2a - ; source: test_uword_gte.p8:875 lbl2a: fail_uword(49) -p8l_lbl2a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:876 skip2a: -p8l_skip2a - ; source: test_uword_gte.p8:878 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:879 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:881 goto skip2b - bra p8l_skip2b - ; source: test_uword_gte.p8:882 lbl2b: fail_uword(50) -p8l_lbl2b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:883 skip2b: -p8l_skip2b - ; source: test_uword_gte.p8:885 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_90_afterif - ; source: test_uword_gte.p8:886 fail_uword(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_uword -label_asm_90_afterif - ; source: test_uword_gte.p8:889 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_92_else - ; source: test_uword_gte.p8:890 fail_uword(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_uword - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_gte.p8:892 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_uword_gte.p8:894 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gte.p8:896 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl3a - ; source: test_uword_gte.p8:898 goto skip3a - bra p8l_skip3a - ; source: test_uword_gte.p8:899 lbl3a: fail_uword(53) -p8l_lbl3a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:900 skip3a: -p8l_skip3a - ; source: test_uword_gte.p8:902 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:903 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:905 goto skip3b - bra p8l_skip3b - ; source: test_uword_gte.p8:906 lbl3b: fail_uword(54) -p8l_lbl3b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:907 skip3b: -p8l_skip3b - ; source: test_uword_gte.p8:909 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_93_afterif - ; source: test_uword_gte.p8:910 fail_uword(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_uword -label_asm_93_afterif - ; source: test_uword_gte.p8:913 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_95_else - ; source: test_uword_gte.p8:914 fail_uword(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_uword - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_gte.p8:916 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_uword_gte.p8:918 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gte.p8:920 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl4a - ; source: test_uword_gte.p8:922 goto skip4a - bra p8l_skip4a - ; source: test_uword_gte.p8:923 lbl4a: fail_uword(57) -p8l_lbl4a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:924 skip4a: -p8l_skip4a - ; source: test_uword_gte.p8:926 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:927 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:929 goto skip4b - bra p8l_skip4b - ; source: test_uword_gte.p8:930 lbl4b: fail_uword(58) -p8l_lbl4b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:931 skip4b: -p8l_skip4b - ; source: test_uword_gte.p8:933 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_96_afterif - ; source: test_uword_gte.p8:934 fail_uword(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_uword -label_asm_96_afterif - ; source: test_uword_gte.p8:937 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_98_else - ; source: test_uword_gte.p8:938 fail_uword(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_uword - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_gte.p8:940 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_uword_gte.p8:942 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:943 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gte.p8:945 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl5a - ; source: test_uword_gte.p8:947 goto skip5a - bra p8l_skip5a - ; source: test_uword_gte.p8:948 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:949 skip5a: -p8l_skip5a - ; source: test_uword_gte.p8:951 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:952 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:954 goto skip5b - bra p8l_skip5b - ; source: test_uword_gte.p8:955 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:956 skip5b: -p8l_skip5b - ; source: test_uword_gte.p8:958 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_99_afterif - ; source: test_uword_gte.p8:959 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_uword_gte.p8:962 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_101_else - ; source: test_uword_gte.p8:963 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_uword_gte.p8:965 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_uword_gte.p8:967 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gte.p8:969 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl6a - ; source: test_uword_gte.p8:971 goto skip6a - bra p8l_skip6a - ; source: test_uword_gte.p8:972 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:973 skip6a: -p8l_skip6a - ; source: test_uword_gte.p8:975 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:976 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:978 goto skip6b - bra p8l_skip6b - ; source: test_uword_gte.p8:979 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:980 skip6b: -p8l_skip6b - ; source: test_uword_gte.p8:982 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_102_afterif - ; source: test_uword_gte.p8:983 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_uword_gte.p8:986 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_104_else - ; source: test_uword_gte.p8:987 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_uword_gte.p8:989 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_uword_gte.p8:991 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gte.p8:993 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl7a - ; source: test_uword_gte.p8:995 goto skip7a - bra p8l_skip7a - ; source: test_uword_gte.p8:996 lbl7a: fail_uword(61) -p8l_lbl7a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:997 skip7a: -p8l_skip7a - ; source: test_uword_gte.p8:999 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1000 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1002 goto skip7b - bra p8l_skip7b - ; source: test_uword_gte.p8:1003 lbl7b: fail_uword(62) -p8l_lbl7b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1004 skip7b: -p8l_skip7b - ; source: test_uword_gte.p8:1006 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_105_afterif - ; source: test_uword_gte.p8:1007 fail_uword(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_uword -label_asm_105_afterif - ; source: test_uword_gte.p8:1010 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_107_else - ; source: test_uword_gte.p8:1011 fail_uword(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_uword - bra label_asm_106_afterif -label_asm_107_else - ; source: test_uword_gte.p8:1013 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_uword_gte.p8:1015 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gte.p8:1017 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl8a - ; source: test_uword_gte.p8:1019 goto skip8a - bra p8l_skip8a - ; source: test_uword_gte.p8:1020 lbl8a: fail_uword(65) -p8l_lbl8a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1021 skip8a: -p8l_skip8a - ; source: test_uword_gte.p8:1023 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1024 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1026 goto skip8b - bra p8l_skip8b - ; source: test_uword_gte.p8:1027 lbl8b: fail_uword(66) -p8l_lbl8b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1028 skip8b: -p8l_skip8b - ; source: test_uword_gte.p8:1030 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_108_afterif - ; source: test_uword_gte.p8:1031 fail_uword(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_uword -label_asm_108_afterif - ; source: test_uword_gte.p8:1034 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_110_else - ; source: test_uword_gte.p8:1035 fail_uword(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_uword - bra label_asm_109_afterif -label_asm_110_else - ; source: test_uword_gte.p8:1037 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_uword_gte.p8:1039 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:1040 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gte.p8:1042 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl9a - ; source: test_uword_gte.p8:1044 goto skip9a - bra p8l_skip9a - ; source: test_uword_gte.p8:1045 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1046 skip9a: -p8l_skip9a - ; source: test_uword_gte.p8:1048 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1049 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1051 goto skip9b - bra p8l_skip9b - ; source: test_uword_gte.p8:1052 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1053 skip9b: -p8l_skip9b - ; source: test_uword_gte.p8:1055 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_111_afterif - ; source: test_uword_gte.p8:1056 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_uword_gte.p8:1059 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_113_else - ; source: test_uword_gte.p8:1060 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_uword_gte.p8:1062 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_uword_gte.p8:1064 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gte.p8:1066 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl10a - ; source: test_uword_gte.p8:1068 goto skip10a - bra p8l_skip10a - ; source: test_uword_gte.p8:1069 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1070 skip10a: -p8l_skip10a - ; source: test_uword_gte.p8:1072 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1073 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1075 goto skip10b - bra p8l_skip10b - ; source: test_uword_gte.p8:1076 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1077 skip10b: -p8l_skip10b - ; source: test_uword_gte.p8:1079 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_114_afterif - ; source: test_uword_gte.p8:1080 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_uword_gte.p8:1083 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_116_else - ; source: test_uword_gte.p8:1084 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_uword_gte.p8:1086 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_uword_gte.p8:1088 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gte.p8:1090 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl11a - ; source: test_uword_gte.p8:1092 goto skip11a - bra p8l_skip11a - ; source: test_uword_gte.p8:1093 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1094 skip11a: -p8l_skip11a - ; source: test_uword_gte.p8:1096 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1097 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1099 goto skip11b - bra p8l_skip11b - ; source: test_uword_gte.p8:1100 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1101 skip11b: -p8l_skip11b - ; source: test_uword_gte.p8:1103 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_117_afterif - ; source: test_uword_gte.p8:1104 success++ - inc p8b_main.p8v_success -label_asm_117_afterif - ; source: test_uword_gte.p8:1107 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_119_else - ; source: test_uword_gte.p8:1108 success++ - inc p8b_main.p8v_success - bra label_asm_118_afterif -label_asm_119_else - ; source: test_uword_gte.p8:1110 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_uword_gte.p8:1112 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gte.p8:1114 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl12a - ; source: test_uword_gte.p8:1116 goto skip12a - bra p8l_skip12a - ; source: test_uword_gte.p8:1117 lbl12a: fail_uword(69) -p8l_lbl12a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1118 skip12a: -p8l_skip12a - ; source: test_uword_gte.p8:1120 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1121 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1123 goto skip12b - bra p8l_skip12b - ; source: test_uword_gte.p8:1124 lbl12b: fail_uword(70) -p8l_lbl12b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1125 skip12b: -p8l_skip12b - ; source: test_uword_gte.p8:1127 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_120_afterif - ; source: test_uword_gte.p8:1128 fail_uword(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_uword -label_asm_120_afterif - ; source: test_uword_gte.p8:1131 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_122_else - ; source: test_uword_gte.p8:1132 fail_uword(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_uword - bra label_asm_121_afterif -label_asm_122_else - ; source: test_uword_gte.p8:1134 success++ - inc p8b_main.p8v_success -label_asm_121_afterif - ; source: test_uword_gte.p8:1136 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gte.p8:1137 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_gte.p8:1139 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl13a - ; source: test_uword_gte.p8:1141 goto skip13a - bra p8l_skip13a - ; source: test_uword_gte.p8:1142 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1143 skip13a: -p8l_skip13a - ; source: test_uword_gte.p8:1145 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1146 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1148 goto skip13b - bra p8l_skip13b - ; source: test_uword_gte.p8:1149 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1150 skip13b: -p8l_skip13b - ; source: test_uword_gte.p8:1152 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_123_afterif - ; source: test_uword_gte.p8:1153 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_uword_gte.p8:1156 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_125_else - ; source: test_uword_gte.p8:1157 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_uword_gte.p8:1159 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_uword_gte.p8:1161 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_gte.p8:1163 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl14a - ; source: test_uword_gte.p8:1165 goto skip14a - bra p8l_skip14a - ; source: test_uword_gte.p8:1166 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1167 skip14a: -p8l_skip14a - ; source: test_uword_gte.p8:1169 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1170 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1172 goto skip14b - bra p8l_skip14b - ; source: test_uword_gte.p8:1173 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1174 skip14b: -p8l_skip14b - ; source: test_uword_gte.p8:1176 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_126_afterif - ; source: test_uword_gte.p8:1177 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_uword_gte.p8:1180 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_128_else - ; source: test_uword_gte.p8:1181 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_uword_gte.p8:1183 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_uword_gte.p8:1185 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_gte.p8:1187 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl15a - ; source: test_uword_gte.p8:1189 goto skip15a - bra p8l_skip15a - ; source: test_uword_gte.p8:1190 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1191 skip15a: -p8l_skip15a - ; source: test_uword_gte.p8:1193 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1194 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1196 goto skip15b - bra p8l_skip15b - ; source: test_uword_gte.p8:1197 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1198 skip15b: -p8l_skip15b - ; source: test_uword_gte.p8:1200 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_129_afterif - ; source: test_uword_gte.p8:1201 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_uword_gte.p8:1204 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_131_else - ; source: test_uword_gte.p8:1205 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_uword_gte.p8:1207 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_uword_gte.p8:1209 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_gte.p8:1211 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl16a - ; source: test_uword_gte.p8:1213 goto skip16a - bra p8l_skip16a - ; source: test_uword_gte.p8:1214 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1215 skip16a: -p8l_skip16a - ; source: test_uword_gte.p8:1217 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1218 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1220 goto skip16b - bra p8l_skip16b - ; source: test_uword_gte.p8:1221 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1222 skip16b: -p8l_skip16b - ; source: test_uword_gte.p8:1224 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_132_afterif - ; source: test_uword_gte.p8:1225 success++ - inc p8b_main.p8v_success -label_asm_132_afterif - ; source: test_uword_gte.p8:1228 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_134_else - ; source: test_uword_gte.p8:1229 success++ - inc p8b_main.p8v_success - bra label_asm_133_afterif -label_asm_134_else - ; source: test_uword_gte.p8:1231 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_uword_gte.p8:1233 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_gte.p8:841 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -p8v_values .word $0000, $0000 - .pend - ; source: test_uword_gte.p8:1235 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_uword_gte.p8:1236 uword @shared x - ; source: test_uword_gte.p8:1239 float @shared f4 = 1.0 - ; source: test_uword_gte.p8:1240 float @shared f5 = 1.0 - ; source: test_uword_gte.p8:1236 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gte.p8:1237 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_gte.p8:1238 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_gte.p8:1239 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_uword_gte.p8:1240 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_uword_gte.p8:1241 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_gte.p8:1242 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_gte.p8:1244 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl1a - ; source: test_uword_gte.p8:1246 goto skip1a - bra p8l_skip1a - ; source: test_uword_gte.p8:1247 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1248 skip1a: -p8l_skip1a - ; source: test_uword_gte.p8:1250 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1251 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1253 goto skip1b - bra p8l_skip1b - ; source: test_uword_gte.p8:1254 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1255 skip1b: -p8l_skip1b - ; source: test_uword_gte.p8:1257 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_135_afterif - ; source: test_uword_gte.p8:1258 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_uword_gte.p8:1261 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_137_else - ; source: test_uword_gte.p8:1262 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_uword_gte.p8:1264 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_uword_gte.p8:1267 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl2a - ; source: test_uword_gte.p8:1269 goto skip2a - bra p8l_skip2a - ; source: test_uword_gte.p8:1270 lbl2a: fail_uword(73) -p8l_lbl2a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1271 skip2a: -p8l_skip2a - ; source: test_uword_gte.p8:1273 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1274 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1276 goto skip2b - bra p8l_skip2b - ; source: test_uword_gte.p8:1277 lbl2b: fail_uword(74) -p8l_lbl2b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1278 skip2b: -p8l_skip2b - ; source: test_uword_gte.p8:1280 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_138_afterif - ; source: test_uword_gte.p8:1281 fail_uword(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_uword -label_asm_138_afterif - ; source: test_uword_gte.p8:1284 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_140_else - ; source: test_uword_gte.p8:1285 fail_uword(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_uword - bra label_asm_139_afterif -label_asm_140_else - ; source: test_uword_gte.p8:1287 success++ - inc p8b_main.p8v_success -label_asm_139_afterif - ; source: test_uword_gte.p8:1290 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl3a - ; source: test_uword_gte.p8:1292 goto skip3a - bra p8l_skip3a - ; source: test_uword_gte.p8:1293 lbl3a: fail_uword(77) -p8l_lbl3a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1294 skip3a: -p8l_skip3a - ; source: test_uword_gte.p8:1296 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1297 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1299 goto skip3b - bra p8l_skip3b - ; source: test_uword_gte.p8:1300 lbl3b: fail_uword(78) -p8l_lbl3b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1301 skip3b: -p8l_skip3b - ; source: test_uword_gte.p8:1303 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_141_afterif - ; source: test_uword_gte.p8:1304 fail_uword(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_uword -label_asm_141_afterif - ; source: test_uword_gte.p8:1307 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_143_else - ; source: test_uword_gte.p8:1308 fail_uword(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_uword - bra label_asm_142_afterif -label_asm_143_else - ; source: test_uword_gte.p8:1310 success++ - inc p8b_main.p8v_success -label_asm_142_afterif - ; source: test_uword_gte.p8:1313 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl4a - ; source: test_uword_gte.p8:1315 goto skip4a - bra p8l_skip4a - ; source: test_uword_gte.p8:1316 lbl4a: fail_uword(81) -p8l_lbl4a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1317 skip4a: -p8l_skip4a - ; source: test_uword_gte.p8:1319 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1320 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1322 goto skip4b - bra p8l_skip4b - ; source: test_uword_gte.p8:1323 lbl4b: fail_uword(82) -p8l_lbl4b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1324 skip4b: -p8l_skip4b - ; source: test_uword_gte.p8:1326 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_144_afterif - ; source: test_uword_gte.p8:1327 fail_uword(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_uword -label_asm_144_afterif - ; source: test_uword_gte.p8:1330 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_146_else - ; source: test_uword_gte.p8:1331 fail_uword(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_uword - bra label_asm_145_afterif -label_asm_146_else - ; source: test_uword_gte.p8:1333 success++ - inc p8b_main.p8v_success -label_asm_145_afterif - ; source: test_uword_gte.p8:1335 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:1337 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl5a - ; source: test_uword_gte.p8:1339 goto skip5a - bra p8l_skip5a - ; source: test_uword_gte.p8:1340 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1341 skip5a: -p8l_skip5a - ; source: test_uword_gte.p8:1343 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1344 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1346 goto skip5b - bra p8l_skip5b - ; source: test_uword_gte.p8:1347 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1348 skip5b: -p8l_skip5b - ; source: test_uword_gte.p8:1350 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_147_afterif - ; source: test_uword_gte.p8:1351 success++ - inc p8b_main.p8v_success -label_asm_147_afterif - ; source: test_uword_gte.p8:1354 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_149_else - ; source: test_uword_gte.p8:1355 success++ - inc p8b_main.p8v_success - bra label_asm_148_afterif -label_asm_149_else - ; source: test_uword_gte.p8:1357 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_uword_gte.p8:1360 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl6a - ; source: test_uword_gte.p8:1362 goto skip6a - bra p8l_skip6a - ; source: test_uword_gte.p8:1363 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1364 skip6a: -p8l_skip6a - ; source: test_uword_gte.p8:1366 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1367 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1369 goto skip6b - bra p8l_skip6b - ; source: test_uword_gte.p8:1370 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1371 skip6b: -p8l_skip6b - ; source: test_uword_gte.p8:1373 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_150_afterif - ; source: test_uword_gte.p8:1374 success++ - inc p8b_main.p8v_success -label_asm_150_afterif - ; source: test_uword_gte.p8:1377 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_152_else - ; source: test_uword_gte.p8:1378 success++ - inc p8b_main.p8v_success - bra label_asm_151_afterif -label_asm_152_else - ; source: test_uword_gte.p8:1380 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_uword_gte.p8:1383 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl7a - ; source: test_uword_gte.p8:1385 goto skip7a - bra p8l_skip7a - ; source: test_uword_gte.p8:1386 lbl7a: fail_uword(85) -p8l_lbl7a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1387 skip7a: -p8l_skip7a - ; source: test_uword_gte.p8:1389 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1390 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1392 goto skip7b - bra p8l_skip7b - ; source: test_uword_gte.p8:1393 lbl7b: fail_uword(86) -p8l_lbl7b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1394 skip7b: -p8l_skip7b - ; source: test_uword_gte.p8:1396 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_153_afterif - ; source: test_uword_gte.p8:1397 fail_uword(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_uword -label_asm_153_afterif - ; source: test_uword_gte.p8:1400 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_155_else - ; source: test_uword_gte.p8:1401 fail_uword(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_uword - bra label_asm_154_afterif -label_asm_155_else - ; source: test_uword_gte.p8:1403 success++ - inc p8b_main.p8v_success -label_asm_154_afterif - ; source: test_uword_gte.p8:1406 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl8a - ; source: test_uword_gte.p8:1408 goto skip8a - bra p8l_skip8a - ; source: test_uword_gte.p8:1409 lbl8a: fail_uword(89) -p8l_lbl8a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1410 skip8a: -p8l_skip8a - ; source: test_uword_gte.p8:1412 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1413 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1415 goto skip8b - bra p8l_skip8b - ; source: test_uword_gte.p8:1416 lbl8b: fail_uword(90) -p8l_lbl8b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1417 skip8b: -p8l_skip8b - ; source: test_uword_gte.p8:1419 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_156_afterif - ; source: test_uword_gte.p8:1420 fail_uword(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_uword -label_asm_156_afterif - ; source: test_uword_gte.p8:1423 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_158_else - ; source: test_uword_gte.p8:1424 fail_uword(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_uword - bra label_asm_157_afterif -label_asm_158_else - ; source: test_uword_gte.p8:1426 success++ - inc p8b_main.p8v_success -label_asm_157_afterif - ; source: test_uword_gte.p8:1428 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_gte.p8:1430 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl9a - ; source: test_uword_gte.p8:1432 goto skip9a - bra p8l_skip9a - ; source: test_uword_gte.p8:1433 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1434 skip9a: -p8l_skip9a - ; source: test_uword_gte.p8:1436 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1437 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1439 goto skip9b - bra p8l_skip9b - ; source: test_uword_gte.p8:1440 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1441 skip9b: -p8l_skip9b - ; source: test_uword_gte.p8:1443 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_159_afterif - ; source: test_uword_gte.p8:1444 success++ - inc p8b_main.p8v_success -label_asm_159_afterif - ; source: test_uword_gte.p8:1447 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_161_else - ; source: test_uword_gte.p8:1448 success++ - inc p8b_main.p8v_success - bra label_asm_160_afterif -label_asm_161_else - ; source: test_uword_gte.p8:1450 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_uword_gte.p8:1453 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl10a - ; source: test_uword_gte.p8:1455 goto skip10a - bra p8l_skip10a - ; source: test_uword_gte.p8:1456 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1457 skip10a: -p8l_skip10a - ; source: test_uword_gte.p8:1459 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1460 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1462 goto skip10b - bra p8l_skip10b - ; source: test_uword_gte.p8:1463 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1464 skip10b: -p8l_skip10b - ; source: test_uword_gte.p8:1466 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_162_afterif - ; source: test_uword_gte.p8:1467 success++ - inc p8b_main.p8v_success -label_asm_162_afterif - ; source: test_uword_gte.p8:1470 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_164_else - ; source: test_uword_gte.p8:1471 success++ - inc p8b_main.p8v_success - bra label_asm_163_afterif -label_asm_164_else - ; source: test_uword_gte.p8:1473 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_uword_gte.p8:1476 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl11a - ; source: test_uword_gte.p8:1478 goto skip11a - bra p8l_skip11a - ; source: test_uword_gte.p8:1479 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1480 skip11a: -p8l_skip11a - ; source: test_uword_gte.p8:1482 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1483 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1485 goto skip11b - bra p8l_skip11b - ; source: test_uword_gte.p8:1486 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1487 skip11b: -p8l_skip11b - ; source: test_uword_gte.p8:1489 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_165_afterif - ; source: test_uword_gte.p8:1490 success++ - inc p8b_main.p8v_success -label_asm_165_afterif - ; source: test_uword_gte.p8:1493 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_167_else - ; source: test_uword_gte.p8:1494 success++ - inc p8b_main.p8v_success - bra label_asm_166_afterif -label_asm_167_else - ; source: test_uword_gte.p8:1496 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_uword_gte.p8:1499 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl12a - ; source: test_uword_gte.p8:1501 goto skip12a - bra p8l_skip12a - ; source: test_uword_gte.p8:1502 lbl12a: fail_uword(93) -p8l_lbl12a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1503 skip12a: -p8l_skip12a - ; source: test_uword_gte.p8:1505 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1506 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1508 goto skip12b - bra p8l_skip12b - ; source: test_uword_gte.p8:1509 lbl12b: fail_uword(94) -p8l_lbl12b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_gte.p8:1510 skip12b: -p8l_skip12b - ; source: test_uword_gte.p8:1512 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_168_afterif - ; source: test_uword_gte.p8:1513 fail_uword(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_uword -label_asm_168_afterif - ; source: test_uword_gte.p8:1516 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_170_else - ; source: test_uword_gte.p8:1517 fail_uword(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_uword - bra label_asm_169_afterif -label_asm_170_else - ; source: test_uword_gte.p8:1519 success++ - inc p8b_main.p8v_success -label_asm_169_afterif - ; source: test_uword_gte.p8:1521 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_gte.p8:1523 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl13a - ; source: test_uword_gte.p8:1525 goto skip13a - bra p8l_skip13a - ; source: test_uword_gte.p8:1526 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1527 skip13a: -p8l_skip13a - ; source: test_uword_gte.p8:1529 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1530 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1532 goto skip13b - bra p8l_skip13b - ; source: test_uword_gte.p8:1533 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1534 skip13b: -p8l_skip13b - ; source: test_uword_gte.p8:1536 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_171_afterif - ; source: test_uword_gte.p8:1537 success++ - inc p8b_main.p8v_success -label_asm_171_afterif - ; source: test_uword_gte.p8:1540 if x>=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_173_else - ; source: test_uword_gte.p8:1541 success++ - inc p8b_main.p8v_success - bra label_asm_172_afterif -label_asm_173_else - ; source: test_uword_gte.p8:1543 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_uword_gte.p8:1546 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl14a - ; source: test_uword_gte.p8:1548 goto skip14a - bra p8l_skip14a - ; source: test_uword_gte.p8:1549 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1550 skip14a: -p8l_skip14a - ; source: test_uword_gte.p8:1552 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1553 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1555 goto skip14b - bra p8l_skip14b - ; source: test_uword_gte.p8:1556 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1557 skip14b: -p8l_skip14b - ; source: test_uword_gte.p8:1559 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_174_afterif - ; source: test_uword_gte.p8:1560 success++ - inc p8b_main.p8v_success -label_asm_174_afterif - ; source: test_uword_gte.p8:1563 if x>=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_176_else - ; source: test_uword_gte.p8:1564 success++ - inc p8b_main.p8v_success - bra label_asm_175_afterif -label_asm_176_else - ; source: test_uword_gte.p8:1566 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_uword_gte.p8:1569 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl15a - ; source: test_uword_gte.p8:1571 goto skip15a - bra p8l_skip15a - ; source: test_uword_gte.p8:1572 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1573 skip15a: -p8l_skip15a - ; source: test_uword_gte.p8:1575 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1576 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1578 goto skip15b - bra p8l_skip15b - ; source: test_uword_gte.p8:1579 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1580 skip15b: -p8l_skip15b - ; source: test_uword_gte.p8:1582 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_177_afterif - ; source: test_uword_gte.p8:1583 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_uword_gte.p8:1586 if x>=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_179_else - ; source: test_uword_gte.p8:1587 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_uword_gte.p8:1589 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_uword_gte.p8:1592 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl16a - ; source: test_uword_gte.p8:1594 goto skip16a - bra p8l_skip16a - ; source: test_uword_gte.p8:1595 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1596 skip16a: -p8l_skip16a - ; source: test_uword_gte.p8:1598 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_gte.p8:1599 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_gte.p8:1601 goto skip16b - bra p8l_skip16b - ; source: test_uword_gte.p8:1602 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_gte.p8:1603 skip16b: -p8l_skip16b - ; source: test_uword_gte.p8:1605 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_180_afterif - ; source: test_uword_gte.p8:1606 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_uword_gte.p8:1609 if x>=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_182_else - ; source: test_uword_gte.p8:1610 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_uword_gte.p8:1612 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_uword_gte.p8:1614 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_gte.p8:1235 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .word ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $54 - .byte $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>=number: " - .byte $0d, $3e, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>=var: " - .byte $0d, $3e, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>=expr: " - .byte $0d, $3e, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_uword_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ; source: test_uword_gte.p8:18 txt.print("\n>=number: ") - ; source: test_uword_gte.p8:20 txt.print("\n>=var: ") - ; source: test_uword_gte.p8:22 txt.print("\n>=array[]: ") - ; source: test_uword_gte.p8:24 txt.print("\n>=expr: ") - ; source: test_uword_gte.p8:33 txt.print(" **failed** ") - ; source: test_uword_gte.p8:35 txt.print(" success, expected ") - ; source: test_uword_gte.p8:41 txt.print(" **fail#") - ; source: test_uword_gte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_gte.p8 b/compiler/test/comparisons/test_uword_gte.p8 deleted file mode 100644 index 00a73d2c1..000000000 --- a/compiler/test/comparisons/test_uword_gte.p8 +++ /dev/null @@ -1,1618 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=number: ") - test_cmp_number() - txt.print("\n>=var: ") - test_cmp_var() - txt.print("\n>=array[]: ") - test_cmp_array() - txt.print("\n>=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - uword @shared x - success = 0 - x=0 - ; direct jump - if x>=0 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=0 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl2a - goto skip2a -lbl2a: fail_uword(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=1 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(2) -skip2b: - ; no else - if x>=1 - fail_uword(3) - - ; with else - if x>=1 - fail_uword(4) - else - success++ - - ; direct jump - if x>=30464 - goto lbl3a - goto skip3a -lbl3a: fail_uword(5) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=30464 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(6) -skip3b: - ; no else - if x>=30464 - fail_uword(7) - - ; with else - if x>=30464 - fail_uword(8) - else - success++ - - ; direct jump - if x>=65535 - goto lbl4a - goto skip4a -lbl4a: fail_uword(9) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=65535 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(10) -skip4b: - ; no else - if x>=65535 - fail_uword(11) - - ; with else - if x>=65535 - fail_uword(12) - else - success++ - - x=1 - ; direct jump - if x>=0 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=0 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=1 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=30464 - goto lbl7a - goto skip7a -lbl7a: fail_uword(13) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=30464 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(14) -skip7b: - ; no else - if x>=30464 - fail_uword(15) - - ; with else - if x>=30464 - fail_uword(16) - else - success++ - - ; direct jump - if x>=65535 - goto lbl8a - goto skip8a -lbl8a: fail_uword(17) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=65535 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(18) -skip8b: - ; no else - if x>=65535 - fail_uword(19) - - ; with else - if x>=65535 - fail_uword(20) - else - success++ - - x=30464 - ; direct jump - if x>=0 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=0 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=1 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=30464 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=30464 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x>=30464 - success++ - - ; with else - if x>=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=65535 - goto lbl12a - goto skip12a -lbl12a: fail_uword(21) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=65535 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(22) -skip12b: - ; no else - if x>=65535 - fail_uword(23) - - ; with else - if x>=65535 - fail_uword(24) - else - success++ - - x=65535 - ; direct jump - if x>=0 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=0 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=1 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=30464 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=30464 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=30464 - success++ - - ; with else - if x>=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=65535 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=65535 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=65535 - success++ - - ; with else - if x>=65535 - success++ - else - cx16.r0L++ - - verify_success(46) -} - sub test_cmp_var() { - uword @shared x, value - success = 0 - x=0 - value=0 - ; direct jump - if x>=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl2a - goto skip2a -lbl2a: fail_uword(25) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=value - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(26) -skip2b: - ; no else - if x>=value - fail_uword(27) - - ; with else - if x>=value - fail_uword(28) - else - success++ - - value=30464 - ; direct jump - if x>=value - goto lbl3a - goto skip3a -lbl3a: fail_uword(29) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=value - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(30) -skip3b: - ; no else - if x>=value - fail_uword(31) - - ; with else - if x>=value - fail_uword(32) - else - success++ - - value=65535 - ; direct jump - if x>=value - goto lbl4a - goto skip4a -lbl4a: fail_uword(33) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=value - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(34) -skip4b: - ; no else - if x>=value - fail_uword(35) - - ; with else - if x>=value - fail_uword(36) - else - success++ - - x=1 - value=0 - ; direct jump - if x>=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>=value - goto lbl7a - goto skip7a -lbl7a: fail_uword(37) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=value - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(38) -skip7b: - ; no else - if x>=value - fail_uword(39) - - ; with else - if x>=value - fail_uword(40) - else - success++ - - value=65535 - ; direct jump - if x>=value - goto lbl8a - goto skip8a -lbl8a: fail_uword(41) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=value - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(42) -skip8b: - ; no else - if x>=value - fail_uword(43) - - ; with else - if x>=value - fail_uword(44) - else - success++ - - x=30464 - value=0 - ; direct jump - if x>=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=value - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>=value - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=value - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x>=value - goto lbl12a - goto skip12a -lbl12a: fail_uword(45) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=value - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(46) -skip12b: - ; no else - if x>=value - fail_uword(47) - - ; with else - if x>=value - fail_uword(48) - else - success++ - - x=65535 - value=0 - ; direct jump - if x>=value - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=value - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=value - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>=value - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=value - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x>=value - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=value - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - verify_success(46) -} - sub test_cmp_array() { - uword @shared x - uword[] values = [0, 0] - success = 0 - x=0 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(49) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(50) -skip2b: - ; no else - if x>=values[1] - fail_uword(51) - - ; with else - if x>=values[1] - fail_uword(52) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(53) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(54) -skip3b: - ; no else - if x>=values[1] - fail_uword(55) - - ; with else - if x>=values[1] - fail_uword(56) - else - success++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(57) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(58) -skip4b: - ; no else - if x>=values[1] - fail_uword(59) - - ; with else - if x>=values[1] - fail_uword(60) - else - success++ - - x=1 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(61) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(62) -skip7b: - ; no else - if x>=values[1] - fail_uword(63) - - ; with else - if x>=values[1] - fail_uword(64) - else - success++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(65) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(66) -skip8b: - ; no else - if x>=values[1] - fail_uword(67) - - ; with else - if x>=values[1] - fail_uword(68) - else - success++ - - x=30464 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(69) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(70) -skip12b: - ; no else - if x>=values[1] - fail_uword(71) - - ; with else - if x>=values[1] - fail_uword(72) - else - success++ - - x=65535 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - verify_success(46) -} - sub test_cmp_expr() { - uword @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x>=cx16.r4+0-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+1-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: fail_uword(73) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(74) -skip2b: - ; no else - if x>=cx16.r4+1-cx16.r5 - fail_uword(75) - - ; with else - if x>=cx16.r4+1-cx16.r5 - fail_uword(76) - else - success++ - - ; direct jump - if x>=cx16.r4+30464-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: fail_uword(77) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(78) -skip3b: - ; no else - if x>=cx16.r4+30464-cx16.r5 - fail_uword(79) - - ; with else - if x>=cx16.r4+30464-cx16.r5 - fail_uword(80) - else - success++ - - ; direct jump - if x>=cx16.r4+65535-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: fail_uword(81) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(82) -skip4b: - ; no else - if x>=cx16.r4+65535-cx16.r5 - fail_uword(83) - - ; with else - if x>=cx16.r4+65535-cx16.r5 - fail_uword(84) - else - success++ - - x=1 - ; direct jump - if x>=cx16.r4+0-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+1-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x>=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+30464-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: fail_uword(85) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(86) -skip7b: - ; no else - if x>=cx16.r4+30464-cx16.r5 - fail_uword(87) - - ; with else - if x>=cx16.r4+30464-cx16.r5 - fail_uword(88) - else - success++ - - ; direct jump - if x>=cx16.r4+65535-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: fail_uword(89) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(90) -skip8b: - ; no else - if x>=cx16.r4+65535-cx16.r5 - fail_uword(91) - - ; with else - if x>=cx16.r4+65535-cx16.r5 - fail_uword(92) - else - success++ - - x=30464 - ; direct jump - if x>=cx16.r4+0-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x>=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: fail_uword(93) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(94) -skip12b: - ; no else - if x>=cx16.r4+65535-cx16.r5 - fail_uword(95) - - ; with else - if x>=cx16.r4+65535-cx16.r5 - fail_uword(96) - else - success++ - - x=65535 - ; direct jump - if x>=cx16.r4+0-cx16.r5 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>=cx16.r4+0-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+1-cx16.r5 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+30464-cx16.r5 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4+65535-cx16.r5 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x>=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - verify_success(46) -} - -} - diff --git a/compiler/test/comparisons/test_uword_lt.asm b/compiler/test/comparisons/test_uword_lt.asm deleted file mode 100644 index 349cb03a9..000000000 --- a/compiler/test/comparisons/test_uword_lt.asm +++ /dev/null @@ -1,12754 +0,0 @@ -; w65c02 assembly code for 'test_uword_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:44 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_lt.p8:9 ubyte success = 0 - ; source: test_uword_lt.p8:10 str datatype = "uword" - ; source: test_uword_lt.p8:11 uword @shared comparison - ; source: test_uword_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_lt.p8:14 txt.print("\nless-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:80 skip1a: -p8l_skip1a - ; source: test_uword_lt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_uword_lt.p8:86 lbl1b: fail_uword(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:87 skip1b: -p8l_skip1b - ; source: test_uword_lt.p8:96 success++ - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:99 if x<1 - lda p8v_x - ora p8v_x+1 - beq p8l_lbl2a - ; source: test_uword_lt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_uword_lt.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:103 skip2a: -p8l_skip2a - ; source: test_uword_lt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:106 if x<1 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_uword_lt.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:110 skip2b: -p8l_skip2b - ; source: test_uword_lt.p8:112 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_3_afterif - ; source: test_uword_lt.p8:113 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_uword_lt.p8:116 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_5_else - ; source: test_uword_lt.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_lt.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_uword_lt.p8:122 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc p8l_lbl3a - bne + - cmp #<$7700 - bcc p8l_lbl3a -+ - ; source: test_uword_lt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_uword_lt.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:126 skip3a: -p8l_skip3a - ; source: test_uword_lt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:129 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc _jump -+ bne + - cmp #<$7700 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_uword_lt.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:133 skip3b: -p8l_skip3b - ; source: test_uword_lt.p8:135 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_6_afterif - ; source: test_uword_lt.p8:136 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_uword_lt.p8:139 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_8_else - ; source: test_uword_lt.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_lt.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_uword_lt.p8:145 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc p8l_lbl4a - bne + - cmp #<$ffff - bcc p8l_lbl4a -+ - ; source: test_uword_lt.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_uword_lt.p8:148 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:149 skip4a: -p8l_skip4a - ; source: test_uword_lt.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:152 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc _jump -+ bne + - cmp #<$ffff - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_uword_lt.p8:155 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:156 skip4b: -p8l_skip4b - ; source: test_uword_lt.p8:158 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_9_afterif - ; source: test_uword_lt.p8:159 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_uword_lt.p8:162 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_11_else - ; source: test_uword_lt.p8:163 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_lt.p8:165 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_uword_lt.p8:167 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_uword_lt.p8:172 lbl5a: fail_uword(5) -p8l_lbl5a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:173 skip5a: -p8l_skip5a - ; source: test_uword_lt.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_uword_lt.p8:179 lbl5b: fail_uword(6) -p8l_lbl5b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:180 skip5b: -p8l_skip5b - ; source: test_uword_lt.p8:189 success++ - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:192 if x<1 - lda p8v_x - ora p8v_x+1 - beq p8l_lbl6a - ; source: test_uword_lt.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_uword_lt.p8:195 lbl6a: fail_uword(9) -p8l_lbl6a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:196 skip6a: -p8l_skip6a - ; source: test_uword_lt.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:199 if x<1 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_uword_lt.p8:202 lbl6b: fail_uword(10) -p8l_lbl6b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:203 skip6b: -p8l_skip6b - ; source: test_uword_lt.p8:205 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_12_afterif - ; source: test_uword_lt.p8:206 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_12_afterif - ; source: test_uword_lt.p8:209 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_14_else - ; source: test_uword_lt.p8:210 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_lt.p8:212 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_uword_lt.p8:215 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc p8l_lbl7a - bne + - cmp #<$7700 - bcc p8l_lbl7a -+ - ; source: test_uword_lt.p8:217 goto skip7a - bra p8l_skip7a - ; source: test_uword_lt.p8:218 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:219 skip7a: -p8l_skip7a - ; source: test_uword_lt.p8:221 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:222 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc _jump -+ bne + - cmp #<$7700 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:224 goto skip7b - bra p8l_skip7b - ; source: test_uword_lt.p8:225 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:226 skip7b: -p8l_skip7b - ; source: test_uword_lt.p8:228 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_15_afterif - ; source: test_uword_lt.p8:229 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_uword_lt.p8:232 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_17_else - ; source: test_uword_lt.p8:233 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_lt.p8:235 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_uword_lt.p8:238 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc p8l_lbl8a - bne + - cmp #<$ffff - bcc p8l_lbl8a -+ - ; source: test_uword_lt.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_uword_lt.p8:241 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:242 skip8a: -p8l_skip8a - ; source: test_uword_lt.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:245 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc _jump -+ bne + - cmp #<$ffff - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_uword_lt.p8:248 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:249 skip8b: -p8l_skip8b - ; source: test_uword_lt.p8:251 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_18_afterif - ; source: test_uword_lt.p8:252 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_uword_lt.p8:255 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_20_else - ; source: test_uword_lt.p8:256 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_lt.p8:258 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_uword_lt.p8:260 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_uword_lt.p8:265 lbl9a: fail_uword(13) -p8l_lbl9a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:266 skip9a: -p8l_skip9a - ; source: test_uword_lt.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_uword_lt.p8:272 lbl9b: fail_uword(14) -p8l_lbl9b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:273 skip9b: -p8l_skip9b - ; source: test_uword_lt.p8:282 success++ - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:285 if x<1 - lda p8v_x - ora p8v_x+1 - beq p8l_lbl10a - ; source: test_uword_lt.p8:287 goto skip10a - bra p8l_skip10a - ; source: test_uword_lt.p8:288 lbl10a: fail_uword(17) -p8l_lbl10a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:289 skip10a: -p8l_skip10a - ; source: test_uword_lt.p8:291 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:292 if x<1 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:294 goto skip10b - bra p8l_skip10b - ; source: test_uword_lt.p8:295 lbl10b: fail_uword(18) -p8l_lbl10b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:296 skip10b: -p8l_skip10b - ; source: test_uword_lt.p8:298 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_21_afterif - ; source: test_uword_lt.p8:299 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_21_afterif - ; source: test_uword_lt.p8:302 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_23_else - ; source: test_uword_lt.p8:303 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_lt.p8:305 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_uword_lt.p8:308 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc p8l_lbl11a - bne + - cmp #<$7700 - bcc p8l_lbl11a -+ - ; source: test_uword_lt.p8:310 goto skip11a - bra p8l_skip11a - ; source: test_uword_lt.p8:311 lbl11a: fail_uword(21) -p8l_lbl11a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:312 skip11a: -p8l_skip11a - ; source: test_uword_lt.p8:314 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:315 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc _jump -+ bne + - cmp #<$7700 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:317 goto skip11b - bra p8l_skip11b - ; source: test_uword_lt.p8:318 lbl11b: fail_uword(22) -p8l_lbl11b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:319 skip11b: -p8l_skip11b - ; source: test_uword_lt.p8:321 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_24_afterif - ; source: test_uword_lt.p8:322 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_24_afterif - ; source: test_uword_lt.p8:325 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_26_else - ; source: test_uword_lt.p8:326 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_lt.p8:328 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_uword_lt.p8:331 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc p8l_lbl12a - bne + - cmp #<$ffff - bcc p8l_lbl12a -+ - ; source: test_uword_lt.p8:333 goto skip12a - bra p8l_skip12a - ; source: test_uword_lt.p8:334 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:335 skip12a: -p8l_skip12a - ; source: test_uword_lt.p8:337 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:338 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc _jump -+ bne + - cmp #<$ffff - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:340 goto skip12b - bra p8l_skip12b - ; source: test_uword_lt.p8:341 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:342 skip12b: -p8l_skip12b - ; source: test_uword_lt.p8:344 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_27_afterif - ; source: test_uword_lt.p8:345 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_uword_lt.p8:348 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_29_else - ; source: test_uword_lt.p8:349 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_lt.p8:351 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_uword_lt.p8:353 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_lt.p8:357 goto skip13a - bra p8l_skip13a - ; source: test_uword_lt.p8:358 lbl13a: fail_uword(25) -p8l_lbl13a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:359 skip13a: -p8l_skip13a - ; source: test_uword_lt.p8:361 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:364 goto skip13b - bra p8l_skip13b - ; source: test_uword_lt.p8:365 lbl13b: fail_uword(26) -p8l_lbl13b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:366 skip13b: -p8l_skip13b - ; source: test_uword_lt.p8:375 success++ - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:378 if x<1 - lda p8v_x - ora p8v_x+1 - beq p8l_lbl14a - ; source: test_uword_lt.p8:380 goto skip14a - bra p8l_skip14a - ; source: test_uword_lt.p8:381 lbl14a: fail_uword(29) -p8l_lbl14a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:382 skip14a: -p8l_skip14a - ; source: test_uword_lt.p8:384 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:385 if x<1 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:387 goto skip14b - bra p8l_skip14b - ; source: test_uword_lt.p8:388 lbl14b: fail_uword(30) -p8l_lbl14b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:389 skip14b: -p8l_skip14b - ; source: test_uword_lt.p8:391 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_30_afterif - ; source: test_uword_lt.p8:392 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_30_afterif - ; source: test_uword_lt.p8:395 if x<1 - lda p8v_x - ora p8v_x+1 - bne label_asm_32_else - ; source: test_uword_lt.p8:396 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_lt.p8:398 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_uword_lt.p8:401 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc p8l_lbl15a - bne + - cmp #<$7700 - bcc p8l_lbl15a -+ - ; source: test_uword_lt.p8:403 goto skip15a - bra p8l_skip15a - ; source: test_uword_lt.p8:404 lbl15a: fail_uword(33) -p8l_lbl15a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:405 skip15a: -p8l_skip15a - ; source: test_uword_lt.p8:407 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:408 if x<30464 - ldy p8v_x+1 - lda p8v_x - cpy #>$7700 - bcc _jump -+ bne + - cmp #<$7700 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:410 goto skip15b - bra p8l_skip15b - ; source: test_uword_lt.p8:411 lbl15b: fail_uword(34) -p8l_lbl15b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:412 skip15b: -p8l_skip15b - ; source: test_uword_lt.p8:414 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_33_afterif - ; source: test_uword_lt.p8:415 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_33_afterif - ; source: test_uword_lt.p8:418 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bcs label_asm_35_else - ; source: test_uword_lt.p8:419 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_lt.p8:421 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_uword_lt.p8:424 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc p8l_lbl16a - bne + - cmp #<$ffff - bcc p8l_lbl16a -+ - ; source: test_uword_lt.p8:426 goto skip16a - bra p8l_skip16a - ; source: test_uword_lt.p8:427 lbl16a: fail_uword(37) -p8l_lbl16a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:428 skip16a: -p8l_skip16a - ; source: test_uword_lt.p8:430 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:431 if x<65535 - ldy p8v_x+1 - lda p8v_x - cpy #>$ffff - bcc _jump -+ bne + - cmp #<$ffff - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:433 goto skip16b - bra p8l_skip16b - ; source: test_uword_lt.p8:434 lbl16b: fail_uword(38) -p8l_lbl16b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:435 skip16b: -p8l_skip16b - ; source: test_uword_lt.p8:437 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_36_afterif - ; source: test_uword_lt.p8:438 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_36_afterif - ; source: test_uword_lt.p8:441 if x<65535 - ldy p8v_x+1 - lda p8v_x - cmp #<$ffff - tya - sbc #>$ffff - bcs label_asm_38_else - ; source: test_uword_lt.p8:442 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_lt.p8:444 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_uword_lt.p8:446 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_lt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_lt.p8:448 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_uword_lt.p8:449 uword @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_uword_lt.p8:450 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_lt.p8:451 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lt.p8:452 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lt.p8:454 if x$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:458 skip1a: -p8l_skip1a - ; source: test_uword_lt.p8:460 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:461 if x$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:465 skip1b: -p8l_skip1b - ; source: test_uword_lt.p8:467 if x$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_39_afterif - ; source: test_uword_lt.p8:471 if x$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_lt.p8:474 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_uword_lt.p8:476 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:478 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:485 if x$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:502 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:509 if xp8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:533 if x1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:549 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lt.p8:551 if x$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:555 skip5a: -p8l_skip5a - ; source: test_uword_lt.p8:557 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:558 if x$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:562 skip5b: -p8l_skip5b - ; source: test_uword_lt.p8:564 if x$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_51_afterif - ; source: test_uword_lt.p8:568 if x$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_lt.p8:571 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_uword_lt.p8:573 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:575 if x$31 - lda #<$31 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:579 skip6a: -p8l_skip6a - ; source: test_uword_lt.p8:581 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:582 if x$32 - lda #<$32 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:586 skip6b: -p8l_skip6b - ; source: test_uword_lt.p8:588 if x$33 - lda #<$33 - jsr p8b_main.p8s_fail_uword -label_asm_54_afterif - ; source: test_uword_lt.p8:592 if x$34 - lda #<$34 - jsr p8b_main.p8s_fail_uword - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_lt.p8:595 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_uword_lt.p8:597 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:599 if xp8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:606 if xp8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:630 if x$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:646 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lt.p8:648 if x$35 - lda #<$35 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:652 skip9a: -p8l_skip9a - ; source: test_uword_lt.p8:654 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:655 if x$36 - lda #<$36 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:659 skip9b: -p8l_skip9b - ; source: test_uword_lt.p8:661 if x$37 - lda #<$37 - jsr p8b_main.p8s_fail_uword -label_asm_63_afterif - ; source: test_uword_lt.p8:665 if x$38 - lda #<$38 - jsr p8b_main.p8s_fail_uword - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_lt.p8:668 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_uword_lt.p8:670 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:672 if x$39 - lda #<$39 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:676 skip10a: -p8l_skip10a - ; source: test_uword_lt.p8:678 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:679 if x$3a - lda #<$3a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:683 skip10b: -p8l_skip10b - ; source: test_uword_lt.p8:685 if x$3b - lda #<$3b - jsr p8b_main.p8s_fail_uword -label_asm_66_afterif - ; source: test_uword_lt.p8:689 if x$3c - lda #<$3c - jsr p8b_main.p8s_fail_uword - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_lt.p8:692 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_uword_lt.p8:694 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:696 if x$3d - lda #<$3d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:700 skip11a: -p8l_skip11a - ; source: test_uword_lt.p8:702 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:703 if x$3e - lda #<$3e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:707 skip11b: -p8l_skip11b - ; source: test_uword_lt.p8:709 if x$3f - lda #<$3f - jsr p8b_main.p8s_fail_uword -label_asm_69_afterif - ; source: test_uword_lt.p8:713 if x$40 - lda #<$40 - jsr p8b_main.p8s_fail_uword - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_lt.p8:716 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_uword_lt.p8:718 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_lt.p8:720 if xp8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:727 if x$41 - lda #<$41 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:749 skip13a: -p8l_skip13a - ; source: test_uword_lt.p8:751 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:752 if x$42 - lda #<$42 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:756 skip13b: -p8l_skip13b - ; source: test_uword_lt.p8:758 if x$43 - lda #<$43 - jsr p8b_main.p8s_fail_uword -label_asm_75_afterif - ; source: test_uword_lt.p8:762 if x$44 - lda #<$44 - jsr p8b_main.p8s_fail_uword - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_lt.p8:765 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_uword_lt.p8:767 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:769 if x$45 - lda #<$45 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:773 skip14a: -p8l_skip14a - ; source: test_uword_lt.p8:775 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:776 if x$46 - lda #<$46 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:780 skip14b: -p8l_skip14b - ; source: test_uword_lt.p8:782 if x$47 - lda #<$47 - jsr p8b_main.p8s_fail_uword -label_asm_78_afterif - ; source: test_uword_lt.p8:786 if x$48 - lda #<$48 - jsr p8b_main.p8s_fail_uword - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_lt.p8:789 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_uword_lt.p8:791 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lt.p8:793 if x$49 - lda #<$49 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:797 skip15a: -p8l_skip15a - ; source: test_uword_lt.p8:799 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:800 if x$4a - lda #<$4a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:804 skip15b: -p8l_skip15b - ; source: test_uword_lt.p8:806 if x$4b - lda #<$4b - jsr p8b_main.p8s_fail_uword -label_asm_81_afterif - ; source: test_uword_lt.p8:810 if x$4c - lda #<$4c - jsr p8b_main.p8s_fail_uword - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_lt.p8:813 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_uword_lt.p8:815 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_lt.p8:817 if x$4d - lda #<$4d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:821 skip16a: -p8l_skip16a - ; source: test_uword_lt.p8:823 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:824 if x$4e - lda #<$4e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:828 skip16b: -p8l_skip16b - ; source: test_uword_lt.p8:830 if x$4f - lda #<$4f - jsr p8b_main.p8s_fail_uword -label_asm_84_afterif - ; source: test_uword_lt.p8:834 if x$50 - lda #<$50 - jsr p8b_main.p8s_fail_uword - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_lt.p8:837 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_uword_lt.p8:839 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_lt.p8:448 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .word ? -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_lt.p8:841 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_uword_lt.p8:842 uword @shared x - ; source: test_uword_lt.p8:843 uword[] values = [0, 0] - ; source: test_uword_lt.p8:842 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lt.p8:844 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_lt.p8:845 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lt.p8:846 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lt.p8:848 if x$51 - lda #<$51 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:852 skip1a: -p8l_skip1a - ; source: test_uword_lt.p8:854 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:855 if x$52 - lda #<$52 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:859 skip1b: -p8l_skip1b - ; source: test_uword_lt.p8:861 if x$53 - lda #<$53 - jsr p8b_main.p8s_fail_uword -label_asm_87_afterif - ; source: test_uword_lt.p8:865 if x$54 - lda #<$54 - jsr p8b_main.p8s_fail_uword - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_lt.p8:868 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_uword_lt.p8:870 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lt.p8:872 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:879 if x$7700 - sta p8v_values+1,y - ; source: test_uword_lt.p8:896 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:903 if x$ffff - sta p8v_values+1,y - ; source: test_uword_lt.p8:920 if xp8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:927 if x1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:943 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lt.p8:945 if x$55 - lda #<$55 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:949 skip5a: -p8l_skip5a - ; source: test_uword_lt.p8:951 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:952 if x$56 - lda #<$56 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:956 skip5b: -p8l_skip5b - ; source: test_uword_lt.p8:958 if x$57 - lda #<$57 - jsr p8b_main.p8s_fail_uword -label_asm_99_afterif - ; source: test_uword_lt.p8:962 if x$58 - lda #<$58 - jsr p8b_main.p8s_fail_uword - bra label_asm_100_afterif -label_asm_101_else - ; source: test_uword_lt.p8:965 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_uword_lt.p8:967 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lt.p8:969 if x$59 - lda #<$59 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:973 skip6a: -p8l_skip6a - ; source: test_uword_lt.p8:975 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:976 if x$5a - lda #<$5a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:980 skip6b: -p8l_skip6b - ; source: test_uword_lt.p8:982 if x$5b - lda #<$5b - jsr p8b_main.p8s_fail_uword -label_asm_102_afterif - ; source: test_uword_lt.p8:986 if x$5c - lda #<$5c - jsr p8b_main.p8s_fail_uword - bra label_asm_103_afterif -label_asm_104_else - ; source: test_uword_lt.p8:989 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_uword_lt.p8:991 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lt.p8:993 if xp8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1000 if x$ffff - sta p8v_values+1,y - ; source: test_uword_lt.p8:1017 if xp8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1024 if x$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:1040 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lt.p8:1042 if x$5d - lda #<$5d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1046 skip9a: -p8l_skip9a - ; source: test_uword_lt.p8:1048 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1049 if x$5e - lda #<$5e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1053 skip9b: -p8l_skip9b - ; source: test_uword_lt.p8:1055 if x$5f - lda #<$5f - jsr p8b_main.p8s_fail_uword -label_asm_111_afterif - ; source: test_uword_lt.p8:1059 if x$60 - lda #<$60 - jsr p8b_main.p8s_fail_uword - bra label_asm_112_afterif -label_asm_113_else - ; source: test_uword_lt.p8:1062 success++ - inc p8b_main.p8v_success -label_asm_112_afterif - ; source: test_uword_lt.p8:1064 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lt.p8:1066 if x$61 - lda #<$61 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1070 skip10a: -p8l_skip10a - ; source: test_uword_lt.p8:1072 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1073 if x$62 - lda #<$62 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1077 skip10b: -p8l_skip10b - ; source: test_uword_lt.p8:1079 if x$63 - lda #<$63 - jsr p8b_main.p8s_fail_uword -label_asm_114_afterif - ; source: test_uword_lt.p8:1083 if x$64 - lda #<$64 - jsr p8b_main.p8s_fail_uword - bra label_asm_115_afterif -label_asm_116_else - ; source: test_uword_lt.p8:1086 success++ - inc p8b_main.p8v_success -label_asm_115_afterif - ; source: test_uword_lt.p8:1088 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lt.p8:1090 if x$65 - lda #<$65 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1094 skip11a: -p8l_skip11a - ; source: test_uword_lt.p8:1096 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1097 if x$66 - lda #<$66 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1101 skip11b: -p8l_skip11b - ; source: test_uword_lt.p8:1103 if x$67 - lda #<$67 - jsr p8b_main.p8s_fail_uword -label_asm_117_afterif - ; source: test_uword_lt.p8:1107 if x$68 - lda #<$68 - jsr p8b_main.p8s_fail_uword - bra label_asm_118_afterif -label_asm_119_else - ; source: test_uword_lt.p8:1110 success++ - inc p8b_main.p8v_success -label_asm_118_afterif - ; source: test_uword_lt.p8:1112 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_lt.p8:1114 if xp8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1121 if x$69 - lda #<$69 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1143 skip13a: -p8l_skip13a - ; source: test_uword_lt.p8:1145 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1146 if x$6a - lda #<$6a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1150 skip13b: -p8l_skip13b - ; source: test_uword_lt.p8:1152 if x$6b - lda #<$6b - jsr p8b_main.p8s_fail_uword -label_asm_123_afterif - ; source: test_uword_lt.p8:1156 if x$6c - lda #<$6c - jsr p8b_main.p8s_fail_uword - bra label_asm_124_afterif -label_asm_125_else - ; source: test_uword_lt.p8:1159 success++ - inc p8b_main.p8v_success -label_asm_124_afterif - ; source: test_uword_lt.p8:1161 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lt.p8:1163 if x$6d - lda #<$6d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1167 skip14a: -p8l_skip14a - ; source: test_uword_lt.p8:1169 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1170 if x$6e - lda #<$6e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1174 skip14b: -p8l_skip14b - ; source: test_uword_lt.p8:1176 if x$6f - lda #<$6f - jsr p8b_main.p8s_fail_uword -label_asm_126_afterif - ; source: test_uword_lt.p8:1180 if x$70 - lda #<$70 - jsr p8b_main.p8s_fail_uword - bra label_asm_127_afterif -label_asm_128_else - ; source: test_uword_lt.p8:1183 success++ - inc p8b_main.p8v_success -label_asm_127_afterif - ; source: test_uword_lt.p8:1185 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lt.p8:1187 if x$71 - lda #<$71 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1191 skip15a: -p8l_skip15a - ; source: test_uword_lt.p8:1193 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1194 if x$72 - lda #<$72 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1198 skip15b: -p8l_skip15b - ; source: test_uword_lt.p8:1200 if x$73 - lda #<$73 - jsr p8b_main.p8s_fail_uword -label_asm_129_afterif - ; source: test_uword_lt.p8:1204 if x$74 - lda #<$74 - jsr p8b_main.p8s_fail_uword - bra label_asm_130_afterif -label_asm_131_else - ; source: test_uword_lt.p8:1207 success++ - inc p8b_main.p8v_success -label_asm_130_afterif - ; source: test_uword_lt.p8:1209 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_lt.p8:1211 if x$75 - lda #<$75 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1215 skip16a: -p8l_skip16a - ; source: test_uword_lt.p8:1217 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1218 if x$76 - lda #<$76 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1222 skip16b: -p8l_skip16b - ; source: test_uword_lt.p8:1224 if x$77 - lda #<$77 - jsr p8b_main.p8s_fail_uword -label_asm_132_afterif - ; source: test_uword_lt.p8:1228 if x$78 - lda #<$78 - jsr p8b_main.p8s_fail_uword - bra label_asm_133_afterif -label_asm_134_else - ; source: test_uword_lt.p8:1231 success++ - inc p8b_main.p8v_success -label_asm_133_afterif - ; source: test_uword_lt.p8:1233 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_lt.p8:841 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -p8v_values .word $0000, $0000 - .pend - ; source: test_uword_lt.p8:1235 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_uword_lt.p8:1236 uword @shared x - ; source: test_uword_lt.p8:1239 float @shared f4 = 1.0 - ; source: test_uword_lt.p8:1240 float @shared f5 = 1.0 - ; source: test_uword_lt.p8:1236 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lt.p8:1237 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_lt.p8:1238 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_lt.p8:1239 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_uword_lt.p8:1240 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_uword_lt.p8:1241 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_lt.p8:1242 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lt.p8:1244 if x$79 - lda #<$79 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1248 skip1a: -p8l_skip1a - ; source: test_uword_lt.p8:1250 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1251 if x$7a - lda #<$7a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1255 skip1b: -p8l_skip1b - ; source: test_uword_lt.p8:1257 if x$7b - lda #<$7b - jsr p8b_main.p8s_fail_uword -label_asm_135_afterif - ; source: test_uword_lt.p8:1261 if x$7c - lda #<$7c - jsr p8b_main.p8s_fail_uword - bra label_asm_136_afterif -label_asm_137_else - ; source: test_uword_lt.p8:1264 success++ - inc p8b_main.p8v_success -label_asm_136_afterif - ; source: test_uword_lt.p8:1267 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl2a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl2a -+ - ; source: test_uword_lt.p8:1269 goto skip2a - bra p8l_skip2a - ; source: test_uword_lt.p8:1270 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1271 skip2a: -p8l_skip2a - ; source: test_uword_lt.p8:1273 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1274 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1276 goto skip2b - bra p8l_skip2b - ; source: test_uword_lt.p8:1277 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1278 skip2b: -p8l_skip2b - ; source: test_uword_lt.p8:1280 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_138_afterif - ; source: test_uword_lt.p8:1281 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_uword_lt.p8:1284 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_140_else - ; source: test_uword_lt.p8:1285 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_uword_lt.p8:1287 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_uword_lt.p8:1290 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl3a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl3a -+ - ; source: test_uword_lt.p8:1292 goto skip3a - bra p8l_skip3a - ; source: test_uword_lt.p8:1293 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1294 skip3a: -p8l_skip3a - ; source: test_uword_lt.p8:1296 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1297 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1299 goto skip3b - bra p8l_skip3b - ; source: test_uword_lt.p8:1300 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1301 skip3b: -p8l_skip3b - ; source: test_uword_lt.p8:1303 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_141_afterif - ; source: test_uword_lt.p8:1304 success++ - inc p8b_main.p8v_success -label_asm_141_afterif - ; source: test_uword_lt.p8:1307 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_143_else - ; source: test_uword_lt.p8:1308 success++ - inc p8b_main.p8v_success - bra label_asm_142_afterif -label_asm_143_else - ; source: test_uword_lt.p8:1310 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_uword_lt.p8:1313 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl4a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl4a -+ - ; source: test_uword_lt.p8:1315 goto skip4a - bra p8l_skip4a - ; source: test_uword_lt.p8:1316 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1317 skip4a: -p8l_skip4a - ; source: test_uword_lt.p8:1319 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1320 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1322 goto skip4b - bra p8l_skip4b - ; source: test_uword_lt.p8:1323 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1324 skip4b: -p8l_skip4b - ; source: test_uword_lt.p8:1326 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_144_afterif - ; source: test_uword_lt.p8:1327 success++ - inc p8b_main.p8v_success -label_asm_144_afterif - ; source: test_uword_lt.p8:1330 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_146_else - ; source: test_uword_lt.p8:1331 success++ - inc p8b_main.p8v_success - bra label_asm_145_afterif -label_asm_146_else - ; source: test_uword_lt.p8:1333 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_uword_lt.p8:1335 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:1337 if x$7d - lda #<$7d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1341 skip5a: -p8l_skip5a - ; source: test_uword_lt.p8:1343 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1344 if x$7e - lda #<$7e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1348 skip5b: -p8l_skip5b - ; source: test_uword_lt.p8:1350 if x$7f - lda #<$7f - jsr p8b_main.p8s_fail_uword -label_asm_147_afterif - ; source: test_uword_lt.p8:1354 if x$80 - lda #<$80 - jsr p8b_main.p8s_fail_uword - bra label_asm_148_afterif -label_asm_149_else - ; source: test_uword_lt.p8:1357 success++ - inc p8b_main.p8v_success -label_asm_148_afterif - ; source: test_uword_lt.p8:1360 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl6a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl6a -+ - ; source: test_uword_lt.p8:1362 goto skip6a - bra p8l_skip6a - ; source: test_uword_lt.p8:1363 lbl6a: fail_uword(129) -p8l_lbl6a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1364 skip6a: -p8l_skip6a - ; source: test_uword_lt.p8:1366 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1367 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1369 goto skip6b - bra p8l_skip6b - ; source: test_uword_lt.p8:1370 lbl6b: fail_uword(130) -p8l_lbl6b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1371 skip6b: -p8l_skip6b - ; source: test_uword_lt.p8:1373 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_150_afterif - ; source: test_uword_lt.p8:1374 fail_uword(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_uword -label_asm_150_afterif - ; source: test_uword_lt.p8:1377 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_152_else - ; source: test_uword_lt.p8:1378 fail_uword(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_uword - bra label_asm_151_afterif -label_asm_152_else - ; source: test_uword_lt.p8:1380 success++ - inc p8b_main.p8v_success -label_asm_151_afterif - ; source: test_uword_lt.p8:1383 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl7a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl7a -+ - ; source: test_uword_lt.p8:1385 goto skip7a - bra p8l_skip7a - ; source: test_uword_lt.p8:1386 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1387 skip7a: -p8l_skip7a - ; source: test_uword_lt.p8:1389 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1390 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1392 goto skip7b - bra p8l_skip7b - ; source: test_uword_lt.p8:1393 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1394 skip7b: -p8l_skip7b - ; source: test_uword_lt.p8:1396 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_153_afterif - ; source: test_uword_lt.p8:1397 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_uword_lt.p8:1400 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_155_else - ; source: test_uword_lt.p8:1401 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_uword_lt.p8:1403 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_uword_lt.p8:1406 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl8a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl8a -+ - ; source: test_uword_lt.p8:1408 goto skip8a - bra p8l_skip8a - ; source: test_uword_lt.p8:1409 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1410 skip8a: -p8l_skip8a - ; source: test_uword_lt.p8:1412 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1413 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1415 goto skip8b - bra p8l_skip8b - ; source: test_uword_lt.p8:1416 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1417 skip8b: -p8l_skip8b - ; source: test_uword_lt.p8:1419 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_156_afterif - ; source: test_uword_lt.p8:1420 success++ - inc p8b_main.p8v_success -label_asm_156_afterif - ; source: test_uword_lt.p8:1423 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_158_else - ; source: test_uword_lt.p8:1424 success++ - inc p8b_main.p8v_success - bra label_asm_157_afterif -label_asm_158_else - ; source: test_uword_lt.p8:1426 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_uword_lt.p8:1428 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lt.p8:1430 if x$85 - lda #<$85 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1434 skip9a: -p8l_skip9a - ; source: test_uword_lt.p8:1436 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1437 if x$86 - lda #<$86 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1441 skip9b: -p8l_skip9b - ; source: test_uword_lt.p8:1443 if x$87 - lda #<$87 - jsr p8b_main.p8s_fail_uword -label_asm_159_afterif - ; source: test_uword_lt.p8:1447 if x$88 - lda #<$88 - jsr p8b_main.p8s_fail_uword - bra label_asm_160_afterif -label_asm_161_else - ; source: test_uword_lt.p8:1450 success++ - inc p8b_main.p8v_success -label_asm_160_afterif - ; source: test_uword_lt.p8:1453 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl10a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl10a -+ - ; source: test_uword_lt.p8:1455 goto skip10a - bra p8l_skip10a - ; source: test_uword_lt.p8:1456 lbl10a: fail_uword(137) -p8l_lbl10a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1457 skip10a: -p8l_skip10a - ; source: test_uword_lt.p8:1459 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1460 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1462 goto skip10b - bra p8l_skip10b - ; source: test_uword_lt.p8:1463 lbl10b: fail_uword(138) -p8l_lbl10b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1464 skip10b: -p8l_skip10b - ; source: test_uword_lt.p8:1466 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_162_afterif - ; source: test_uword_lt.p8:1467 fail_uword(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_uword -label_asm_162_afterif - ; source: test_uword_lt.p8:1470 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_164_else - ; source: test_uword_lt.p8:1471 fail_uword(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_uword - bra label_asm_163_afterif -label_asm_164_else - ; source: test_uword_lt.p8:1473 success++ - inc p8b_main.p8v_success -label_asm_163_afterif - ; source: test_uword_lt.p8:1476 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl11a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl11a -+ - ; source: test_uword_lt.p8:1478 goto skip11a - bra p8l_skip11a - ; source: test_uword_lt.p8:1479 lbl11a: fail_uword(141) -p8l_lbl11a - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1480 skip11a: -p8l_skip11a - ; source: test_uword_lt.p8:1482 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1483 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1485 goto skip11b - bra p8l_skip11b - ; source: test_uword_lt.p8:1486 lbl11b: fail_uword(142) -p8l_lbl11b - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1487 skip11b: -p8l_skip11b - ; source: test_uword_lt.p8:1489 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_165_afterif - ; source: test_uword_lt.p8:1490 fail_uword(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_uword -label_asm_165_afterif - ; source: test_uword_lt.p8:1493 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_167_else - ; source: test_uword_lt.p8:1494 fail_uword(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_uword - bra label_asm_166_afterif -label_asm_167_else - ; source: test_uword_lt.p8:1496 success++ - inc p8b_main.p8v_success -label_asm_166_afterif - ; source: test_uword_lt.p8:1499 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl12a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl12a -+ - ; source: test_uword_lt.p8:1501 goto skip12a - bra p8l_skip12a - ; source: test_uword_lt.p8:1502 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1503 skip12a: -p8l_skip12a - ; source: test_uword_lt.p8:1505 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1506 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1508 goto skip12b - bra p8l_skip12b - ; source: test_uword_lt.p8:1509 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_lt.p8:1510 skip12b: -p8l_skip12b - ; source: test_uword_lt.p8:1512 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_168_afterif - ; source: test_uword_lt.p8:1513 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_uword_lt.p8:1516 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_170_else - ; source: test_uword_lt.p8:1517 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_uword_lt.p8:1519 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_uword_lt.p8:1521 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_lt.p8:1523 if x$91 - lda #<$91 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1527 skip13a: -p8l_skip13a - ; source: test_uword_lt.p8:1529 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1530 if x$92 - lda #<$92 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1534 skip13b: -p8l_skip13b - ; source: test_uword_lt.p8:1536 if x$93 - lda #<$93 - jsr p8b_main.p8s_fail_uword -label_asm_171_afterif - ; source: test_uword_lt.p8:1540 if x$94 - lda #<$94 - jsr p8b_main.p8s_fail_uword - bra label_asm_172_afterif -label_asm_173_else - ; source: test_uword_lt.p8:1543 success++ - inc p8b_main.p8v_success -label_asm_172_afterif - ; source: test_uword_lt.p8:1546 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl14a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl14a -+ - ; source: test_uword_lt.p8:1548 goto skip14a - bra p8l_skip14a - ; source: test_uword_lt.p8:1549 lbl14a: fail_uword(149) -p8l_lbl14a - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1550 skip14a: -p8l_skip14a - ; source: test_uword_lt.p8:1552 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1553 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1555 goto skip14b - bra p8l_skip14b - ; source: test_uword_lt.p8:1556 lbl14b: fail_uword(150) -p8l_lbl14b - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1557 skip14b: -p8l_skip14b - ; source: test_uword_lt.p8:1559 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_174_afterif - ; source: test_uword_lt.p8:1560 fail_uword(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_uword -label_asm_174_afterif - ; source: test_uword_lt.p8:1563 if x1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_176_else - ; source: test_uword_lt.p8:1564 fail_uword(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_uword - bra label_asm_175_afterif -label_asm_176_else - ; source: test_uword_lt.p8:1566 success++ - inc p8b_main.p8v_success -label_asm_175_afterif - ; source: test_uword_lt.p8:1569 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl15a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl15a -+ - ; source: test_uword_lt.p8:1571 goto skip15a - bra p8l_skip15a - ; source: test_uword_lt.p8:1572 lbl15a: fail_uword(153) -p8l_lbl15a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1573 skip15a: -p8l_skip15a - ; source: test_uword_lt.p8:1575 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1576 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1578 goto skip15b - bra p8l_skip15b - ; source: test_uword_lt.p8:1579 lbl15b: fail_uword(154) -p8l_lbl15b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1580 skip15b: -p8l_skip15b - ; source: test_uword_lt.p8:1582 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_177_afterif - ; source: test_uword_lt.p8:1583 fail_uword(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_uword -label_asm_177_afterif - ; source: test_uword_lt.p8:1586 if x$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_179_else - ; source: test_uword_lt.p8:1587 fail_uword(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_uword - bra label_asm_178_afterif -label_asm_179_else - ; source: test_uword_lt.p8:1589 success++ - inc p8b_main.p8v_success -label_asm_178_afterif - ; source: test_uword_lt.p8:1592 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl16a - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl16a -+ - ; source: test_uword_lt.p8:1594 goto skip16a - bra p8l_skip16a - ; source: test_uword_lt.p8:1595 lbl16a: fail_uword(157) -p8l_lbl16a - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1596 skip16a: -p8l_skip16a - ; source: test_uword_lt.p8:1598 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lt.p8:1599 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_lt.p8:1601 goto skip16b - bra p8l_skip16b - ; source: test_uword_lt.p8:1602 lbl16b: fail_uword(158) -p8l_lbl16b - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lt.p8:1603 skip16b: -p8l_skip16b - ; source: test_uword_lt.p8:1605 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_180_afterif - ; source: test_uword_lt.p8:1606 fail_uword(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_uword -label_asm_180_afterif - ; source: test_uword_lt.p8:1609 if x$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_182_else - ; source: test_uword_lt.p8:1610 fail_uword(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_uword - bra label_asm_181_afterif -label_asm_182_else - ; source: test_uword_lt.p8:1612 success++ - inc p8b_main.p8v_success -label_asm_181_afterif - ; source: test_uword_lt.p8:1614 verify_success(34) - lda #$22 - jmp p8b_main.p8s_verify_success - ; source: test_uword_lt.p8:1235 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .word ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $54, $45, $53, $54, $53 - .byte $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_lt.p8 b/compiler/test/comparisons/test_uword_lt.p8 deleted file mode 100644 index 885078bb5..000000000 --- a/compiler/test/comparisons/test_uword_lt.p8 +++ /dev/null @@ -1,1618 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\nless-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_lte.p8:14 txt.print("\nless-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:83 if x<=0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_uword_lte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:87 skip1b: -p8l_skip1b - ; source: test_uword_lte.p8:89 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_3_afterif - ; source: test_uword_lte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_uword_lte.p8:93 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_5_else - ; source: test_uword_lte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_lte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_uword_lte.p8:99 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl2a - ; source: test_uword_lte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_uword_lte.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:103 skip2a: -p8l_skip2a - ; source: test_uword_lte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:106 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_uword_lte.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:110 skip2b: -p8l_skip2b - ; source: test_uword_lte.p8:112 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_6_afterif - ; source: test_uword_lte.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_uword_lte.p8:116 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_8_else - ; source: test_uword_lte.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_lte.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_uword_lte.p8:122 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl3a - ; source: test_uword_lte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_uword_lte.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:126 skip3a: -p8l_skip3a - ; source: test_uword_lte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:129 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_uword_lte.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:133 skip3b: -p8l_skip3b - ; source: test_uword_lte.p8:135 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_9_afterif - ; source: test_uword_lte.p8:136 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_uword_lte.p8:139 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_11_else - ; source: test_uword_lte.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_lte.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_uword_lte.p8:145 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl4a - ; source: test_uword_lte.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_uword_lte.p8:148 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:149 skip4a: -p8l_skip4a - ; source: test_uword_lte.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:152 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_uword_lte.p8:155 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:156 skip4b: -p8l_skip4b - ; source: test_uword_lte.p8:158 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_12_afterif - ; source: test_uword_lte.p8:159 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_uword_lte.p8:162 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_14_else - ; source: test_uword_lte.p8:163 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_lte.p8:165 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_uword_lte.p8:167 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:169 if x<=0 - ora p8v_x+1 - beq p8l_lbl5a - ; source: test_uword_lte.p8:171 goto skip5a - bra p8l_skip5a - ; source: test_uword_lte.p8:172 lbl5a: fail_uword(1) -p8l_lbl5a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:173 skip5a: -p8l_skip5a - ; source: test_uword_lte.p8:175 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:176 if x<=0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:178 goto skip5b - bra p8l_skip5b - ; source: test_uword_lte.p8:179 lbl5b: fail_uword(2) -p8l_lbl5b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:180 skip5b: -p8l_skip5b - ; source: test_uword_lte.p8:182 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_15_afterif - ; source: test_uword_lte.p8:183 fail_uword(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_15_afterif - ; source: test_uword_lte.p8:186 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_17_else - ; source: test_uword_lte.p8:187 fail_uword(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_lte.p8:189 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_uword_lte.p8:192 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl6a - ; source: test_uword_lte.p8:194 goto skip6a - bra p8l_skip6a - ; source: test_uword_lte.p8:195 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:196 skip6a: -p8l_skip6a - ; source: test_uword_lte.p8:198 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:199 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:201 goto skip6b - bra p8l_skip6b - ; source: test_uword_lte.p8:202 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:203 skip6b: -p8l_skip6b - ; source: test_uword_lte.p8:205 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_18_afterif - ; source: test_uword_lte.p8:206 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_uword_lte.p8:209 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_20_else - ; source: test_uword_lte.p8:210 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_lte.p8:212 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_uword_lte.p8:215 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl7a - ; source: test_uword_lte.p8:217 goto skip7a - bra p8l_skip7a - ; source: test_uword_lte.p8:218 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:219 skip7a: -p8l_skip7a - ; source: test_uword_lte.p8:221 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:222 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:224 goto skip7b - bra p8l_skip7b - ; source: test_uword_lte.p8:225 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:226 skip7b: -p8l_skip7b - ; source: test_uword_lte.p8:228 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_21_afterif - ; source: test_uword_lte.p8:229 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_uword_lte.p8:232 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_23_else - ; source: test_uword_lte.p8:233 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_lte.p8:235 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_uword_lte.p8:238 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl8a - ; source: test_uword_lte.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_uword_lte.p8:241 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:242 skip8a: -p8l_skip8a - ; source: test_uword_lte.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:245 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_uword_lte.p8:248 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:249 skip8b: -p8l_skip8b - ; source: test_uword_lte.p8:251 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_24_afterif - ; source: test_uword_lte.p8:252 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_uword_lte.p8:255 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_26_else - ; source: test_uword_lte.p8:256 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_lte.p8:258 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_uword_lte.p8:260 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:262 if x<=0 - ora p8v_x+1 - beq p8l_lbl9a - ; source: test_uword_lte.p8:264 goto skip9a - bra p8l_skip9a - ; source: test_uword_lte.p8:265 lbl9a: fail_uword(5) -p8l_lbl9a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:266 skip9a: -p8l_skip9a - ; source: test_uword_lte.p8:268 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:269 if x<=0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:271 goto skip9b - bra p8l_skip9b - ; source: test_uword_lte.p8:272 lbl9b: fail_uword(6) -p8l_lbl9b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:273 skip9b: -p8l_skip9b - ; source: test_uword_lte.p8:275 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_27_afterif - ; source: test_uword_lte.p8:276 fail_uword(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_27_afterif - ; source: test_uword_lte.p8:279 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_29_else - ; source: test_uword_lte.p8:280 fail_uword(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_lte.p8:282 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_uword_lte.p8:285 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl10a - ; source: test_uword_lte.p8:287 goto skip10a - bra p8l_skip10a - ; source: test_uword_lte.p8:288 lbl10a: fail_uword(9) -p8l_lbl10a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:289 skip10a: -p8l_skip10a - ; source: test_uword_lte.p8:291 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:292 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:294 goto skip10b - bra p8l_skip10b - ; source: test_uword_lte.p8:295 lbl10b: fail_uword(10) -p8l_lbl10b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:296 skip10b: -p8l_skip10b - ; source: test_uword_lte.p8:298 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_30_afterif - ; source: test_uword_lte.p8:299 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_30_afterif - ; source: test_uword_lte.p8:302 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_32_else - ; source: test_uword_lte.p8:303 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_lte.p8:305 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_uword_lte.p8:308 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl11a - ; source: test_uword_lte.p8:310 goto skip11a - bra p8l_skip11a - ; source: test_uword_lte.p8:311 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:312 skip11a: -p8l_skip11a - ; source: test_uword_lte.p8:314 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:315 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:317 goto skip11b - bra p8l_skip11b - ; source: test_uword_lte.p8:318 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:319 skip11b: -p8l_skip11b - ; source: test_uword_lte.p8:321 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_33_afterif - ; source: test_uword_lte.p8:322 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_uword_lte.p8:325 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_35_else - ; source: test_uword_lte.p8:326 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_lte.p8:328 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_uword_lte.p8:331 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl12a - ; source: test_uword_lte.p8:333 goto skip12a - bra p8l_skip12a - ; source: test_uword_lte.p8:334 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:335 skip12a: -p8l_skip12a - ; source: test_uword_lte.p8:337 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:338 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:340 goto skip12b - bra p8l_skip12b - ; source: test_uword_lte.p8:341 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:342 skip12b: -p8l_skip12b - ; source: test_uword_lte.p8:344 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_36_afterif - ; source: test_uword_lte.p8:345 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_uword_lte.p8:348 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_38_else - ; source: test_uword_lte.p8:349 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_lte.p8:351 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_uword_lte.p8:353 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_lte.p8:355 if x<=0 - ora p8v_x+1 - beq p8l_lbl13a - ; source: test_uword_lte.p8:357 goto skip13a - bra p8l_skip13a - ; source: test_uword_lte.p8:358 lbl13a: fail_uword(13) -p8l_lbl13a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:359 skip13a: -p8l_skip13a - ; source: test_uword_lte.p8:361 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:362 if x<=0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:364 goto skip13b - bra p8l_skip13b - ; source: test_uword_lte.p8:365 lbl13b: fail_uword(14) -p8l_lbl13b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:366 skip13b: -p8l_skip13b - ; source: test_uword_lte.p8:368 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_39_afterif - ; source: test_uword_lte.p8:369 fail_uword(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_39_afterif - ; source: test_uword_lte.p8:372 if x<=0 - lda p8v_x - ora p8v_x+1 - bne label_asm_41_else - ; source: test_uword_lte.p8:373 fail_uword(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_lte.p8:375 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_uword_lte.p8:378 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl14a - ; source: test_uword_lte.p8:380 goto skip14a - bra p8l_skip14a - ; source: test_uword_lte.p8:381 lbl14a: fail_uword(17) -p8l_lbl14a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:382 skip14a: -p8l_skip14a - ; source: test_uword_lte.p8:384 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:385 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:387 goto skip14b - bra p8l_skip14b - ; source: test_uword_lte.p8:388 lbl14b: fail_uword(18) -p8l_lbl14b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:389 skip14b: -p8l_skip14b - ; source: test_uword_lte.p8:391 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_42_afterif - ; source: test_uword_lte.p8:392 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_42_afterif - ; source: test_uword_lte.p8:395 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_44_else - ; source: test_uword_lte.p8:396 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_lte.p8:398 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_uword_lte.p8:401 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl15a - ; source: test_uword_lte.p8:403 goto skip15a - bra p8l_skip15a - ; source: test_uword_lte.p8:404 lbl15a: fail_uword(21) -p8l_lbl15a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:405 skip15a: -p8l_skip15a - ; source: test_uword_lte.p8:407 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:408 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:410 goto skip15b - bra p8l_skip15b - ; source: test_uword_lte.p8:411 lbl15b: fail_uword(22) -p8l_lbl15b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:412 skip15b: -p8l_skip15b - ; source: test_uword_lte.p8:414 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_45_afterif - ; source: test_uword_lte.p8:415 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_45_afterif - ; source: test_uword_lte.p8:418 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_47_else - ; source: test_uword_lte.p8:419 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_lte.p8:421 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_uword_lte.p8:424 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl16a - ; source: test_uword_lte.p8:426 goto skip16a - bra p8l_skip16a - ; source: test_uword_lte.p8:427 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:428 skip16a: -p8l_skip16a - ; source: test_uword_lte.p8:430 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:431 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:433 goto skip16b - bra p8l_skip16b - ; source: test_uword_lte.p8:434 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:435 skip16b: -p8l_skip16b - ; source: test_uword_lte.p8:437 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_48_afterif - ; source: test_uword_lte.p8:438 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_uword_lte.p8:441 if x<=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_50_else - ; source: test_uword_lte.p8:442 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_lte.p8:444 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_uword_lte.p8:446 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_lte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_lte.p8:448 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_uword_lte.p8:449 uword @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_uword_lte.p8:450 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_lte.p8:451 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lte.p8:452 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lte.p8:454 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl1a - ; source: test_uword_lte.p8:456 goto skip1a - bra p8l_skip1a - ; source: test_uword_lte.p8:457 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:458 skip1a: -p8l_skip1a - ; source: test_uword_lte.p8:460 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:461 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:463 goto skip1b - bra p8l_skip1b - ; source: test_uword_lte.p8:464 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:465 skip1b: -p8l_skip1b - ; source: test_uword_lte.p8:467 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_51_afterif - ; source: test_uword_lte.p8:468 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_uword_lte.p8:471 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_53_else - ; source: test_uword_lte.p8:472 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_lte.p8:474 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_uword_lte.p8:476 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:478 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl2a - ; source: test_uword_lte.p8:480 goto skip2a - bra p8l_skip2a - ; source: test_uword_lte.p8:481 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:482 skip2a: -p8l_skip2a - ; source: test_uword_lte.p8:484 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:485 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:487 goto skip2b - bra p8l_skip2b - ; source: test_uword_lte.p8:488 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:489 skip2b: -p8l_skip2b - ; source: test_uword_lte.p8:491 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_54_afterif - ; source: test_uword_lte.p8:492 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_uword_lte.p8:495 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_56_else - ; source: test_uword_lte.p8:496 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_lte.p8:498 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_uword_lte.p8:500 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:502 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl3a - ; source: test_uword_lte.p8:504 goto skip3a - bra p8l_skip3a - ; source: test_uword_lte.p8:505 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:506 skip3a: -p8l_skip3a - ; source: test_uword_lte.p8:508 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:509 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:511 goto skip3b - bra p8l_skip3b - ; source: test_uword_lte.p8:512 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:513 skip3b: -p8l_skip3b - ; source: test_uword_lte.p8:515 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_57_afterif - ; source: test_uword_lte.p8:516 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_uword_lte.p8:519 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_59_else - ; source: test_uword_lte.p8:520 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_lte.p8:522 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_uword_lte.p8:524 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_lte.p8:526 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl4a - ; source: test_uword_lte.p8:528 goto skip4a - bra p8l_skip4a - ; source: test_uword_lte.p8:529 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:530 skip4a: -p8l_skip4a - ; source: test_uword_lte.p8:532 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:533 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:535 goto skip4b - bra p8l_skip4b - ; source: test_uword_lte.p8:536 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:537 skip4b: -p8l_skip4b - ; source: test_uword_lte.p8:539 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_60_afterif - ; source: test_uword_lte.p8:540 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_uword_lte.p8:543 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_62_else - ; source: test_uword_lte.p8:544 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_lte.p8:546 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_uword_lte.p8:548 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:549 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lte.p8:551 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl5a - ; source: test_uword_lte.p8:553 goto skip5a - bra p8l_skip5a - ; source: test_uword_lte.p8:554 lbl5a: fail_uword(25) -p8l_lbl5a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:555 skip5a: -p8l_skip5a - ; source: test_uword_lte.p8:557 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:558 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:560 goto skip5b - bra p8l_skip5b - ; source: test_uword_lte.p8:561 lbl5b: fail_uword(26) -p8l_lbl5b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:562 skip5b: -p8l_skip5b - ; source: test_uword_lte.p8:564 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_63_afterif - ; source: test_uword_lte.p8:565 fail_uword(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_63_afterif - ; source: test_uword_lte.p8:568 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_65_else - ; source: test_uword_lte.p8:569 fail_uword(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_lte.p8:571 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_uword_lte.p8:573 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:575 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl6a - ; source: test_uword_lte.p8:577 goto skip6a - bra p8l_skip6a - ; source: test_uword_lte.p8:578 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:579 skip6a: -p8l_skip6a - ; source: test_uword_lte.p8:581 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:582 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:584 goto skip6b - bra p8l_skip6b - ; source: test_uword_lte.p8:585 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:586 skip6b: -p8l_skip6b - ; source: test_uword_lte.p8:588 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_66_afterif - ; source: test_uword_lte.p8:589 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_uword_lte.p8:592 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_68_else - ; source: test_uword_lte.p8:593 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_lte.p8:595 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_uword_lte.p8:597 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:599 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl7a - ; source: test_uword_lte.p8:601 goto skip7a - bra p8l_skip7a - ; source: test_uword_lte.p8:602 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:603 skip7a: -p8l_skip7a - ; source: test_uword_lte.p8:605 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:606 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:608 goto skip7b - bra p8l_skip7b - ; source: test_uword_lte.p8:609 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:610 skip7b: -p8l_skip7b - ; source: test_uword_lte.p8:612 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_69_afterif - ; source: test_uword_lte.p8:613 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_uword_lte.p8:616 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_71_else - ; source: test_uword_lte.p8:617 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_lte.p8:619 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_uword_lte.p8:621 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_lte.p8:623 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl8a - ; source: test_uword_lte.p8:625 goto skip8a - bra p8l_skip8a - ; source: test_uword_lte.p8:626 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:627 skip8a: -p8l_skip8a - ; source: test_uword_lte.p8:629 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:630 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:632 goto skip8b - bra p8l_skip8b - ; source: test_uword_lte.p8:633 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:634 skip8b: -p8l_skip8b - ; source: test_uword_lte.p8:636 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_72_afterif - ; source: test_uword_lte.p8:637 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_uword_lte.p8:640 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_74_else - ; source: test_uword_lte.p8:641 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_lte.p8:643 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_uword_lte.p8:645 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:646 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lte.p8:648 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl9a - ; source: test_uword_lte.p8:650 goto skip9a - bra p8l_skip9a - ; source: test_uword_lte.p8:651 lbl9a: fail_uword(29) -p8l_lbl9a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:652 skip9a: -p8l_skip9a - ; source: test_uword_lte.p8:654 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:655 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:657 goto skip9b - bra p8l_skip9b - ; source: test_uword_lte.p8:658 lbl9b: fail_uword(30) -p8l_lbl9b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:659 skip9b: -p8l_skip9b - ; source: test_uword_lte.p8:661 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_75_afterif - ; source: test_uword_lte.p8:662 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_75_afterif - ; source: test_uword_lte.p8:665 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_77_else - ; source: test_uword_lte.p8:666 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_lte.p8:668 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_uword_lte.p8:670 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:672 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl10a - ; source: test_uword_lte.p8:674 goto skip10a - bra p8l_skip10a - ; source: test_uword_lte.p8:675 lbl10a: fail_uword(33) -p8l_lbl10a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:676 skip10a: -p8l_skip10a - ; source: test_uword_lte.p8:678 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:679 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:681 goto skip10b - bra p8l_skip10b - ; source: test_uword_lte.p8:682 lbl10b: fail_uword(34) -p8l_lbl10b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:683 skip10b: -p8l_skip10b - ; source: test_uword_lte.p8:685 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_78_afterif - ; source: test_uword_lte.p8:686 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_78_afterif - ; source: test_uword_lte.p8:689 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_80_else - ; source: test_uword_lte.p8:690 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_lte.p8:692 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_uword_lte.p8:694 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:696 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl11a - ; source: test_uword_lte.p8:698 goto skip11a - bra p8l_skip11a - ; source: test_uword_lte.p8:699 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:700 skip11a: -p8l_skip11a - ; source: test_uword_lte.p8:702 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:703 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:705 goto skip11b - bra p8l_skip11b - ; source: test_uword_lte.p8:706 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:707 skip11b: -p8l_skip11b - ; source: test_uword_lte.p8:709 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_81_afterif - ; source: test_uword_lte.p8:710 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_uword_lte.p8:713 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_83_else - ; source: test_uword_lte.p8:714 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_lte.p8:716 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_uword_lte.p8:718 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_lte.p8:720 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl12a - ; source: test_uword_lte.p8:722 goto skip12a - bra p8l_skip12a - ; source: test_uword_lte.p8:723 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:724 skip12a: -p8l_skip12a - ; source: test_uword_lte.p8:726 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:727 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:729 goto skip12b - bra p8l_skip12b - ; source: test_uword_lte.p8:730 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:731 skip12b: -p8l_skip12b - ; source: test_uword_lte.p8:733 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_84_afterif - ; source: test_uword_lte.p8:734 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_uword_lte.p8:737 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_86_else - ; source: test_uword_lte.p8:738 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_lte.p8:740 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_uword_lte.p8:742 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_lte.p8:743 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_uword_lte.p8:745 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl13a - ; source: test_uword_lte.p8:747 goto skip13a - bra p8l_skip13a - ; source: test_uword_lte.p8:748 lbl13a: fail_uword(37) -p8l_lbl13a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:749 skip13a: -p8l_skip13a - ; source: test_uword_lte.p8:751 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:752 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:754 goto skip13b - bra p8l_skip13b - ; source: test_uword_lte.p8:755 lbl13b: fail_uword(38) -p8l_lbl13b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:756 skip13b: -p8l_skip13b - ; source: test_uword_lte.p8:758 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_87_afterif - ; source: test_uword_lte.p8:759 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_87_afterif - ; source: test_uword_lte.p8:762 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_89_else - ; source: test_uword_lte.p8:763 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_lte.p8:765 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_uword_lte.p8:767 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:769 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl14a - ; source: test_uword_lte.p8:771 goto skip14a - bra p8l_skip14a - ; source: test_uword_lte.p8:772 lbl14a: fail_uword(41) -p8l_lbl14a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:773 skip14a: -p8l_skip14a - ; source: test_uword_lte.p8:775 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:776 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:778 goto skip14b - bra p8l_skip14b - ; source: test_uword_lte.p8:779 lbl14b: fail_uword(42) -p8l_lbl14b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:780 skip14b: -p8l_skip14b - ; source: test_uword_lte.p8:782 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_90_afterif - ; source: test_uword_lte.p8:783 fail_uword(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_90_afterif - ; source: test_uword_lte.p8:786 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_92_else - ; source: test_uword_lte.p8:787 fail_uword(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_lte.p8:789 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_uword_lte.p8:791 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_uword_lte.p8:793 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl15a - ; source: test_uword_lte.p8:795 goto skip15a - bra p8l_skip15a - ; source: test_uword_lte.p8:796 lbl15a: fail_uword(45) -p8l_lbl15a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:797 skip15a: -p8l_skip15a - ; source: test_uword_lte.p8:799 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:800 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:802 goto skip15b - bra p8l_skip15b - ; source: test_uword_lte.p8:803 lbl15b: fail_uword(46) -p8l_lbl15b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:804 skip15b: -p8l_skip15b - ; source: test_uword_lte.p8:806 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_93_afterif - ; source: test_uword_lte.p8:807 fail_uword(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_93_afterif - ; source: test_uword_lte.p8:810 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_95_else - ; source: test_uword_lte.p8:811 fail_uword(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_lte.p8:813 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_uword_lte.p8:815 value=65535 - lda #$ff - sta p8v_value - sta p8v_value+1 - - ; source: test_uword_lte.p8:817 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl16a - ; source: test_uword_lte.p8:819 goto skip16a - bra p8l_skip16a - ; source: test_uword_lte.p8:820 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:821 skip16a: -p8l_skip16a - ; source: test_uword_lte.p8:823 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:824 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:826 goto skip16b - bra p8l_skip16b - ; source: test_uword_lte.p8:827 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:828 skip16b: -p8l_skip16b - ; source: test_uword_lte.p8:830 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_96_afterif - ; source: test_uword_lte.p8:831 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_uword_lte.p8:834 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_98_else - ; source: test_uword_lte.p8:835 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_lte.p8:837 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_uword_lte.p8:839 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_lte.p8:448 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .word ? -p8v_x .word ? - .send BSS - .pend - ; source: test_uword_lte.p8:841 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_uword_lte.p8:842 uword @shared x - ; source: test_uword_lte.p8:843 uword[] values = [0, 0] - ; source: test_uword_lte.p8:842 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lte.p8:844 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_lte.p8:845 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lte.p8:846 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lte.p8:848 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl1a - ; source: test_uword_lte.p8:850 goto skip1a - bra p8l_skip1a - ; source: test_uword_lte.p8:851 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:852 skip1a: -p8l_skip1a - ; source: test_uword_lte.p8:854 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:855 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:857 goto skip1b - bra p8l_skip1b - ; source: test_uword_lte.p8:858 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:859 skip1b: -p8l_skip1b - ; source: test_uword_lte.p8:861 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_99_afterif - ; source: test_uword_lte.p8:862 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_uword_lte.p8:865 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_101_else - ; source: test_uword_lte.p8:866 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_uword_lte.p8:868 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_uword_lte.p8:870 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lte.p8:872 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl2a - ; source: test_uword_lte.p8:874 goto skip2a - bra p8l_skip2a - ; source: test_uword_lte.p8:875 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:876 skip2a: -p8l_skip2a - ; source: test_uword_lte.p8:878 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:879 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:881 goto skip2b - bra p8l_skip2b - ; source: test_uword_lte.p8:882 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:883 skip2b: -p8l_skip2b - ; source: test_uword_lte.p8:885 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_102_afterif - ; source: test_uword_lte.p8:886 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_uword_lte.p8:889 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_104_else - ; source: test_uword_lte.p8:890 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_uword_lte.p8:892 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_uword_lte.p8:894 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lte.p8:896 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl3a - ; source: test_uword_lte.p8:898 goto skip3a - bra p8l_skip3a - ; source: test_uword_lte.p8:899 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:900 skip3a: -p8l_skip3a - ; source: test_uword_lte.p8:902 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:903 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:905 goto skip3b - bra p8l_skip3b - ; source: test_uword_lte.p8:906 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:907 skip3b: -p8l_skip3b - ; source: test_uword_lte.p8:909 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_105_afterif - ; source: test_uword_lte.p8:910 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_uword_lte.p8:913 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_107_else - ; source: test_uword_lte.p8:914 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_uword_lte.p8:916 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_uword_lte.p8:918 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_lte.p8:920 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl4a - ; source: test_uword_lte.p8:922 goto skip4a - bra p8l_skip4a - ; source: test_uword_lte.p8:923 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:924 skip4a: -p8l_skip4a - ; source: test_uword_lte.p8:926 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:927 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:929 goto skip4b - bra p8l_skip4b - ; source: test_uword_lte.p8:930 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:931 skip4b: -p8l_skip4b - ; source: test_uword_lte.p8:933 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_108_afterif - ; source: test_uword_lte.p8:934 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_uword_lte.p8:937 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_110_else - ; source: test_uword_lte.p8:938 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_uword_lte.p8:940 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_uword_lte.p8:942 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:943 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lte.p8:945 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl5a - ; source: test_uword_lte.p8:947 goto skip5a - bra p8l_skip5a - ; source: test_uword_lte.p8:948 lbl5a: fail_uword(49) -p8l_lbl5a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:949 skip5a: -p8l_skip5a - ; source: test_uword_lte.p8:951 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:952 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:954 goto skip5b - bra p8l_skip5b - ; source: test_uword_lte.p8:955 lbl5b: fail_uword(50) -p8l_lbl5b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:956 skip5b: -p8l_skip5b - ; source: test_uword_lte.p8:958 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_111_afterif - ; source: test_uword_lte.p8:959 fail_uword(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_uword -label_asm_111_afterif - ; source: test_uword_lte.p8:962 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_113_else - ; source: test_uword_lte.p8:963 fail_uword(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_uword - bra label_asm_112_afterif -label_asm_113_else - ; source: test_uword_lte.p8:965 success++ - inc p8b_main.p8v_success -label_asm_112_afterif - ; source: test_uword_lte.p8:967 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lte.p8:969 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl6a - ; source: test_uword_lte.p8:971 goto skip6a - bra p8l_skip6a - ; source: test_uword_lte.p8:972 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:973 skip6a: -p8l_skip6a - ; source: test_uword_lte.p8:975 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:976 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:978 goto skip6b - bra p8l_skip6b - ; source: test_uword_lte.p8:979 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:980 skip6b: -p8l_skip6b - ; source: test_uword_lte.p8:982 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_114_afterif - ; source: test_uword_lte.p8:983 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_uword_lte.p8:986 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_116_else - ; source: test_uword_lte.p8:987 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_uword_lte.p8:989 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_uword_lte.p8:991 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lte.p8:993 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl7a - ; source: test_uword_lte.p8:995 goto skip7a - bra p8l_skip7a - ; source: test_uword_lte.p8:996 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:997 skip7a: -p8l_skip7a - ; source: test_uword_lte.p8:999 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1000 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1002 goto skip7b - bra p8l_skip7b - ; source: test_uword_lte.p8:1003 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1004 skip7b: -p8l_skip7b - ; source: test_uword_lte.p8:1006 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_117_afterif - ; source: test_uword_lte.p8:1007 success++ - inc p8b_main.p8v_success -label_asm_117_afterif - ; source: test_uword_lte.p8:1010 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_119_else - ; source: test_uword_lte.p8:1011 success++ - inc p8b_main.p8v_success - bra label_asm_118_afterif -label_asm_119_else - ; source: test_uword_lte.p8:1013 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_uword_lte.p8:1015 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_lte.p8:1017 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl8a - ; source: test_uword_lte.p8:1019 goto skip8a - bra p8l_skip8a - ; source: test_uword_lte.p8:1020 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1021 skip8a: -p8l_skip8a - ; source: test_uword_lte.p8:1023 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1024 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1026 goto skip8b - bra p8l_skip8b - ; source: test_uword_lte.p8:1027 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1028 skip8b: -p8l_skip8b - ; source: test_uword_lte.p8:1030 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_120_afterif - ; source: test_uword_lte.p8:1031 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_uword_lte.p8:1034 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_122_else - ; source: test_uword_lte.p8:1035 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_uword_lte.p8:1037 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_uword_lte.p8:1039 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:1040 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lte.p8:1042 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl9a - ; source: test_uword_lte.p8:1044 goto skip9a - bra p8l_skip9a - ; source: test_uword_lte.p8:1045 lbl9a: fail_uword(53) -p8l_lbl9a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1046 skip9a: -p8l_skip9a - ; source: test_uword_lte.p8:1048 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1049 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1051 goto skip9b - bra p8l_skip9b - ; source: test_uword_lte.p8:1052 lbl9b: fail_uword(54) -p8l_lbl9b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1053 skip9b: -p8l_skip9b - ; source: test_uword_lte.p8:1055 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_123_afterif - ; source: test_uword_lte.p8:1056 fail_uword(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_uword -label_asm_123_afterif - ; source: test_uword_lte.p8:1059 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_125_else - ; source: test_uword_lte.p8:1060 fail_uword(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_uword - bra label_asm_124_afterif -label_asm_125_else - ; source: test_uword_lte.p8:1062 success++ - inc p8b_main.p8v_success -label_asm_124_afterif - ; source: test_uword_lte.p8:1064 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lte.p8:1066 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl10a - ; source: test_uword_lte.p8:1068 goto skip10a - bra p8l_skip10a - ; source: test_uword_lte.p8:1069 lbl10a: fail_uword(57) -p8l_lbl10a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1070 skip10a: -p8l_skip10a - ; source: test_uword_lte.p8:1072 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1073 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1075 goto skip10b - bra p8l_skip10b - ; source: test_uword_lte.p8:1076 lbl10b: fail_uword(58) -p8l_lbl10b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1077 skip10b: -p8l_skip10b - ; source: test_uword_lte.p8:1079 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_126_afterif - ; source: test_uword_lte.p8:1080 fail_uword(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_uword -label_asm_126_afterif - ; source: test_uword_lte.p8:1083 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_128_else - ; source: test_uword_lte.p8:1084 fail_uword(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_uword - bra label_asm_127_afterif -label_asm_128_else - ; source: test_uword_lte.p8:1086 success++ - inc p8b_main.p8v_success -label_asm_127_afterif - ; source: test_uword_lte.p8:1088 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lte.p8:1090 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl11a - ; source: test_uword_lte.p8:1092 goto skip11a - bra p8l_skip11a - ; source: test_uword_lte.p8:1093 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1094 skip11a: -p8l_skip11a - ; source: test_uword_lte.p8:1096 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1097 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1099 goto skip11b - bra p8l_skip11b - ; source: test_uword_lte.p8:1100 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1101 skip11b: -p8l_skip11b - ; source: test_uword_lte.p8:1103 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_129_afterif - ; source: test_uword_lte.p8:1104 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_uword_lte.p8:1107 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_131_else - ; source: test_uword_lte.p8:1108 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_uword_lte.p8:1110 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_uword_lte.p8:1112 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_lte.p8:1114 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl12a - ; source: test_uword_lte.p8:1116 goto skip12a - bra p8l_skip12a - ; source: test_uword_lte.p8:1117 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1118 skip12a: -p8l_skip12a - ; source: test_uword_lte.p8:1120 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1121 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1123 goto skip12b - bra p8l_skip12b - ; source: test_uword_lte.p8:1124 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1125 skip12b: -p8l_skip12b - ; source: test_uword_lte.p8:1127 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_132_afterif - ; source: test_uword_lte.p8:1128 success++ - inc p8b_main.p8v_success -label_asm_132_afterif - ; source: test_uword_lte.p8:1131 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_134_else - ; source: test_uword_lte.p8:1132 success++ - inc p8b_main.p8v_success - bra label_asm_133_afterif -label_asm_134_else - ; source: test_uword_lte.p8:1134 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_uword_lte.p8:1136 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_lte.p8:1137 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_uword_lte.p8:1139 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl13a - ; source: test_uword_lte.p8:1141 goto skip13a - bra p8l_skip13a - ; source: test_uword_lte.p8:1142 lbl13a: fail_uword(61) -p8l_lbl13a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1143 skip13a: -p8l_skip13a - ; source: test_uword_lte.p8:1145 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1146 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1148 goto skip13b - bra p8l_skip13b - ; source: test_uword_lte.p8:1149 lbl13b: fail_uword(62) -p8l_lbl13b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1150 skip13b: -p8l_skip13b - ; source: test_uword_lte.p8:1152 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_135_afterif - ; source: test_uword_lte.p8:1153 fail_uword(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_uword -label_asm_135_afterif - ; source: test_uword_lte.p8:1156 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_137_else - ; source: test_uword_lte.p8:1157 fail_uword(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_uword - bra label_asm_136_afterif -label_asm_137_else - ; source: test_uword_lte.p8:1159 success++ - inc p8b_main.p8v_success -label_asm_136_afterif - ; source: test_uword_lte.p8:1161 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_uword_lte.p8:1163 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl14a - ; source: test_uword_lte.p8:1165 goto skip14a - bra p8l_skip14a - ; source: test_uword_lte.p8:1166 lbl14a: fail_uword(65) -p8l_lbl14a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1167 skip14a: -p8l_skip14a - ; source: test_uword_lte.p8:1169 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1170 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1172 goto skip14b - bra p8l_skip14b - ; source: test_uword_lte.p8:1173 lbl14b: fail_uword(66) -p8l_lbl14b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1174 skip14b: -p8l_skip14b - ; source: test_uword_lte.p8:1176 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_138_afterif - ; source: test_uword_lte.p8:1177 fail_uword(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_uword -label_asm_138_afterif - ; source: test_uword_lte.p8:1180 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_140_else - ; source: test_uword_lte.p8:1181 fail_uword(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_uword - bra label_asm_139_afterif -label_asm_140_else - ; source: test_uword_lte.p8:1183 success++ - inc p8b_main.p8v_success -label_asm_139_afterif - ; source: test_uword_lte.p8:1185 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_uword_lte.p8:1187 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl15a - ; source: test_uword_lte.p8:1189 goto skip15a - bra p8l_skip15a - ; source: test_uword_lte.p8:1190 lbl15a: fail_uword(69) -p8l_lbl15a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1191 skip15a: -p8l_skip15a - ; source: test_uword_lte.p8:1193 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1194 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1196 goto skip15b - bra p8l_skip15b - ; source: test_uword_lte.p8:1197 lbl15b: fail_uword(70) -p8l_lbl15b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1198 skip15b: -p8l_skip15b - ; source: test_uword_lte.p8:1200 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_141_afterif - ; source: test_uword_lte.p8:1201 fail_uword(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_uword -label_asm_141_afterif - ; source: test_uword_lte.p8:1204 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_143_else - ; source: test_uword_lte.p8:1205 fail_uword(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_uword - bra label_asm_142_afterif -label_asm_143_else - ; source: test_uword_lte.p8:1207 success++ - inc p8b_main.p8v_success -label_asm_142_afterif - ; source: test_uword_lte.p8:1209 values[1]=65535 - ldy #2 - lda #<$ffff - sta p8v_values,y - lda #>$ffff - sta p8v_values+1,y - ; source: test_uword_lte.p8:1211 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl16a - ; source: test_uword_lte.p8:1213 goto skip16a - bra p8l_skip16a - ; source: test_uword_lte.p8:1214 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1215 skip16a: -p8l_skip16a - ; source: test_uword_lte.p8:1217 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1218 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1220 goto skip16b - bra p8l_skip16b - ; source: test_uword_lte.p8:1221 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1222 skip16b: -p8l_skip16b - ; source: test_uword_lte.p8:1224 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_144_afterif - ; source: test_uword_lte.p8:1225 success++ - inc p8b_main.p8v_success -label_asm_144_afterif - ; source: test_uword_lte.p8:1228 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_146_else - ; source: test_uword_lte.p8:1229 success++ - inc p8b_main.p8v_success - bra label_asm_145_afterif -label_asm_146_else - ; source: test_uword_lte.p8:1231 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_uword_lte.p8:1233 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_lte.p8:841 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -p8v_values .word $0000, $0000 - .pend - ; source: test_uword_lte.p8:1235 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_uword_lte.p8:1236 uword @shared x - ; source: test_uword_lte.p8:1239 float @shared f4 = 1.0 - ; source: test_uword_lte.p8:1240 float @shared f5 = 1.0 - ; source: test_uword_lte.p8:1236 uword @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lte.p8:1237 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_lte.p8:1238 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_lte.p8:1239 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_uword_lte.p8:1240 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_uword_lte.p8:1241 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_lte.p8:1242 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_uword_lte.p8:1244 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl1a - ; source: test_uword_lte.p8:1246 goto skip1a - bra p8l_skip1a - ; source: test_uword_lte.p8:1247 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1248 skip1a: -p8l_skip1a - ; source: test_uword_lte.p8:1250 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1251 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1253 goto skip1b - bra p8l_skip1b - ; source: test_uword_lte.p8:1254 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1255 skip1b: -p8l_skip1b - ; source: test_uword_lte.p8:1257 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_147_afterif - ; source: test_uword_lte.p8:1258 success++ - inc p8b_main.p8v_success -label_asm_147_afterif - ; source: test_uword_lte.p8:1261 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_149_else - ; source: test_uword_lte.p8:1262 success++ - inc p8b_main.p8v_success - bra label_asm_148_afterif -label_asm_149_else - ; source: test_uword_lte.p8:1264 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_uword_lte.p8:1267 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl2a - ; source: test_uword_lte.p8:1269 goto skip2a - bra p8l_skip2a - ; source: test_uword_lte.p8:1270 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1271 skip2a: -p8l_skip2a - ; source: test_uword_lte.p8:1273 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1274 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1276 goto skip2b - bra p8l_skip2b - ; source: test_uword_lte.p8:1277 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1278 skip2b: -p8l_skip2b - ; source: test_uword_lte.p8:1280 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_150_afterif - ; source: test_uword_lte.p8:1281 success++ - inc p8b_main.p8v_success -label_asm_150_afterif - ; source: test_uword_lte.p8:1284 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_152_else - ; source: test_uword_lte.p8:1285 success++ - inc p8b_main.p8v_success - bra label_asm_151_afterif -label_asm_152_else - ; source: test_uword_lte.p8:1287 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_uword_lte.p8:1290 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl3a - ; source: test_uword_lte.p8:1292 goto skip3a - bra p8l_skip3a - ; source: test_uword_lte.p8:1293 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1294 skip3a: -p8l_skip3a - ; source: test_uword_lte.p8:1296 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1297 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1299 goto skip3b - bra p8l_skip3b - ; source: test_uword_lte.p8:1300 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1301 skip3b: -p8l_skip3b - ; source: test_uword_lte.p8:1303 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_153_afterif - ; source: test_uword_lte.p8:1304 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_uword_lte.p8:1307 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_155_else - ; source: test_uword_lte.p8:1308 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_uword_lte.p8:1310 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_uword_lte.p8:1313 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl4a - ; source: test_uword_lte.p8:1315 goto skip4a - bra p8l_skip4a - ; source: test_uword_lte.p8:1316 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1317 skip4a: -p8l_skip4a - ; source: test_uword_lte.p8:1319 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1320 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1322 goto skip4b - bra p8l_skip4b - ; source: test_uword_lte.p8:1323 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1324 skip4b: -p8l_skip4b - ; source: test_uword_lte.p8:1326 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_156_afterif - ; source: test_uword_lte.p8:1327 success++ - inc p8b_main.p8v_success -label_asm_156_afterif - ; source: test_uword_lte.p8:1330 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_158_else - ; source: test_uword_lte.p8:1331 success++ - inc p8b_main.p8v_success - bra label_asm_157_afterif -label_asm_158_else - ; source: test_uword_lte.p8:1333 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_uword_lte.p8:1335 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:1337 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl5a - ; source: test_uword_lte.p8:1339 goto skip5a - bra p8l_skip5a - ; source: test_uword_lte.p8:1340 lbl5a: fail_uword(73) -p8l_lbl5a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1341 skip5a: -p8l_skip5a - ; source: test_uword_lte.p8:1343 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1344 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1346 goto skip5b - bra p8l_skip5b - ; source: test_uword_lte.p8:1347 lbl5b: fail_uword(74) -p8l_lbl5b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1348 skip5b: -p8l_skip5b - ; source: test_uword_lte.p8:1350 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_159_afterif - ; source: test_uword_lte.p8:1351 fail_uword(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_uword -label_asm_159_afterif - ; source: test_uword_lte.p8:1354 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_161_else - ; source: test_uword_lte.p8:1355 fail_uword(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_uword - bra label_asm_160_afterif -label_asm_161_else - ; source: test_uword_lte.p8:1357 success++ - inc p8b_main.p8v_success -label_asm_160_afterif - ; source: test_uword_lte.p8:1360 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl6a - ; source: test_uword_lte.p8:1362 goto skip6a - bra p8l_skip6a - ; source: test_uword_lte.p8:1363 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1364 skip6a: -p8l_skip6a - ; source: test_uword_lte.p8:1366 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1367 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1369 goto skip6b - bra p8l_skip6b - ; source: test_uword_lte.p8:1370 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1371 skip6b: -p8l_skip6b - ; source: test_uword_lte.p8:1373 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_162_afterif - ; source: test_uword_lte.p8:1374 success++ - inc p8b_main.p8v_success -label_asm_162_afterif - ; source: test_uword_lte.p8:1377 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_164_else - ; source: test_uword_lte.p8:1378 success++ - inc p8b_main.p8v_success - bra label_asm_163_afterif -label_asm_164_else - ; source: test_uword_lte.p8:1380 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_uword_lte.p8:1383 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl7a - ; source: test_uword_lte.p8:1385 goto skip7a - bra p8l_skip7a - ; source: test_uword_lte.p8:1386 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1387 skip7a: -p8l_skip7a - ; source: test_uword_lte.p8:1389 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1390 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1392 goto skip7b - bra p8l_skip7b - ; source: test_uword_lte.p8:1393 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1394 skip7b: -p8l_skip7b - ; source: test_uword_lte.p8:1396 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_165_afterif - ; source: test_uword_lte.p8:1397 success++ - inc p8b_main.p8v_success -label_asm_165_afterif - ; source: test_uword_lte.p8:1400 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_167_else - ; source: test_uword_lte.p8:1401 success++ - inc p8b_main.p8v_success - bra label_asm_166_afterif -label_asm_167_else - ; source: test_uword_lte.p8:1403 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_uword_lte.p8:1406 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl8a - ; source: test_uword_lte.p8:1408 goto skip8a - bra p8l_skip8a - ; source: test_uword_lte.p8:1409 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1410 skip8a: -p8l_skip8a - ; source: test_uword_lte.p8:1412 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1413 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1415 goto skip8b - bra p8l_skip8b - ; source: test_uword_lte.p8:1416 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1417 skip8b: -p8l_skip8b - ; source: test_uword_lte.p8:1419 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_168_afterif - ; source: test_uword_lte.p8:1420 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_uword_lte.p8:1423 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_170_else - ; source: test_uword_lte.p8:1424 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_uword_lte.p8:1426 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_uword_lte.p8:1428 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_lte.p8:1430 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl9a - ; source: test_uword_lte.p8:1432 goto skip9a - bra p8l_skip9a - ; source: test_uword_lte.p8:1433 lbl9a: fail_uword(77) -p8l_lbl9a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1434 skip9a: -p8l_skip9a - ; source: test_uword_lte.p8:1436 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1437 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1439 goto skip9b - bra p8l_skip9b - ; source: test_uword_lte.p8:1440 lbl9b: fail_uword(78) -p8l_lbl9b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1441 skip9b: -p8l_skip9b - ; source: test_uword_lte.p8:1443 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_171_afterif - ; source: test_uword_lte.p8:1444 fail_uword(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_uword -label_asm_171_afterif - ; source: test_uword_lte.p8:1447 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_173_else - ; source: test_uword_lte.p8:1448 fail_uword(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_uword - bra label_asm_172_afterif -label_asm_173_else - ; source: test_uword_lte.p8:1450 success++ - inc p8b_main.p8v_success -label_asm_172_afterif - ; source: test_uword_lte.p8:1453 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl10a - ; source: test_uword_lte.p8:1455 goto skip10a - bra p8l_skip10a - ; source: test_uword_lte.p8:1456 lbl10a: fail_uword(81) -p8l_lbl10a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1457 skip10a: -p8l_skip10a - ; source: test_uword_lte.p8:1459 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1460 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1462 goto skip10b - bra p8l_skip10b - ; source: test_uword_lte.p8:1463 lbl10b: fail_uword(82) -p8l_lbl10b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1464 skip10b: -p8l_skip10b - ; source: test_uword_lte.p8:1466 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_174_afterif - ; source: test_uword_lte.p8:1467 fail_uword(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_uword -label_asm_174_afterif - ; source: test_uword_lte.p8:1470 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_176_else - ; source: test_uword_lte.p8:1471 fail_uword(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_uword - bra label_asm_175_afterif -label_asm_176_else - ; source: test_uword_lte.p8:1473 success++ - inc p8b_main.p8v_success -label_asm_175_afterif - ; source: test_uword_lte.p8:1476 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl11a - ; source: test_uword_lte.p8:1478 goto skip11a - bra p8l_skip11a - ; source: test_uword_lte.p8:1479 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1480 skip11a: -p8l_skip11a - ; source: test_uword_lte.p8:1482 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1483 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1485 goto skip11b - bra p8l_skip11b - ; source: test_uword_lte.p8:1486 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1487 skip11b: -p8l_skip11b - ; source: test_uword_lte.p8:1489 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_177_afterif - ; source: test_uword_lte.p8:1490 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_uword_lte.p8:1493 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_179_else - ; source: test_uword_lte.p8:1494 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_uword_lte.p8:1496 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_uword_lte.p8:1499 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl12a - ; source: test_uword_lte.p8:1501 goto skip12a - bra p8l_skip12a - ; source: test_uword_lte.p8:1502 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1503 skip12a: -p8l_skip12a - ; source: test_uword_lte.p8:1505 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1506 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1508 goto skip12b - bra p8l_skip12b - ; source: test_uword_lte.p8:1509 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1510 skip12b: -p8l_skip12b - ; source: test_uword_lte.p8:1512 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_180_afterif - ; source: test_uword_lte.p8:1513 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_uword_lte.p8:1516 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_182_else - ; source: test_uword_lte.p8:1517 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_uword_lte.p8:1519 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_uword_lte.p8:1521 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_lte.p8:1523 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl13a - ; source: test_uword_lte.p8:1525 goto skip13a - bra p8l_skip13a - ; source: test_uword_lte.p8:1526 lbl13a: fail_uword(85) -p8l_lbl13a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1527 skip13a: -p8l_skip13a - ; source: test_uword_lte.p8:1529 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1530 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1532 goto skip13b - bra p8l_skip13b - ; source: test_uword_lte.p8:1533 lbl13b: fail_uword(86) -p8l_lbl13b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1534 skip13b: -p8l_skip13b - ; source: test_uword_lte.p8:1536 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_183_afterif - ; source: test_uword_lte.p8:1537 fail_uword(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_uword -label_asm_183_afterif - ; source: test_uword_lte.p8:1540 if x<=cx16.r4+0-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_185_else - ; source: test_uword_lte.p8:1541 fail_uword(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_uword - bra label_asm_184_afterif -label_asm_185_else - ; source: test_uword_lte.p8:1543 success++ - inc p8b_main.p8v_success -label_asm_184_afterif - ; source: test_uword_lte.p8:1546 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl14a - ; source: test_uword_lte.p8:1548 goto skip14a - bra p8l_skip14a - ; source: test_uword_lte.p8:1549 lbl14a: fail_uword(89) -p8l_lbl14a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1550 skip14a: -p8l_skip14a - ; source: test_uword_lte.p8:1552 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1553 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1555 goto skip14b - bra p8l_skip14b - ; source: test_uword_lte.p8:1556 lbl14b: fail_uword(90) -p8l_lbl14b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1557 skip14b: -p8l_skip14b - ; source: test_uword_lte.p8:1559 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_186_afterif - ; source: test_uword_lte.p8:1560 fail_uword(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_uword -label_asm_186_afterif - ; source: test_uword_lte.p8:1563 if x<=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_188_else - ; source: test_uword_lte.p8:1564 fail_uword(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_uword - bra label_asm_187_afterif -label_asm_188_else - ; source: test_uword_lte.p8:1566 success++ - inc p8b_main.p8v_success -label_asm_187_afterif - ; source: test_uword_lte.p8:1569 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl15a - ; source: test_uword_lte.p8:1571 goto skip15a - bra p8l_skip15a - ; source: test_uword_lte.p8:1572 lbl15a: fail_uword(93) -p8l_lbl15a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1573 skip15a: -p8l_skip15a - ; source: test_uword_lte.p8:1575 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1576 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1578 goto skip15b - bra p8l_skip15b - ; source: test_uword_lte.p8:1579 lbl15b: fail_uword(94) -p8l_lbl15b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_lte.p8:1580 skip15b: -p8l_skip15b - ; source: test_uword_lte.p8:1582 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_189_afterif - ; source: test_uword_lte.p8:1583 fail_uword(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_uword -label_asm_189_afterif - ; source: test_uword_lte.p8:1586 if x<=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_191_else - ; source: test_uword_lte.p8:1587 fail_uword(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_uword - bra label_asm_190_afterif -label_asm_191_else - ; source: test_uword_lte.p8:1589 success++ - inc p8b_main.p8v_success -label_asm_190_afterif - ; source: test_uword_lte.p8:1592 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl16a - ; source: test_uword_lte.p8:1594 goto skip16a - bra p8l_skip16a - ; source: test_uword_lte.p8:1595 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1596 skip16a: -p8l_skip16a - ; source: test_uword_lte.p8:1598 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_lte.p8:1599 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_lte.p8:1601 goto skip16b - bra p8l_skip16b - ; source: test_uword_lte.p8:1602 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_uword_lte.p8:1603 skip16b: -p8l_skip16b - ; source: test_uword_lte.p8:1605 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_192_afterif - ; source: test_uword_lte.p8:1606 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_uword_lte.p8:1609 if x<=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_194_else - ; source: test_uword_lte.p8:1610 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_uword_lte.p8:1612 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_uword_lte.p8:1614 verify_success(46) - lda #$2e - jmp p8b_main.p8s_verify_success - ; source: test_uword_lte.p8:1235 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .word ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $54, $45, $53, $54 - .byte $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n<=number: " - .byte $0d, $3c, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n<=var: " - .byte $0d, $3c, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n<=expr: " - .byte $0d, $3c, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_uword_lte.p8:14 txt.print("\nless-equal tests for: ") - ; source: test_uword_lte.p8:18 txt.print("\n<=number: ") - ; source: test_uword_lte.p8:20 txt.print("\n<=var: ") - ; source: test_uword_lte.p8:22 txt.print("\n<=array[]: ") - ; source: test_uword_lte.p8:24 txt.print("\n<=expr: ") - ; source: test_uword_lte.p8:33 txt.print(" **failed** ") - ; source: test_uword_lte.p8:35 txt.print(" success, expected ") - ; source: test_uword_lte.p8:41 txt.print(" **fail#") - ; source: test_uword_lte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_lte.p8 b/compiler/test/comparisons/test_uword_lte.p8 deleted file mode 100644 index dbd913a62..000000000 --- a/compiler/test/comparisons/test_uword_lte.p8 +++ /dev/null @@ -1,1618 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\nless-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=number: ") - test_cmp_number() - txt.print("\n<=var: ") - test_cmp_var() - txt.print("\n<=array[]: ") - test_cmp_array() - txt.print("\n<=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - uword @shared x - success = 0 - x=0 - ; direct jump - if x<=0 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=0 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=1 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=30464 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=65535 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=65535 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=65535 - success++ - - ; with else - if x<=65535 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=0 - goto lbl5a - goto skip5a -lbl5a: fail_uword(1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=0 - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(2) -skip5b: - ; no else - if x<=0 - fail_uword(3) - - ; with else - if x<=0 - fail_uword(4) - else - success++ - - ; direct jump - if x<=1 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=1 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=30464 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=65535 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=65535 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x<=65535 - success++ - - ; with else - if x<=65535 - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x<=0 - goto lbl9a - goto skip9a -lbl9a: fail_uword(5) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=0 - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(6) -skip9b: - ; no else - if x<=0 - fail_uword(7) - - ; with else - if x<=0 - fail_uword(8) - else - success++ - - ; direct jump - if x<=1 - goto lbl10a - goto skip10a -lbl10a: fail_uword(9) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=1 - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(10) -skip10b: - ; no else - if x<=1 - fail_uword(11) - - ; with else - if x<=1 - fail_uword(12) - else - success++ - - ; direct jump - if x<=30464 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=30464 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=65535 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=65535 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=65535 - success++ - - ; with else - if x<=65535 - success++ - else - cx16.r0L++ - - x=65535 - ; direct jump - if x<=0 - goto lbl13a - goto skip13a -lbl13a: fail_uword(13) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=0 - goto cx16.r3 - goto skip13b -lbl13b: fail_uword(14) -skip13b: - ; no else - if x<=0 - fail_uword(15) - - ; with else - if x<=0 - fail_uword(16) - else - success++ - - ; direct jump - if x<=1 - goto lbl14a - goto skip14a -lbl14a: fail_uword(17) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=1 - goto cx16.r3 - goto skip14b -lbl14b: fail_uword(18) -skip14b: - ; no else - if x<=1 - fail_uword(19) - - ; with else - if x<=1 - fail_uword(20) - else - success++ - - ; direct jump - if x<=30464 - goto lbl15a - goto skip15a -lbl15a: fail_uword(21) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=30464 - goto cx16.r3 - goto skip15b -lbl15b: fail_uword(22) -skip15b: - ; no else - if x<=30464 - fail_uword(23) - - ; with else - if x<=30464 - fail_uword(24) - else - success++ - - ; direct jump - if x<=65535 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=65535 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x<=65535 - success++ - - ; with else - if x<=65535 - success++ - else - cx16.r0L++ - - verify_success(46) -} - sub test_cmp_var() { - uword @shared x, value - success = 0 - x=0 - value=0 - ; direct jump - if x<=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x<=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=1 - value=0 - ; direct jump - if x<=value - goto lbl5a - goto skip5a -lbl5a: fail_uword(25) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=value - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(26) -skip5b: - ; no else - if x<=value - fail_uword(27) - - ; with else - if x<=value - fail_uword(28) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x<=value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=30464 - value=0 - ; direct jump - if x<=value - goto lbl9a - goto skip9a -lbl9a: fail_uword(29) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=value - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(30) -skip9b: - ; no else - if x<=value - fail_uword(31) - - ; with else - if x<=value - fail_uword(32) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl10a - goto skip10a -lbl10a: fail_uword(33) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=value - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(34) -skip10b: - ; no else - if x<=value - fail_uword(35) - - ; with else - if x<=value - fail_uword(36) - else - success++ - - value=30464 - ; direct jump - if x<=value - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=value - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=65535 - ; direct jump - if x<=value - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=value - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=65535 - value=0 - ; direct jump - if x<=value - goto lbl13a - goto skip13a -lbl13a: fail_uword(37) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=value - goto cx16.r3 - goto skip13b -lbl13b: fail_uword(38) -skip13b: - ; no else - if x<=value - fail_uword(39) - - ; with else - if x<=value - fail_uword(40) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl14a - goto skip14a -lbl14a: fail_uword(41) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=value - goto cx16.r3 - goto skip14b -lbl14b: fail_uword(42) -skip14b: - ; no else - if x<=value - fail_uword(43) - - ; with else - if x<=value - fail_uword(44) - else - success++ - - value=30464 - ; direct jump - if x<=value - goto lbl15a - goto skip15a -lbl15a: fail_uword(45) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=value - goto cx16.r3 - goto skip15b -lbl15b: fail_uword(46) -skip15b: - ; no else - if x<=value - fail_uword(47) - - ; with else - if x<=value - fail_uword(48) - else - success++ - - value=65535 - ; direct jump - if x<=value - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=value - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - verify_success(46) -} - sub test_cmp_array() { - uword @shared x - uword[] values = [0, 0] - success = 0 - x=0 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=1 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl5a - goto skip5a -lbl5a: fail_uword(49) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(50) -skip5b: - ; no else - if x<=values[1] - fail_uword(51) - - ; with else - if x<=values[1] - fail_uword(52) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=30464 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl9a - goto skip9a -lbl9a: fail_uword(53) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(54) -skip9b: - ; no else - if x<=values[1] - fail_uword(55) - - ; with else - if x<=values[1] - fail_uword(56) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_uword(57) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(58) -skip10b: - ; no else - if x<=values[1] - fail_uword(59) - - ; with else - if x<=values[1] - fail_uword(60) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=65535 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl13a - goto skip13a -lbl13a: fail_uword(61) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_uword(62) -skip13b: - ; no else - if x<=values[1] - fail_uword(63) - - ; with else - if x<=values[1] - fail_uword(64) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl14a - goto skip14a -lbl14a: fail_uword(65) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_uword(66) -skip14b: - ; no else - if x<=values[1] - fail_uword(67) - - ; with else - if x<=values[1] - fail_uword(68) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_uword(69) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_uword(70) -skip15b: - ; no else - if x<=values[1] - fail_uword(71) - - ; with else - if x<=values[1] - fail_uword(72) - else - success++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - verify_success(46) -} - sub test_cmp_expr() { - uword @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=0 - ; direct jump - if x<=cx16.r4+0-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=cx16.r4+0-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+0-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4+1-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4+30464-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4+65535-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=cx16.r4+0-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: fail_uword(73) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(74) -skip5b: - ; no else - if x<=cx16.r4+0-cx16.r5 - fail_uword(75) - - ; with else - if x<=cx16.r4+0-cx16.r5 - fail_uword(76) - else - success++ - - ; direct jump - if x<=cx16.r4+1-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=cx16.r4+1-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4+30464-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4+65535-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x<=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x<=cx16.r4+0-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: fail_uword(77) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(78) -skip9b: - ; no else - if x<=cx16.r4+0-cx16.r5 - fail_uword(79) - - ; with else - if x<=cx16.r4+0-cx16.r5 - fail_uword(80) - else - success++ - - ; direct jump - if x<=cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: fail_uword(81) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(82) -skip10b: - ; no else - if x<=cx16.r4+1-cx16.r5 - fail_uword(83) - - ; with else - if x<=cx16.r4+1-cx16.r5 - fail_uword(84) - else - success++ - - ; direct jump - if x<=cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - x=65535 - ; direct jump - if x<=cx16.r4+0-cx16.r5 - goto lbl13a - goto skip13a -lbl13a: fail_uword(85) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=cx16.r4+0-cx16.r5 - goto cx16.r3 - goto skip13b -lbl13b: fail_uword(86) -skip13b: - ; no else - if x<=cx16.r4+0-cx16.r5 - fail_uword(87) - - ; with else - if x<=cx16.r4+0-cx16.r5 - fail_uword(88) - else - success++ - - ; direct jump - if x<=cx16.r4+1-cx16.r5 - goto lbl14a - goto skip14a -lbl14a: fail_uword(89) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip14b -lbl14b: fail_uword(90) -skip14b: - ; no else - if x<=cx16.r4+1-cx16.r5 - fail_uword(91) - - ; with else - if x<=cx16.r4+1-cx16.r5 - fail_uword(92) - else - success++ - - ; direct jump - if x<=cx16.r4+30464-cx16.r5 - goto lbl15a - goto skip15a -lbl15a: fail_uword(93) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip15b -lbl15b: fail_uword(94) -skip15b: - ; no else - if x<=cx16.r4+30464-cx16.r5 - fail_uword(95) - - ; with else - if x<=cx16.r4+30464-cx16.r5 - fail_uword(96) - else - success++ - - ; direct jump - if x<=cx16.r4+65535-cx16.r5 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x<=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if x<=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - verify_success(46) -} - -} - diff --git a/compiler/test/comparisons/test_uword_splitw_equalities.asm b/compiler/test/comparisons/test_uword_splitw_equalities.asm deleted file mode 100644 index baf3cce3f..000000000 --- a/compiler/test/comparisons/test_uword_splitw_equalities.asm +++ /dev/null @@ -1,19583 +0,0 @@ -; w65c02 assembly code for 'test_uword_splitw_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:44 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_splitw_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_splitw_equalities.p8:9 ubyte success = 0 - ; source: test_uword_splitw_equalities.p8:10 str datatype = "uword" - ; source: test_uword_splitw_equalities.p8:11 uword @shared comparison - ; source: test_uword_splitw_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_splitw_equalities.p8:14 txt.print("\n(in)equality tests for split words datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:83 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:85 goto skip2 - bra p8l_skip2 - ; source: test_uword_splitw_equalities.p8:86 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:87 skip2: -p8l_skip2 - ; source: test_uword_splitw_equalities.p8:89 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_3_afterif - ; source: test_uword_splitw_equalities.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_uword_splitw_equalities.p8:93 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_5_else - ; source: test_uword_splitw_equalities.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_splitw_equalities.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_uword_splitw_equalities.p8:98 sources[1] = 9999 - ldy #1 - lda #<$270f - sta p8v_sources_lsb,y - lda #>$270f - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:100 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq p8l_skip3 - ; source: test_uword_splitw_equalities.p8:102 success++ - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:103 skip3: -p8l_skip3 - ; source: test_uword_splitw_equalities.p8:105 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:106 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:108 success++ - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:109 skip4: -p8l_skip4 - ; source: test_uword_splitw_equalities.p8:111 success++ - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:112 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_6_afterif - ; source: test_uword_splitw_equalities.p8:113 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_uword_splitw_equalities.p8:116 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_8_else - ; source: test_uword_splitw_equalities.p8:117 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_splitw_equalities.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_uword_splitw_equalities.p8:121 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:70 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_uword_splitw_equalities.p8:125 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_uword_splitw_equalities.p8:126 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:127 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:129 sources[1]=9999 - ldy #1 - lda #<$270f - sta p8v_sources_lsb,y - lda #>$270f - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:131 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne p8l_lbl1 - ; source: test_uword_splitw_equalities.p8:133 goto skip1 - bra p8l_skip1 - ; source: test_uword_splitw_equalities.p8:134 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:135 skip1: -p8l_skip1 - ; source: test_uword_splitw_equalities.p8:137 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:138 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:140 goto skip2 - bra p8l_skip2 - ; source: test_uword_splitw_equalities.p8:141 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:142 skip2: -p8l_skip2 - ; source: test_uword_splitw_equalities.p8:144 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_9_afterif - ; source: test_uword_splitw_equalities.p8:145 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_uword_splitw_equalities.p8:148 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_11_else - ; source: test_uword_splitw_equalities.p8:149 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_splitw_equalities.p8:151 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_uword_splitw_equalities.p8:153 sources[1] = 0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:155 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne p8l_skip3 - ; source: test_uword_splitw_equalities.p8:157 success++ - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:158 skip3: -p8l_skip3 - ; source: test_uword_splitw_equalities.p8:160 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:161 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:163 success++ - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:164 skip4: -p8l_skip4 - ; source: test_uword_splitw_equalities.p8:166 success++ - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:167 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_12_afterif - ; source: test_uword_splitw_equalities.p8:168 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_uword_splitw_equalities.p8:171 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_14_else - ; source: test_uword_splitw_equalities.p8:172 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_splitw_equalities.p8:174 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_uword_splitw_equalities.p8:176 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:125 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_uword_splitw_equalities.p8:179 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_uword_splitw_equalities.p8:180 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:181 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:182 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:184 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1a -+ - ; source: test_uword_splitw_equalities.p8:186 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:187 lbl1a: fail_uword(1,0) -p8l_lbl1a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:188 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:190 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:191 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:193 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:194 lbl1b: fail_uword(2,0) -p8l_lbl1b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:195 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:197 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_15_afterif - cpy p8v_sources_msb+1 - bne label_asm_15_afterif - ; source: test_uword_splitw_equalities.p8:198 fail_uword(3,0) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_15_afterif - ; source: test_uword_splitw_equalities.p8:201 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_17_else - cpy p8v_sources_msb+1 - bne label_asm_17_else - ; source: test_uword_splitw_equalities.p8:202 fail_uword(4,0) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_splitw_equalities.p8:204 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_uword_splitw_equalities.p8:207 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2a -+ - ; source: test_uword_splitw_equalities.p8:209 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:210 lbl2a: fail_uword(5,0) -p8l_lbl2a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:211 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:213 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:214 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:216 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:217 lbl2b: fail_uword(6,0) -p8l_lbl2b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:218 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:220 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_18_afterif - cpy p8v_sources_msb+1 - bne label_asm_18_afterif - ; source: test_uword_splitw_equalities.p8:221 fail_uword(7,0) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_18_afterif - ; source: test_uword_splitw_equalities.p8:224 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_20_else - cpy p8v_sources_msb+1 - bne label_asm_20_else - ; source: test_uword_splitw_equalities.p8:225 fail_uword(8,0) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_splitw_equalities.p8:227 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_uword_splitw_equalities.p8:230 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3a -+ - ; source: test_uword_splitw_equalities.p8:232 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:233 lbl3a: fail_uword(9,0) -p8l_lbl3a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:234 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:236 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:237 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:239 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:240 lbl3b: fail_uword(10,0) -p8l_lbl3b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:241 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:243 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_21_afterif - cpy p8v_sources_msb+1 - bne label_asm_21_afterif - ; source: test_uword_splitw_equalities.p8:244 fail_uword(11,0) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_21_afterif - ; source: test_uword_splitw_equalities.p8:247 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_23_else - cpy p8v_sources_msb+1 - bne label_asm_23_else - ; source: test_uword_splitw_equalities.p8:248 fail_uword(12,0) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_splitw_equalities.p8:250 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_uword_splitw_equalities.p8:252 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:254 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4a -+ - ; source: test_uword_splitw_equalities.p8:256 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:257 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:258 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:260 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:261 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:263 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:264 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:265 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:267 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_24_afterif - cpy p8v_sources_msb+1 - bne label_asm_24_afterif - ; source: test_uword_splitw_equalities.p8:268 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_uword_splitw_equalities.p8:271 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_26_else - cpy p8v_sources_msb+1 - bne label_asm_26_else - ; source: test_uword_splitw_equalities.p8:272 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_splitw_equalities.p8:274 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_uword_splitw_equalities.p8:277 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5a -+ - ; source: test_uword_splitw_equalities.p8:279 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:280 lbl5a: fail_uword(13,1) -p8l_lbl5a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:281 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:283 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:284 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:286 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:287 lbl5b: fail_uword(14,1) -p8l_lbl5b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:288 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:290 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_27_afterif - cpy p8v_sources_msb+1 - bne label_asm_27_afterif - ; source: test_uword_splitw_equalities.p8:291 fail_uword(15,1) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_27_afterif - ; source: test_uword_splitw_equalities.p8:294 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_29_else - cpy p8v_sources_msb+1 - bne label_asm_29_else - ; source: test_uword_splitw_equalities.p8:295 fail_uword(16,1) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_splitw_equalities.p8:297 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_uword_splitw_equalities.p8:300 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6a -+ - ; source: test_uword_splitw_equalities.p8:302 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:303 lbl6a: fail_uword(17,1) -p8l_lbl6a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:304 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:306 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:307 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:309 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:310 lbl6b: fail_uword(18,1) -p8l_lbl6b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:311 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:313 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_30_afterif - cpy p8v_sources_msb+1 - bne label_asm_30_afterif - ; source: test_uword_splitw_equalities.p8:314 fail_uword(19,1) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_30_afterif - ; source: test_uword_splitw_equalities.p8:317 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_32_else - cpy p8v_sources_msb+1 - bne label_asm_32_else - ; source: test_uword_splitw_equalities.p8:318 fail_uword(20,1) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_splitw_equalities.p8:320 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_uword_splitw_equalities.p8:322 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:324 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7a -+ - ; source: test_uword_splitw_equalities.p8:326 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:327 lbl7a: fail_uword(21,30464) -p8l_lbl7a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:328 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:330 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:331 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:333 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:334 lbl7b: fail_uword(22,30464) -p8l_lbl7b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:335 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:337 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_33_afterif - cpy p8v_sources_msb+1 - bne label_asm_33_afterif - ; source: test_uword_splitw_equalities.p8:338 fail_uword(23,30464) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_33_afterif - ; source: test_uword_splitw_equalities.p8:341 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_35_else - cpy p8v_sources_msb+1 - bne label_asm_35_else - ; source: test_uword_splitw_equalities.p8:342 fail_uword(24,30464) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_splitw_equalities.p8:344 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_uword_splitw_equalities.p8:347 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8a -+ - ; source: test_uword_splitw_equalities.p8:349 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:350 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:351 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:353 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:354 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:356 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:357 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:358 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:360 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_36_afterif - cpy p8v_sources_msb+1 - bne label_asm_36_afterif - ; source: test_uword_splitw_equalities.p8:361 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_uword_splitw_equalities.p8:364 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_38_else - cpy p8v_sources_msb+1 - bne label_asm_38_else - ; source: test_uword_splitw_equalities.p8:365 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_splitw_equalities.p8:367 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_uword_splitw_equalities.p8:370 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9a -+ - ; source: test_uword_splitw_equalities.p8:372 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:373 lbl9a: fail_uword(25,30464) -p8l_lbl9a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:374 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:376 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:377 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:379 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:380 lbl9b: fail_uword(26,30464) -p8l_lbl9b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:381 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:383 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_39_afterif - cpy p8v_sources_msb+1 - bne label_asm_39_afterif - ; source: test_uword_splitw_equalities.p8:384 fail_uword(27,30464) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_39_afterif - ; source: test_uword_splitw_equalities.p8:387 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_41_else - cpy p8v_sources_msb+1 - bne label_asm_41_else - ; source: test_uword_splitw_equalities.p8:388 fail_uword(28,30464) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_splitw_equalities.p8:390 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_uword_splitw_equalities.p8:392 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:394 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10a -+ - ; source: test_uword_splitw_equalities.p8:396 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:397 lbl10a: fail_uword(29,65535) -p8l_lbl10a - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:398 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:400 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:401 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:403 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:404 lbl10b: fail_uword(30,65535) -p8l_lbl10b - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:405 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:407 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_42_afterif - cpy p8v_sources_msb+1 - bne label_asm_42_afterif - ; source: test_uword_splitw_equalities.p8:408 fail_uword(31,65535) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_42_afterif - ; source: test_uword_splitw_equalities.p8:411 if sources[1]==1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne label_asm_44_else - cpy p8v_sources_msb+1 - bne label_asm_44_else - ; source: test_uword_splitw_equalities.p8:412 fail_uword(32,65535) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_splitw_equalities.p8:414 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_uword_splitw_equalities.p8:417 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11a -+ - ; source: test_uword_splitw_equalities.p8:419 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:420 lbl11a: fail_uword(33,65535) -p8l_lbl11a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:421 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:423 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:424 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:426 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:427 lbl11b: fail_uword(34,65535) -p8l_lbl11b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:428 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:430 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_45_afterif - cpy p8v_sources_msb+1 - bne label_asm_45_afterif - ; source: test_uword_splitw_equalities.p8:431 fail_uword(35,65535) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_45_afterif - ; source: test_uword_splitw_equalities.p8:434 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_47_else - cpy p8v_sources_msb+1 - bne label_asm_47_else - ; source: test_uword_splitw_equalities.p8:435 fail_uword(36,65535) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_splitw_equalities.p8:437 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_uword_splitw_equalities.p8:440 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12a -+ - ; source: test_uword_splitw_equalities.p8:442 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:443 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:444 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:446 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:447 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:449 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:450 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:451 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:453 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_48_afterif - cpy p8v_sources_msb+1 - bne label_asm_48_afterif - ; source: test_uword_splitw_equalities.p8:454 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_uword_splitw_equalities.p8:457 if sources[1]==65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne label_asm_50_else - cpy p8v_sources_msb+1 - bne label_asm_50_else - ; source: test_uword_splitw_equalities.p8:458 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_splitw_equalities.p8:460 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_uword_splitw_equalities.p8:462 verify_success(12) - lda #12 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:179 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_uword_splitw_equalities.p8:464 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_uword_splitw_equalities.p8:465 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:466 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:467 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:469 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1a - cpy p8v_sources_msb+1 - bne p8l_lbl1a - ; source: test_uword_splitw_equalities.p8:471 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:472 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:473 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:475 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:476 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:478 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:479 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:480 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:482 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_51_afterif -+ - ; source: test_uword_splitw_equalities.p8:483 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_uword_splitw_equalities.p8:486 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_53_else -+ - ; source: test_uword_splitw_equalities.p8:487 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_splitw_equalities.p8:489 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_uword_splitw_equalities.p8:492 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl2a - cpy p8v_sources_msb+1 - bne p8l_lbl2a - ; source: test_uword_splitw_equalities.p8:494 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:495 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:496 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:498 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:499 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:501 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:502 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:503 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:505 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_54_afterif -+ - ; source: test_uword_splitw_equalities.p8:506 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_uword_splitw_equalities.p8:509 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_56_else -+ - ; source: test_uword_splitw_equalities.p8:510 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_splitw_equalities.p8:512 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_uword_splitw_equalities.p8:515 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne p8l_lbl3a - cpy p8v_sources_msb+1 - bne p8l_lbl3a - ; source: test_uword_splitw_equalities.p8:517 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:518 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:519 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:521 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:522 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:524 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:525 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:526 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:528 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_57_afterif -+ - ; source: test_uword_splitw_equalities.p8:529 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_uword_splitw_equalities.p8:532 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_59_else -+ - ; source: test_uword_splitw_equalities.p8:533 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_splitw_equalities.p8:535 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_uword_splitw_equalities.p8:537 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:539 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4a - cpy p8v_sources_msb+1 - bne p8l_lbl4a - ; source: test_uword_splitw_equalities.p8:541 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:542 lbl4a: fail_uword(37,1) -p8l_lbl4a - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:543 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:545 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:546 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:548 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:549 lbl4b: fail_uword(38,1) -p8l_lbl4b - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:550 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:552 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_60_afterif -+ - ; source: test_uword_splitw_equalities.p8:553 fail_uword(39,1) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_60_afterif - ; source: test_uword_splitw_equalities.p8:556 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_62_else -+ - ; source: test_uword_splitw_equalities.p8:557 fail_uword(40,1) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_splitw_equalities.p8:559 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_uword_splitw_equalities.p8:562 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl5a - cpy p8v_sources_msb+1 - bne p8l_lbl5a - ; source: test_uword_splitw_equalities.p8:564 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:565 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:566 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:568 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:569 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:571 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:572 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:573 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:575 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_63_afterif -+ - ; source: test_uword_splitw_equalities.p8:576 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_uword_splitw_equalities.p8:579 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_65_else -+ - ; source: test_uword_splitw_equalities.p8:580 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_splitw_equalities.p8:582 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_uword_splitw_equalities.p8:585 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne p8l_lbl6a - cpy p8v_sources_msb+1 - bne p8l_lbl6a - ; source: test_uword_splitw_equalities.p8:587 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:588 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:589 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:591 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:592 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:594 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:595 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:596 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:598 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_66_afterif -+ - ; source: test_uword_splitw_equalities.p8:599 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_uword_splitw_equalities.p8:602 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_68_else -+ - ; source: test_uword_splitw_equalities.p8:603 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_splitw_equalities.p8:605 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_uword_splitw_equalities.p8:607 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:609 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7a - cpy p8v_sources_msb+1 - bne p8l_lbl7a - ; source: test_uword_splitw_equalities.p8:611 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:612 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:613 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:615 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:616 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:618 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:619 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:620 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:622 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_69_afterif -+ - ; source: test_uword_splitw_equalities.p8:623 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_uword_splitw_equalities.p8:626 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_71_else -+ - ; source: test_uword_splitw_equalities.p8:627 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_splitw_equalities.p8:629 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_uword_splitw_equalities.p8:632 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl8a - cpy p8v_sources_msb+1 - bne p8l_lbl8a - ; source: test_uword_splitw_equalities.p8:634 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:635 lbl8a: fail_uword(41,30464) -p8l_lbl8a - lda #<$29 - ldy #>$29 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:636 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:638 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:639 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:641 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:642 lbl8b: fail_uword(42,30464) -p8l_lbl8b - lda #<$2a - ldy #>$2a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:643 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:645 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_72_afterif -+ - ; source: test_uword_splitw_equalities.p8:646 fail_uword(43,30464) - lda #<$2b - ldy #>$2b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_72_afterif - ; source: test_uword_splitw_equalities.p8:649 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_74_else -+ - ; source: test_uword_splitw_equalities.p8:650 fail_uword(44,30464) - lda #<$2c - ldy #>$2c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_splitw_equalities.p8:652 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_uword_splitw_equalities.p8:655 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne p8l_lbl9a - cpy p8v_sources_msb+1 - bne p8l_lbl9a - ; source: test_uword_splitw_equalities.p8:657 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:658 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:659 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:661 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:662 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:664 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:665 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:666 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:668 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_75_afterif -+ - ; source: test_uword_splitw_equalities.p8:669 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_uword_splitw_equalities.p8:672 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_77_else -+ - ; source: test_uword_splitw_equalities.p8:673 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_splitw_equalities.p8:675 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_uword_splitw_equalities.p8:677 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:679 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10a - cpy p8v_sources_msb+1 - bne p8l_lbl10a - ; source: test_uword_splitw_equalities.p8:681 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:682 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:683 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:685 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:686 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:688 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:689 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:690 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:692 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_78_afterif -+ - ; source: test_uword_splitw_equalities.p8:693 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_uword_splitw_equalities.p8:696 if sources[1]!=1 - ldy #>1 - lda #<1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_80_else -+ - ; source: test_uword_splitw_equalities.p8:697 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_splitw_equalities.p8:699 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_uword_splitw_equalities.p8:702 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl11a - cpy p8v_sources_msb+1 - bne p8l_lbl11a - ; source: test_uword_splitw_equalities.p8:704 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:705 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:706 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:708 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:709 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:711 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:712 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:713 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:715 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_81_afterif -+ - ; source: test_uword_splitw_equalities.p8:716 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_uword_splitw_equalities.p8:719 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_83_else -+ - ; source: test_uword_splitw_equalities.p8:720 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_splitw_equalities.p8:722 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_uword_splitw_equalities.p8:725 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne p8l_lbl12a - cpy p8v_sources_msb+1 - bne p8l_lbl12a - ; source: test_uword_splitw_equalities.p8:727 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:728 lbl12a: fail_uword(45,65535) -p8l_lbl12a - lda #<$2d - ldy #>$2d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:729 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:731 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:732 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:734 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:735 lbl12b: fail_uword(46,65535) -p8l_lbl12b - lda #<$2e - ldy #>$2e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:736 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:738 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_84_afterif -+ - ; source: test_uword_splitw_equalities.p8:739 fail_uword(47,65535) - lda #<$2f - ldy #>$2f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_84_afterif - ; source: test_uword_splitw_equalities.p8:742 if sources[1]!=65535 - ldy #>$ffff - lda #<$ffff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_86_else -+ - ; source: test_uword_splitw_equalities.p8:743 fail_uword(48,65535) - lda #<$30 - ldy #>$30 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_splitw_equalities.p8:745 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_uword_splitw_equalities.p8:747 verify_success(36) - lda #$24 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:464 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_uword_splitw_equalities.p8:749 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_uword_splitw_equalities.p8:750 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:751 uword[] @split values = [8888,8888] - ; source: test_uword_splitw_equalities.p8:752 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:753 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:754 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:756 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1a -+ - ; source: test_uword_splitw_equalities.p8:758 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:759 lbl1a: fail_uword(49,0) -p8l_lbl1a - lda #<$31 - ldy #>$31 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:760 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:762 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:763 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:765 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:766 lbl1b: fail_uword(50,0) -p8l_lbl1b - lda #<$32 - ldy #>$32 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:767 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:769 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_87_afterif - cpy p8v_sources_msb+1 - bne label_asm_87_afterif - ; source: test_uword_splitw_equalities.p8:770 fail_uword(51,0) - lda #<$33 - ldy #>$33 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_87_afterif - ; source: test_uword_splitw_equalities.p8:773 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_89_else - cpy p8v_sources_msb+1 - bne label_asm_89_else - ; source: test_uword_splitw_equalities.p8:774 fail_uword(52,0) - lda #<$34 - ldy #>$34 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_splitw_equalities.p8:776 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_uword_splitw_equalities.p8:778 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:780 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2a -+ - ; source: test_uword_splitw_equalities.p8:782 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:783 lbl2a: fail_uword(53,0) -p8l_lbl2a - lda #<$35 - ldy #>$35 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:784 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:786 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:787 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:789 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:790 lbl2b: fail_uword(54,0) -p8l_lbl2b - lda #<$36 - ldy #>$36 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:791 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:793 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_90_afterif - cpy p8v_sources_msb+1 - bne label_asm_90_afterif - ; source: test_uword_splitw_equalities.p8:794 fail_uword(55,0) - lda #<$37 - ldy #>$37 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_90_afterif - ; source: test_uword_splitw_equalities.p8:797 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_92_else - cpy p8v_sources_msb+1 - bne label_asm_92_else - ; source: test_uword_splitw_equalities.p8:798 fail_uword(56,0) - lda #<$38 - ldy #>$38 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_splitw_equalities.p8:800 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_uword_splitw_equalities.p8:802 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:804 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3a -+ - ; source: test_uword_splitw_equalities.p8:806 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:807 lbl3a: fail_uword(57,0) -p8l_lbl3a - lda #<$39 - ldy #>$39 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:808 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:810 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:811 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:813 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:814 lbl3b: fail_uword(58,0) -p8l_lbl3b - lda #<$3a - ldy #>$3a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:815 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:817 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_93_afterif - cpy p8v_sources_msb+1 - bne label_asm_93_afterif - ; source: test_uword_splitw_equalities.p8:818 fail_uword(59,0) - lda #<$3b - ldy #>$3b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_93_afterif - ; source: test_uword_splitw_equalities.p8:821 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_95_else - cpy p8v_sources_msb+1 - bne label_asm_95_else - ; source: test_uword_splitw_equalities.p8:822 fail_uword(60,0) - lda #<$3c - ldy #>$3c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_splitw_equalities.p8:824 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_uword_splitw_equalities.p8:826 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:827 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:829 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4a -+ - ; source: test_uword_splitw_equalities.p8:831 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:832 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:833 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:835 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:836 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:838 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:839 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:840 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:842 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_96_afterif - cpy p8v_sources_msb+1 - bne label_asm_96_afterif - ; source: test_uword_splitw_equalities.p8:843 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_uword_splitw_equalities.p8:846 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_98_else - cpy p8v_sources_msb+1 - bne label_asm_98_else - ; source: test_uword_splitw_equalities.p8:847 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_splitw_equalities.p8:849 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_uword_splitw_equalities.p8:851 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:853 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5a -+ - ; source: test_uword_splitw_equalities.p8:855 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:856 lbl5a: fail_uword(61,1) -p8l_lbl5a - lda #<$3d - ldy #>$3d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:857 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:859 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:860 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:862 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:863 lbl5b: fail_uword(62,1) -p8l_lbl5b - lda #<$3e - ldy #>$3e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:864 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:866 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_99_afterif - cpy p8v_sources_msb+1 - bne label_asm_99_afterif - ; source: test_uword_splitw_equalities.p8:867 fail_uword(63,1) - lda #<$3f - ldy #>$3f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_99_afterif - ; source: test_uword_splitw_equalities.p8:870 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_101_else - cpy p8v_sources_msb+1 - bne label_asm_101_else - ; source: test_uword_splitw_equalities.p8:871 fail_uword(64,1) - lda #<$40 - ldy #>$40 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_100_afterif -label_asm_101_else - ; source: test_uword_splitw_equalities.p8:873 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_uword_splitw_equalities.p8:875 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:877 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6a -+ - ; source: test_uword_splitw_equalities.p8:879 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:880 lbl6a: fail_uword(65,1) -p8l_lbl6a - lda #<$41 - ldy #>$41 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:881 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:883 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:884 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:886 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:887 lbl6b: fail_uword(66,1) -p8l_lbl6b - lda #<$42 - ldy #>$42 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:888 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:890 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_102_afterif - cpy p8v_sources_msb+1 - bne label_asm_102_afterif - ; source: test_uword_splitw_equalities.p8:891 fail_uword(67,1) - lda #<$43 - ldy #>$43 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_102_afterif - ; source: test_uword_splitw_equalities.p8:894 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_104_else - cpy p8v_sources_msb+1 - bne label_asm_104_else - ; source: test_uword_splitw_equalities.p8:895 fail_uword(68,1) - lda #<$44 - ldy #>$44 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_103_afterif -label_asm_104_else - ; source: test_uword_splitw_equalities.p8:897 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_uword_splitw_equalities.p8:899 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:900 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:902 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7a -+ - ; source: test_uword_splitw_equalities.p8:904 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:905 lbl7a: fail_uword(69,30464) -p8l_lbl7a - lda #<$45 - ldy #>$45 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:906 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:908 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:909 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:911 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:912 lbl7b: fail_uword(70,30464) -p8l_lbl7b - lda #<$46 - ldy #>$46 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:913 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:915 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_105_afterif - cpy p8v_sources_msb+1 - bne label_asm_105_afterif - ; source: test_uword_splitw_equalities.p8:916 fail_uword(71,30464) - lda #<$47 - ldy #>$47 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_105_afterif - ; source: test_uword_splitw_equalities.p8:919 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_107_else - cpy p8v_sources_msb+1 - bne label_asm_107_else - ; source: test_uword_splitw_equalities.p8:920 fail_uword(72,30464) - lda #<$48 - ldy #>$48 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_106_afterif -label_asm_107_else - ; source: test_uword_splitw_equalities.p8:922 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_uword_splitw_equalities.p8:924 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:926 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8a -+ - ; source: test_uword_splitw_equalities.p8:928 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:929 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:930 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:932 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:933 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:935 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:936 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:937 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:939 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_108_afterif - cpy p8v_sources_msb+1 - bne label_asm_108_afterif - ; source: test_uword_splitw_equalities.p8:940 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_uword_splitw_equalities.p8:943 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_110_else - cpy p8v_sources_msb+1 - bne label_asm_110_else - ; source: test_uword_splitw_equalities.p8:944 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_uword_splitw_equalities.p8:946 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_uword_splitw_equalities.p8:948 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:950 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9a -+ - ; source: test_uword_splitw_equalities.p8:952 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:953 lbl9a: fail_uword(73,30464) -p8l_lbl9a - lda #<$49 - ldy #>$49 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:954 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:956 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:957 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:959 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:960 lbl9b: fail_uword(74,30464) -p8l_lbl9b - lda #<$4a - ldy #>$4a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:961 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:963 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_111_afterif - cpy p8v_sources_msb+1 - bne label_asm_111_afterif - ; source: test_uword_splitw_equalities.p8:964 fail_uword(75,30464) - lda #<$4b - ldy #>$4b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_111_afterif - ; source: test_uword_splitw_equalities.p8:967 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_113_else - cpy p8v_sources_msb+1 - bne label_asm_113_else - ; source: test_uword_splitw_equalities.p8:968 fail_uword(76,30464) - lda #<$4c - ldy #>$4c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_112_afterif -label_asm_113_else - ; source: test_uword_splitw_equalities.p8:970 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_uword_splitw_equalities.p8:972 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:973 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:975 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10a -+ - ; source: test_uword_splitw_equalities.p8:977 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:978 lbl10a: fail_uword(77,65535) -p8l_lbl10a - lda #<$4d - ldy #>$4d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:979 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:981 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:982 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:984 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:985 lbl10b: fail_uword(78,65535) -p8l_lbl10b - lda #<$4e - ldy #>$4e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:986 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:988 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_114_afterif - cpy p8v_sources_msb+1 - bne label_asm_114_afterif - ; source: test_uword_splitw_equalities.p8:989 fail_uword(79,65535) - lda #<$4f - ldy #>$4f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_114_afterif - ; source: test_uword_splitw_equalities.p8:992 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_116_else - cpy p8v_sources_msb+1 - bne label_asm_116_else - ; source: test_uword_splitw_equalities.p8:993 fail_uword(80,65535) - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_115_afterif -label_asm_116_else - ; source: test_uword_splitw_equalities.p8:995 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_uword_splitw_equalities.p8:997 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:999 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11a -+ - ; source: test_uword_splitw_equalities.p8:1001 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1002 lbl11a: fail_uword(81,65535) -p8l_lbl11a - lda #<$51 - ldy #>$51 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1003 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1005 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1006 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1008 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1009 lbl11b: fail_uword(82,65535) -p8l_lbl11b - lda #<$52 - ldy #>$52 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1010 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1012 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_117_afterif - cpy p8v_sources_msb+1 - bne label_asm_117_afterif - ; source: test_uword_splitw_equalities.p8:1013 fail_uword(83,65535) - lda #<$53 - ldy #>$53 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_117_afterif - ; source: test_uword_splitw_equalities.p8:1016 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_119_else - cpy p8v_sources_msb+1 - bne label_asm_119_else - ; source: test_uword_splitw_equalities.p8:1017 fail_uword(84,65535) - lda #<$54 - ldy #>$54 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_118_afterif -label_asm_119_else - ; source: test_uword_splitw_equalities.p8:1019 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_uword_splitw_equalities.p8:1021 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1023 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12a -+ - ; source: test_uword_splitw_equalities.p8:1025 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1026 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1027 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1029 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1030 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1032 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1033 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1034 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1036 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_120_afterif - cpy p8v_sources_msb+1 - bne label_asm_120_afterif - ; source: test_uword_splitw_equalities.p8:1037 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_uword_splitw_equalities.p8:1040 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_122_else - cpy p8v_sources_msb+1 - bne label_asm_122_else - ; source: test_uword_splitw_equalities.p8:1041 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_uword_splitw_equalities.p8:1043 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_uword_splitw_equalities.p8:1045 verify_success(12) - lda #12 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:749 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $22b8, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend - ; source: test_uword_splitw_equalities.p8:1047 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_uword_splitw_equalities.p8:1048 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:1049 uword[] @split values = [8888,8888] - ; source: test_uword_splitw_equalities.p8:1050 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1051 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1052 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1054 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1a - cpy p8v_sources_msb+1 - bne p8l_lbl1a - ; source: test_uword_splitw_equalities.p8:1056 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1057 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1058 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1060 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1061 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1063 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1064 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1065 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1067 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_123_afterif -+ - ; source: test_uword_splitw_equalities.p8:1068 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_uword_splitw_equalities.p8:1071 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_125_else -+ - ; source: test_uword_splitw_equalities.p8:1072 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_uword_splitw_equalities.p8:1074 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_uword_splitw_equalities.p8:1076 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1078 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl2a - cpy p8v_sources_msb+1 - bne p8l_lbl2a - ; source: test_uword_splitw_equalities.p8:1080 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1081 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1082 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1084 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1085 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1087 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1088 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1089 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1091 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_126_afterif -+ - ; source: test_uword_splitw_equalities.p8:1092 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_uword_splitw_equalities.p8:1095 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_128_else -+ - ; source: test_uword_splitw_equalities.p8:1096 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_uword_splitw_equalities.p8:1098 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_uword_splitw_equalities.p8:1100 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1102 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl3a - cpy p8v_sources_msb+1 - bne p8l_lbl3a - ; source: test_uword_splitw_equalities.p8:1104 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:1105 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1106 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:1108 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1109 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1111 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:1112 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1113 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:1115 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_129_afterif -+ - ; source: test_uword_splitw_equalities.p8:1116 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_uword_splitw_equalities.p8:1119 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_131_else -+ - ; source: test_uword_splitw_equalities.p8:1120 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_uword_splitw_equalities.p8:1122 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_uword_splitw_equalities.p8:1124 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1125 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1127 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4a - cpy p8v_sources_msb+1 - bne p8l_lbl4a - ; source: test_uword_splitw_equalities.p8:1129 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:1130 lbl4a: fail_uword(85,1) -p8l_lbl4a - lda #<$55 - ldy #>$55 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1131 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:1133 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1134 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1136 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:1137 lbl4b: fail_uword(86,1) -p8l_lbl4b - lda #<$56 - ldy #>$56 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1138 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:1140 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_132_afterif -+ - ; source: test_uword_splitw_equalities.p8:1141 fail_uword(87,1) - lda #<$57 - ldy #>$57 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_132_afterif - ; source: test_uword_splitw_equalities.p8:1144 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_134_else -+ - ; source: test_uword_splitw_equalities.p8:1145 fail_uword(88,1) - lda #<$58 - ldy #>$58 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_133_afterif -label_asm_134_else - ; source: test_uword_splitw_equalities.p8:1147 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_uword_splitw_equalities.p8:1149 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1151 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl5a - cpy p8v_sources_msb+1 - bne p8l_lbl5a - ; source: test_uword_splitw_equalities.p8:1153 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:1154 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1155 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:1157 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1158 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1160 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:1161 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1162 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:1164 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_135_afterif -+ - ; source: test_uword_splitw_equalities.p8:1165 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_uword_splitw_equalities.p8:1168 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_137_else -+ - ; source: test_uword_splitw_equalities.p8:1169 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_uword_splitw_equalities.p8:1171 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_uword_splitw_equalities.p8:1173 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1175 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl6a - cpy p8v_sources_msb+1 - bne p8l_lbl6a - ; source: test_uword_splitw_equalities.p8:1177 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:1178 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1179 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:1181 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1182 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1184 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:1185 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1186 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:1188 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_138_afterif -+ - ; source: test_uword_splitw_equalities.p8:1189 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_uword_splitw_equalities.p8:1192 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_140_else -+ - ; source: test_uword_splitw_equalities.p8:1193 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_uword_splitw_equalities.p8:1195 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_uword_splitw_equalities.p8:1197 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1198 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1200 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7a - cpy p8v_sources_msb+1 - bne p8l_lbl7a - ; source: test_uword_splitw_equalities.p8:1202 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:1203 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1204 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:1206 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1207 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1209 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:1210 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1211 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:1213 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_141_afterif -+ - ; source: test_uword_splitw_equalities.p8:1214 success++ - inc p8b_main.p8v_success -label_asm_141_afterif - ; source: test_uword_splitw_equalities.p8:1217 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_143_else -+ - ; source: test_uword_splitw_equalities.p8:1218 success++ - inc p8b_main.p8v_success - bra label_asm_142_afterif -label_asm_143_else - ; source: test_uword_splitw_equalities.p8:1220 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_uword_splitw_equalities.p8:1222 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1224 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl8a - cpy p8v_sources_msb+1 - bne p8l_lbl8a - ; source: test_uword_splitw_equalities.p8:1226 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:1227 lbl8a: fail_uword(89,30464) -p8l_lbl8a - lda #<$59 - ldy #>$59 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1228 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:1230 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1231 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1233 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:1234 lbl8b: fail_uword(90,30464) -p8l_lbl8b - lda #<$5a - ldy #>$5a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1235 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:1237 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_144_afterif -+ - ; source: test_uword_splitw_equalities.p8:1238 fail_uword(91,30464) - lda #<$5b - ldy #>$5b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_144_afterif - ; source: test_uword_splitw_equalities.p8:1241 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_146_else -+ - ; source: test_uword_splitw_equalities.p8:1242 fail_uword(92,30464) - lda #<$5c - ldy #>$5c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_145_afterif -label_asm_146_else - ; source: test_uword_splitw_equalities.p8:1244 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_uword_splitw_equalities.p8:1246 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1248 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl9a - cpy p8v_sources_msb+1 - bne p8l_lbl9a - ; source: test_uword_splitw_equalities.p8:1250 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:1251 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1252 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:1254 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1255 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1257 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:1258 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1259 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:1261 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_147_afterif -+ - ; source: test_uword_splitw_equalities.p8:1262 success++ - inc p8b_main.p8v_success -label_asm_147_afterif - ; source: test_uword_splitw_equalities.p8:1265 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_149_else -+ - ; source: test_uword_splitw_equalities.p8:1266 success++ - inc p8b_main.p8v_success - bra label_asm_148_afterif -label_asm_149_else - ; source: test_uword_splitw_equalities.p8:1268 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_uword_splitw_equalities.p8:1270 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1271 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1273 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10a - cpy p8v_sources_msb+1 - bne p8l_lbl10a - ; source: test_uword_splitw_equalities.p8:1275 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:1276 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1277 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:1279 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1280 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1282 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:1283 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1284 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:1286 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_150_afterif -+ - ; source: test_uword_splitw_equalities.p8:1287 success++ - inc p8b_main.p8v_success -label_asm_150_afterif - ; source: test_uword_splitw_equalities.p8:1290 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_152_else -+ - ; source: test_uword_splitw_equalities.p8:1291 success++ - inc p8b_main.p8v_success - bra label_asm_151_afterif -label_asm_152_else - ; source: test_uword_splitw_equalities.p8:1293 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_uword_splitw_equalities.p8:1295 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1297 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl11a - cpy p8v_sources_msb+1 - bne p8l_lbl11a - ; source: test_uword_splitw_equalities.p8:1299 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1300 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1301 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1303 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1304 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1306 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1307 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1308 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1310 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_153_afterif -+ - ; source: test_uword_splitw_equalities.p8:1311 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_uword_splitw_equalities.p8:1314 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_155_else -+ - ; source: test_uword_splitw_equalities.p8:1315 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_uword_splitw_equalities.p8:1317 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_uword_splitw_equalities.p8:1319 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1321 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl12a - cpy p8v_sources_msb+1 - bne p8l_lbl12a - ; source: test_uword_splitw_equalities.p8:1323 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1324 lbl12a: fail_uword(93,65535) -p8l_lbl12a - lda #<$5d - ldy #>$5d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1325 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1327 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1328 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1330 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1331 lbl12b: fail_uword(94,65535) -p8l_lbl12b - lda #<$5e - ldy #>$5e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1332 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1334 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_156_afterif -+ - ; source: test_uword_splitw_equalities.p8:1335 fail_uword(95,65535) - lda #<$5f - ldy #>$5f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_156_afterif - ; source: test_uword_splitw_equalities.p8:1338 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_158_else -+ - ; source: test_uword_splitw_equalities.p8:1339 fail_uword(96,65535) - lda #<$60 - ldy #>$60 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_157_afterif -label_asm_158_else - ; source: test_uword_splitw_equalities.p8:1341 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_uword_splitw_equalities.p8:1343 verify_success(36) - lda #$24 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:1047 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $22b8, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend - ; source: test_uword_splitw_equalities.p8:1345 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_uword_splitw_equalities.p8:1346 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:1347 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_splitw_equalities.p8:1348 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_splitw_equalities.p8:1349 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1350 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1352 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl1a -+ - ; source: test_uword_splitw_equalities.p8:1354 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1355 lbl1a: fail_uword(97,0) -p8l_lbl1a - lda #<$61 - ldy #>$61 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1356 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1358 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1359 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1361 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1362 lbl1b: fail_uword(98,0) -p8l_lbl1b - lda #<$62 - ldy #>$62 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1363 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1365 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_159_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_159_afterif - ; source: test_uword_splitw_equalities.p8:1366 fail_uword(99,0) - lda #<$63 - ldy #>$63 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_159_afterif - ; source: test_uword_splitw_equalities.p8:1369 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_161_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_161_else - ; source: test_uword_splitw_equalities.p8:1370 fail_uword(100,0) - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_160_afterif -label_asm_161_else - ; source: test_uword_splitw_equalities.p8:1372 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_uword_splitw_equalities.p8:1375 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl2a -+ - ; source: test_uword_splitw_equalities.p8:1377 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1378 lbl2a: fail_uword(101,0) -p8l_lbl2a - lda #<$65 - ldy #>$65 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1379 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1381 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1382 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1384 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1385 lbl2b: fail_uword(102,0) -p8l_lbl2b - lda #<$66 - ldy #>$66 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1386 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1388 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_162_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_162_afterif - ; source: test_uword_splitw_equalities.p8:1389 fail_uword(103,0) - lda #<$67 - ldy #>$67 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_162_afterif - ; source: test_uword_splitw_equalities.p8:1392 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_164_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_164_else - ; source: test_uword_splitw_equalities.p8:1393 fail_uword(104,0) - lda #<$68 - ldy #>$68 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_163_afterif -label_asm_164_else - ; source: test_uword_splitw_equalities.p8:1395 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_uword_splitw_equalities.p8:1398 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl3a -+ - ; source: test_uword_splitw_equalities.p8:1400 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:1401 lbl3a: fail_uword(105,0) -p8l_lbl3a - lda #<$69 - ldy #>$69 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1402 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:1404 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1405 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1407 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:1408 lbl3b: fail_uword(106,0) -p8l_lbl3b - lda #<$6a - ldy #>$6a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1409 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:1411 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_165_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_165_afterif - ; source: test_uword_splitw_equalities.p8:1412 fail_uword(107,0) - lda #<$6b - ldy #>$6b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_165_afterif - ; source: test_uword_splitw_equalities.p8:1415 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_167_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_167_else - ; source: test_uword_splitw_equalities.p8:1416 fail_uword(108,0) - lda #<$6c - ldy #>$6c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_166_afterif -label_asm_167_else - ; source: test_uword_splitw_equalities.p8:1418 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_uword_splitw_equalities.p8:1420 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1422 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl4a -+ - ; source: test_uword_splitw_equalities.p8:1424 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:1425 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1426 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:1428 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1429 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1431 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:1432 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1433 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:1435 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_168_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_168_afterif - ; source: test_uword_splitw_equalities.p8:1436 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_uword_splitw_equalities.p8:1439 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_170_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_170_else - ; source: test_uword_splitw_equalities.p8:1440 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_uword_splitw_equalities.p8:1442 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_uword_splitw_equalities.p8:1445 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl5a -+ - ; source: test_uword_splitw_equalities.p8:1447 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:1448 lbl5a: fail_uword(109,1) -p8l_lbl5a - lda #<$6d - ldy #>$6d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1449 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:1451 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1452 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1454 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:1455 lbl5b: fail_uword(110,1) -p8l_lbl5b - lda #<$6e - ldy #>$6e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1456 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:1458 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_171_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_171_afterif - ; source: test_uword_splitw_equalities.p8:1459 fail_uword(111,1) - lda #<$6f - ldy #>$6f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_171_afterif - ; source: test_uword_splitw_equalities.p8:1462 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_173_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_173_else - ; source: test_uword_splitw_equalities.p8:1463 fail_uword(112,1) - lda #<$70 - ldy #>$70 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_172_afterif -label_asm_173_else - ; source: test_uword_splitw_equalities.p8:1465 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_uword_splitw_equalities.p8:1468 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl6a -+ - ; source: test_uword_splitw_equalities.p8:1470 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:1471 lbl6a: fail_uword(113,1) -p8l_lbl6a - lda #<$71 - ldy #>$71 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1472 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:1474 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1475 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1477 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:1478 lbl6b: fail_uword(114,1) -p8l_lbl6b - lda #<$72 - ldy #>$72 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1479 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:1481 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_174_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_174_afterif - ; source: test_uword_splitw_equalities.p8:1482 fail_uword(115,1) - lda #<$73 - ldy #>$73 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_174_afterif - ; source: test_uword_splitw_equalities.p8:1485 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_176_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_176_else - ; source: test_uword_splitw_equalities.p8:1486 fail_uword(116,1) - lda #<$74 - ldy #>$74 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_175_afterif -label_asm_176_else - ; source: test_uword_splitw_equalities.p8:1488 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_uword_splitw_equalities.p8:1490 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1492 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl7a -+ - ; source: test_uword_splitw_equalities.p8:1494 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:1495 lbl7a: fail_uword(117,30464) -p8l_lbl7a - lda #<$75 - ldy #>$75 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1496 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:1498 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1499 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1501 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:1502 lbl7b: fail_uword(118,30464) -p8l_lbl7b - lda #<$76 - ldy #>$76 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1503 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:1505 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_177_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_177_afterif - ; source: test_uword_splitw_equalities.p8:1506 fail_uword(119,30464) - lda #<$77 - ldy #>$77 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_177_afterif - ; source: test_uword_splitw_equalities.p8:1509 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_179_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_179_else - ; source: test_uword_splitw_equalities.p8:1510 fail_uword(120,30464) - lda #<$78 - ldy #>$78 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_178_afterif -label_asm_179_else - ; source: test_uword_splitw_equalities.p8:1512 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_uword_splitw_equalities.p8:1515 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl8a -+ - ; source: test_uword_splitw_equalities.p8:1517 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:1518 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1519 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:1521 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1522 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1524 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:1525 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1526 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:1528 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_180_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_180_afterif - ; source: test_uword_splitw_equalities.p8:1529 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_uword_splitw_equalities.p8:1532 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_182_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_182_else - ; source: test_uword_splitw_equalities.p8:1533 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_uword_splitw_equalities.p8:1535 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_uword_splitw_equalities.p8:1538 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl9a -+ - ; source: test_uword_splitw_equalities.p8:1540 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:1541 lbl9a: fail_uword(121,30464) -p8l_lbl9a - lda #<$79 - ldy #>$79 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1542 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:1544 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1545 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1547 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:1548 lbl9b: fail_uword(122,30464) -p8l_lbl9b - lda #<$7a - ldy #>$7a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1549 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:1551 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_183_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_183_afterif - ; source: test_uword_splitw_equalities.p8:1552 fail_uword(123,30464) - lda #<$7b - ldy #>$7b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_183_afterif - ; source: test_uword_splitw_equalities.p8:1555 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_185_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_185_else - ; source: test_uword_splitw_equalities.p8:1556 fail_uword(124,30464) - lda #<$7c - ldy #>$7c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_184_afterif -label_asm_185_else - ; source: test_uword_splitw_equalities.p8:1558 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_uword_splitw_equalities.p8:1560 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1562 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl10a -+ - ; source: test_uword_splitw_equalities.p8:1564 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:1565 lbl10a: fail_uword(125,65535) -p8l_lbl10a - lda #<$7d - ldy #>$7d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1566 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:1568 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1569 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1571 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:1572 lbl10b: fail_uword(126,65535) -p8l_lbl10b - lda #<$7e - ldy #>$7e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1573 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:1575 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_186_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_186_afterif - ; source: test_uword_splitw_equalities.p8:1576 fail_uword(127,65535) - lda #<$7f - ldy #>$7f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_186_afterif - ; source: test_uword_splitw_equalities.p8:1579 if sources[1]==cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_188_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_188_else - ; source: test_uword_splitw_equalities.p8:1580 fail_uword(128,65535) - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_187_afterif -label_asm_188_else - ; source: test_uword_splitw_equalities.p8:1582 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_uword_splitw_equalities.p8:1585 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl11a -+ - ; source: test_uword_splitw_equalities.p8:1587 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1588 lbl11a: fail_uword(129,65535) -p8l_lbl11a - lda #<$81 - ldy #>$81 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1589 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1591 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1592 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1594 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1595 lbl11b: fail_uword(130,65535) -p8l_lbl11b - lda #<$82 - ldy #>$82 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1596 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1598 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_189_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_189_afterif - ; source: test_uword_splitw_equalities.p8:1599 fail_uword(131,65535) - lda #<$83 - ldy #>$83 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_189_afterif - ; source: test_uword_splitw_equalities.p8:1602 if sources[1]==cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_191_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_191_else - ; source: test_uword_splitw_equalities.p8:1603 fail_uword(132,65535) - lda #<$84 - ldy #>$84 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_190_afterif -label_asm_191_else - ; source: test_uword_splitw_equalities.p8:1605 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_uword_splitw_equalities.p8:1608 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl12a -+ - ; source: test_uword_splitw_equalities.p8:1610 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1611 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1612 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1614 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1615 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1617 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1618 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1619 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1621 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_192_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_192_afterif - ; source: test_uword_splitw_equalities.p8:1622 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_uword_splitw_equalities.p8:1625 if sources[1]==cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_194_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_194_else - ; source: test_uword_splitw_equalities.p8:1626 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_uword_splitw_equalities.p8:1628 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_uword_splitw_equalities.p8:1630 verify_success(12) - lda #12 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:1345 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_uword_splitw_equalities.p8:1632 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_uword_splitw_equalities.p8:1633 uword[] @split sources = [9999, 9999] - ; source: test_uword_splitw_equalities.p8:1634 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_uword_splitw_equalities.p8:1635 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_uword_splitw_equalities.p8:1636 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1637 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1639 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl1a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl1a - ; source: test_uword_splitw_equalities.p8:1641 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1642 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1643 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1645 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1646 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1648 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1649 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1650 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1652 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_195_afterif -+ - ; source: test_uword_splitw_equalities.p8:1653 success++ - inc p8b_main.p8v_success -label_asm_195_afterif - ; source: test_uword_splitw_equalities.p8:1656 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_197_else -+ - ; source: test_uword_splitw_equalities.p8:1657 success++ - inc p8b_main.p8v_success - bra label_asm_196_afterif -label_asm_197_else - ; source: test_uword_splitw_equalities.p8:1659 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_uword_splitw_equalities.p8:1662 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl2a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl2a - ; source: test_uword_splitw_equalities.p8:1664 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1665 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1666 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1668 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1669 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1671 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1672 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1673 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1675 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_198_afterif -+ - ; source: test_uword_splitw_equalities.p8:1676 success++ - inc p8b_main.p8v_success -label_asm_198_afterif - ; source: test_uword_splitw_equalities.p8:1679 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_200_else -+ - ; source: test_uword_splitw_equalities.p8:1680 success++ - inc p8b_main.p8v_success - bra label_asm_199_afterif -label_asm_200_else - ; source: test_uword_splitw_equalities.p8:1682 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_uword_splitw_equalities.p8:1685 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl3a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl3a - ; source: test_uword_splitw_equalities.p8:1687 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:1688 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1689 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:1691 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1692 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1694 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:1695 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1696 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:1698 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_201_afterif -+ - ; source: test_uword_splitw_equalities.p8:1699 success++ - inc p8b_main.p8v_success -label_asm_201_afterif - ; source: test_uword_splitw_equalities.p8:1702 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_203_else -+ - ; source: test_uword_splitw_equalities.p8:1703 success++ - inc p8b_main.p8v_success - bra label_asm_202_afterif -label_asm_203_else - ; source: test_uword_splitw_equalities.p8:1705 cx16.r0L++ - inc cx16.r0L -label_asm_202_afterif - ; source: test_uword_splitw_equalities.p8:1707 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1709 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl4a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl4a - ; source: test_uword_splitw_equalities.p8:1711 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:1712 lbl4a: fail_uword(133,1) -p8l_lbl4a - lda #<$85 - ldy #>$85 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1713 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:1715 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1716 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1718 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:1719 lbl4b: fail_uword(134,1) -p8l_lbl4b - lda #<$86 - ldy #>$86 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1720 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:1722 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_204_afterif -+ - ; source: test_uword_splitw_equalities.p8:1723 fail_uword(135,1) - lda #<$87 - ldy #>$87 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_204_afterif - ; source: test_uword_splitw_equalities.p8:1726 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_206_else -+ - ; source: test_uword_splitw_equalities.p8:1727 fail_uword(136,1) - lda #<$88 - ldy #>$88 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_205_afterif -label_asm_206_else - ; source: test_uword_splitw_equalities.p8:1729 cx16.r0L++ - inc cx16.r0L -label_asm_205_afterif - ; source: test_uword_splitw_equalities.p8:1732 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl5a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl5a - ; source: test_uword_splitw_equalities.p8:1734 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:1735 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1736 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:1738 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1739 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1741 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:1742 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1743 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:1745 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_207_afterif -+ - ; source: test_uword_splitw_equalities.p8:1746 success++ - inc p8b_main.p8v_success -label_asm_207_afterif - ; source: test_uword_splitw_equalities.p8:1749 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_209_else -+ - ; source: test_uword_splitw_equalities.p8:1750 success++ - inc p8b_main.p8v_success - bra label_asm_208_afterif -label_asm_209_else - ; source: test_uword_splitw_equalities.p8:1752 cx16.r0L++ - inc cx16.r0L -label_asm_208_afterif - ; source: test_uword_splitw_equalities.p8:1755 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl6a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl6a - ; source: test_uword_splitw_equalities.p8:1757 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:1758 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1759 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:1761 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1762 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1764 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:1765 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1766 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:1768 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_210_afterif -+ - ; source: test_uword_splitw_equalities.p8:1769 success++ - inc p8b_main.p8v_success -label_asm_210_afterif - ; source: test_uword_splitw_equalities.p8:1772 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_212_else -+ - ; source: test_uword_splitw_equalities.p8:1773 success++ - inc p8b_main.p8v_success - bra label_asm_211_afterif -label_asm_212_else - ; source: test_uword_splitw_equalities.p8:1775 cx16.r0L++ - inc cx16.r0L -label_asm_211_afterif - ; source: test_uword_splitw_equalities.p8:1777 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1779 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl7a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl7a - ; source: test_uword_splitw_equalities.p8:1781 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:1782 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1783 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:1785 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1786 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1788 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:1789 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1790 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:1792 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_213_afterif -+ - ; source: test_uword_splitw_equalities.p8:1793 success++ - inc p8b_main.p8v_success -label_asm_213_afterif - ; source: test_uword_splitw_equalities.p8:1796 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_215_else -+ - ; source: test_uword_splitw_equalities.p8:1797 success++ - inc p8b_main.p8v_success - bra label_asm_214_afterif -label_asm_215_else - ; source: test_uword_splitw_equalities.p8:1799 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_uword_splitw_equalities.p8:1802 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl8a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl8a - ; source: test_uword_splitw_equalities.p8:1804 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:1805 lbl8a: fail_uword(137,30464) -p8l_lbl8a - lda #<$89 - ldy #>$89 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1806 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:1808 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1809 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1811 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:1812 lbl8b: fail_uword(138,30464) -p8l_lbl8b - lda #<$8a - ldy #>$8a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1813 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:1815 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_216_afterif -+ - ; source: test_uword_splitw_equalities.p8:1816 fail_uword(139,30464) - lda #<$8b - ldy #>$8b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_216_afterif - ; source: test_uword_splitw_equalities.p8:1819 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_218_else -+ - ; source: test_uword_splitw_equalities.p8:1820 fail_uword(140,30464) - lda #<$8c - ldy #>$8c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_217_afterif -label_asm_218_else - ; source: test_uword_splitw_equalities.p8:1822 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_uword_splitw_equalities.p8:1825 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl9a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl9a - ; source: test_uword_splitw_equalities.p8:1827 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:1828 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1829 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:1831 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1832 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1834 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:1835 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1836 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:1838 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_219_afterif -+ - ; source: test_uword_splitw_equalities.p8:1839 success++ - inc p8b_main.p8v_success -label_asm_219_afterif - ; source: test_uword_splitw_equalities.p8:1842 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_221_else -+ - ; source: test_uword_splitw_equalities.p8:1843 success++ - inc p8b_main.p8v_success - bra label_asm_220_afterif -label_asm_221_else - ; source: test_uword_splitw_equalities.p8:1845 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_uword_splitw_equalities.p8:1847 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1849 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl10a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl10a - ; source: test_uword_splitw_equalities.p8:1851 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:1852 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1853 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:1855 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1856 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1858 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:1859 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1860 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:1862 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_222_afterif -+ - ; source: test_uword_splitw_equalities.p8:1863 success++ - inc p8b_main.p8v_success -label_asm_222_afterif - ; source: test_uword_splitw_equalities.p8:1866 if sources[1]!=cx16.r4+1-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_224_else -+ - ; source: test_uword_splitw_equalities.p8:1867 success++ - inc p8b_main.p8v_success - bra label_asm_223_afterif -label_asm_224_else - ; source: test_uword_splitw_equalities.p8:1869 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_uword_splitw_equalities.p8:1872 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl11a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl11a - ; source: test_uword_splitw_equalities.p8:1874 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1875 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1876 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:1878 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1879 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1881 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1882 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1883 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:1885 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_225_afterif -+ - ; source: test_uword_splitw_equalities.p8:1886 success++ - inc p8b_main.p8v_success -label_asm_225_afterif - ; source: test_uword_splitw_equalities.p8:1889 if sources[1]!=cx16.r4+30464-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_227_else -+ - ; source: test_uword_splitw_equalities.p8:1890 success++ - inc p8b_main.p8v_success - bra label_asm_226_afterif -label_asm_227_else - ; source: test_uword_splitw_equalities.p8:1892 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_uword_splitw_equalities.p8:1895 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl12a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl12a - ; source: test_uword_splitw_equalities.p8:1897 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1898 lbl12a: fail_uword(141,65535) -p8l_lbl12a - lda #<$8d - ldy #>$8d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1899 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:1901 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1902 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1904 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1905 lbl12b: fail_uword(142,65535) -p8l_lbl12b - lda #<$8e - ldy #>$8e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1906 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:1908 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_228_afterif -+ - ; source: test_uword_splitw_equalities.p8:1909 fail_uword(143,65535) - lda #<$8f - ldy #>$8f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_228_afterif - ; source: test_uword_splitw_equalities.p8:1912 if sources[1]!=cx16.r4+65535-cx16.r5 - lda cx16.r4 - ldy cx16.r4+1 - clc - adc #<$ffff - tax - tya - adc #>$ffff - tay - txa - sec - sbc cx16.r5 - tax - tya - sbc cx16.r5+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_230_else -+ - ; source: test_uword_splitw_equalities.p8:1913 fail_uword(144,65535) - lda #<$90 - ldy #>$90 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_229_afterif -label_asm_230_else - ; source: test_uword_splitw_equalities.p8:1915 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_uword_splitw_equalities.p8:1917 verify_success(36) - lda #$24 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:1632 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_uword_splitw_equalities.p8:1919 sub test_is_array_splitw() { - -p8s_test_is_array_splitw .proc -; statements - ; source: test_uword_splitw_equalities.p8:1921 uword[] @split values = [9999, 8888] - ; source: test_uword_splitw_equalities.p8:1922 uword[] @split sources = [9999, 8888] - ; source: test_uword_splitw_equalities.p8:1923 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:1924 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1925 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:1926 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1928 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1a -+ - ; source: test_uword_splitw_equalities.p8:1930 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1931 lbl1a: fail_uword(145,0) -p8l_lbl1a - lda #<$91 - ldy #>$91 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1932 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:1934 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1935 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1937 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1938 lbl1b: fail_uword(146,0) -p8l_lbl1b - lda #<$92 - ldy #>$92 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1939 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:1941 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_231_afterif - cpy p8v_sources_msb+1 - bne label_asm_231_afterif - ; source: test_uword_splitw_equalities.p8:1942 fail_uword(147,0) - lda #<$93 - ldy #>$93 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_231_afterif - ; source: test_uword_splitw_equalities.p8:1945 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_233_else - cpy p8v_sources_msb+1 - bne label_asm_233_else - ; source: test_uword_splitw_equalities.p8:1946 fail_uword(148,0) - lda #<$94 - ldy #>$94 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_232_afterif -label_asm_233_else - ; source: test_uword_splitw_equalities.p8:1948 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_uword_splitw_equalities.p8:1951 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1c -+ - ; source: test_uword_splitw_equalities.p8:1953 goto skip1c - bra p8l_skip1c - ; source: test_uword_splitw_equalities.p8:1954 lbl1c: fail_uword(149,0) -p8l_lbl1c - lda #<$95 - ldy #>$95 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1955 skip1c: -p8l_skip1c - ; source: test_uword_splitw_equalities.p8:1957 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1958 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1960 goto skip1d - bra p8l_skip1d - ; source: test_uword_splitw_equalities.p8:1961 lbl1d: fail_uword(150,0) -p8l_lbl1d - lda #<$96 - ldy #>$96 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1962 skip1d: -p8l_skip1d - ; source: test_uword_splitw_equalities.p8:1964 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_234_afterif - cpy p8v_sources_msb+1 - bne label_asm_234_afterif - ; source: test_uword_splitw_equalities.p8:1965 fail_uword(151,0) - lda #<$97 - ldy #>$97 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_234_afterif - ; source: test_uword_splitw_equalities.p8:1968 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_236_else - cpy p8v_sources_msb+1 - bne label_asm_236_else - ; source: test_uword_splitw_equalities.p8:1969 fail_uword(152,0) - lda #<$98 - ldy #>$98 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_235_afterif -label_asm_236_else - ; source: test_uword_splitw_equalities.p8:1971 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_uword_splitw_equalities.p8:1973 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:1975 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2a -+ - ; source: test_uword_splitw_equalities.p8:1977 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1978 lbl2a: fail_uword(153,0) -p8l_lbl2a - lda #<$99 - ldy #>$99 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1979 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:1981 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:1982 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:1984 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1985 lbl2b: fail_uword(154,0) -p8l_lbl2b - lda #<$9a - ldy #>$9a - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:1986 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:1988 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_237_afterif - cpy p8v_sources_msb+1 - bne label_asm_237_afterif - ; source: test_uword_splitw_equalities.p8:1989 fail_uword(155,0) - lda #<$9b - ldy #>$9b - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_237_afterif - ; source: test_uword_splitw_equalities.p8:1992 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_239_else - cpy p8v_sources_msb+1 - bne label_asm_239_else - ; source: test_uword_splitw_equalities.p8:1993 fail_uword(156,0) - lda #<$9c - ldy #>$9c - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_238_afterif -label_asm_239_else - ; source: test_uword_splitw_equalities.p8:1995 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_uword_splitw_equalities.p8:1998 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2c -+ - ; source: test_uword_splitw_equalities.p8:2000 goto skip2c - bra p8l_skip2c - ; source: test_uword_splitw_equalities.p8:2001 lbl2c: fail_uword(157,0) -p8l_lbl2c - lda #<$9d - ldy #>$9d - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2002 skip2c: -p8l_skip2c - ; source: test_uword_splitw_equalities.p8:2004 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2005 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2007 goto skip2d - bra p8l_skip2d - ; source: test_uword_splitw_equalities.p8:2008 lbl2d: fail_uword(158,0) -p8l_lbl2d - lda #<$9e - ldy #>$9e - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2009 skip2d: -p8l_skip2d - ; source: test_uword_splitw_equalities.p8:2011 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_240_afterif - cpy p8v_sources_msb+1 - bne label_asm_240_afterif - ; source: test_uword_splitw_equalities.p8:2012 fail_uword(159,0) - lda #<$9f - ldy #>$9f - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_240_afterif - ; source: test_uword_splitw_equalities.p8:2015 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_242_else - cpy p8v_sources_msb+1 - bne label_asm_242_else - ; source: test_uword_splitw_equalities.p8:2016 fail_uword(160,0) - lda #<$a0 - ldy #>$a0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_241_afterif -label_asm_242_else - ; source: test_uword_splitw_equalities.p8:2018 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_uword_splitw_equalities.p8:2020 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2022 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3a -+ - ; source: test_uword_splitw_equalities.p8:2024 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:2025 lbl3a: fail_uword(161,0) -p8l_lbl3a - lda #<$a1 - ldy #>$a1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2026 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:2028 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2029 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2031 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:2032 lbl3b: fail_uword(162,0) -p8l_lbl3b - lda #<$a2 - ldy #>$a2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2033 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:2035 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_243_afterif - cpy p8v_sources_msb+1 - bne label_asm_243_afterif - ; source: test_uword_splitw_equalities.p8:2036 fail_uword(163,0) - lda #<$a3 - ldy #>$a3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_243_afterif - ; source: test_uword_splitw_equalities.p8:2039 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_245_else - cpy p8v_sources_msb+1 - bne label_asm_245_else - ; source: test_uword_splitw_equalities.p8:2040 fail_uword(164,0) - lda #<$a4 - ldy #>$a4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_244_afterif -label_asm_245_else - ; source: test_uword_splitw_equalities.p8:2042 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_uword_splitw_equalities.p8:2045 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3c -+ - ; source: test_uword_splitw_equalities.p8:2047 goto skip3c - bra p8l_skip3c - ; source: test_uword_splitw_equalities.p8:2048 lbl3c: fail_uword(165,0) -p8l_lbl3c - lda #<$a5 - ldy #>$a5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2049 skip3c: -p8l_skip3c - ; source: test_uword_splitw_equalities.p8:2051 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2052 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2054 goto skip3d - bra p8l_skip3d - ; source: test_uword_splitw_equalities.p8:2055 lbl3d: fail_uword(166,0) -p8l_lbl3d - lda #<$a6 - ldy #>$a6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2056 skip3d: -p8l_skip3d - ; source: test_uword_splitw_equalities.p8:2058 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_246_afterif - cpy p8v_sources_msb+1 - bne label_asm_246_afterif - ; source: test_uword_splitw_equalities.p8:2059 fail_uword(167,0) - lda #<$a7 - ldy #>$a7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword -label_asm_246_afterif - ; source: test_uword_splitw_equalities.p8:2062 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_248_else - cpy p8v_sources_msb+1 - bne label_asm_248_else - ; source: test_uword_splitw_equalities.p8:2063 fail_uword(168,0) - lda #<$a8 - ldy #>$a8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - stz p8b_main.p8s_fail_uword.p8v_v1 - stz p8b_main.p8s_fail_uword.p8v_v1+1 - jsr p8b_main.p8s_fail_uword - bra label_asm_247_afterif -label_asm_248_else - ; source: test_uword_splitw_equalities.p8:2065 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_uword_splitw_equalities.p8:2067 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2068 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2069 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2071 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4a -+ - ; source: test_uword_splitw_equalities.p8:2073 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:2074 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2075 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:2077 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2078 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2080 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:2081 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2082 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:2084 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_249_afterif - cpy p8v_sources_msb+1 - bne label_asm_249_afterif - ; source: test_uword_splitw_equalities.p8:2085 success++ - inc p8b_main.p8v_success -label_asm_249_afterif - ; source: test_uword_splitw_equalities.p8:2088 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_251_else - cpy p8v_sources_msb+1 - bne label_asm_251_else - ; source: test_uword_splitw_equalities.p8:2089 success++ - inc p8b_main.p8v_success - bra label_asm_250_afterif -label_asm_251_else - ; source: test_uword_splitw_equalities.p8:2091 cx16.r0L++ - inc cx16.r0L -label_asm_250_afterif - ; source: test_uword_splitw_equalities.p8:2094 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4c -+ - ; source: test_uword_splitw_equalities.p8:2096 goto skip4c - bra p8l_skip4c - ; source: test_uword_splitw_equalities.p8:2097 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2098 skip4c: -p8l_skip4c - ; source: test_uword_splitw_equalities.p8:2100 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2101 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2103 goto skip4d - bra p8l_skip4d - ; source: test_uword_splitw_equalities.p8:2104 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2105 skip4d: -p8l_skip4d - ; source: test_uword_splitw_equalities.p8:2107 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_252_afterif - cpy p8v_sources_msb+1 - bne label_asm_252_afterif - ; source: test_uword_splitw_equalities.p8:2108 success++ - inc p8b_main.p8v_success -label_asm_252_afterif - ; source: test_uword_splitw_equalities.p8:2111 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_254_else - cpy p8v_sources_msb+1 - bne label_asm_254_else - ; source: test_uword_splitw_equalities.p8:2112 success++ - inc p8b_main.p8v_success - bra label_asm_253_afterif -label_asm_254_else - ; source: test_uword_splitw_equalities.p8:2114 cx16.r0L++ - inc cx16.r0L -label_asm_253_afterif - ; source: test_uword_splitw_equalities.p8:2116 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2118 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5a -+ - ; source: test_uword_splitw_equalities.p8:2120 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:2121 lbl5a: fail_uword(169,1) -p8l_lbl5a - lda #<$a9 - ldy #>$a9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2122 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:2124 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2125 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2127 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:2128 lbl5b: fail_uword(170,1) -p8l_lbl5b - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2129 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:2131 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_255_afterif - cpy p8v_sources_msb+1 - bne label_asm_255_afterif - ; source: test_uword_splitw_equalities.p8:2132 fail_uword(171,1) - lda #<$ab - ldy #>$ab - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_255_afterif - ; source: test_uword_splitw_equalities.p8:2135 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_257_else - cpy p8v_sources_msb+1 - bne label_asm_257_else - ; source: test_uword_splitw_equalities.p8:2136 fail_uword(172,1) - lda #<$ac - ldy #>$ac - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_256_afterif -label_asm_257_else - ; source: test_uword_splitw_equalities.p8:2138 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_uword_splitw_equalities.p8:2141 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5c -+ - ; source: test_uword_splitw_equalities.p8:2143 goto skip5c - bra p8l_skip5c - ; source: test_uword_splitw_equalities.p8:2144 lbl5c: fail_uword(173,1) -p8l_lbl5c - lda #<$ad - ldy #>$ad - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2145 skip5c: -p8l_skip5c - ; source: test_uword_splitw_equalities.p8:2147 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2148 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2150 goto skip5d - bra p8l_skip5d - ; source: test_uword_splitw_equalities.p8:2151 lbl5d: fail_uword(174,1) -p8l_lbl5d - lda #<$ae - ldy #>$ae - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2152 skip5d: -p8l_skip5d - ; source: test_uword_splitw_equalities.p8:2154 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_258_afterif - cpy p8v_sources_msb+1 - bne label_asm_258_afterif - ; source: test_uword_splitw_equalities.p8:2155 fail_uword(175,1) - lda #<$af - ldy #>$af - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_258_afterif - ; source: test_uword_splitw_equalities.p8:2158 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_260_else - cpy p8v_sources_msb+1 - bne label_asm_260_else - ; source: test_uword_splitw_equalities.p8:2159 fail_uword(176,1) - lda #<$b0 - ldy #>$b0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_259_afterif -label_asm_260_else - ; source: test_uword_splitw_equalities.p8:2161 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_uword_splitw_equalities.p8:2163 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2165 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6a -+ - ; source: test_uword_splitw_equalities.p8:2167 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:2168 lbl6a: fail_uword(177,1) -p8l_lbl6a - lda #<$b1 - ldy #>$b1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2169 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:2171 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2172 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2174 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:2175 lbl6b: fail_uword(178,1) -p8l_lbl6b - lda #<$b2 - ldy #>$b2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2176 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:2178 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_261_afterif - cpy p8v_sources_msb+1 - bne label_asm_261_afterif - ; source: test_uword_splitw_equalities.p8:2179 fail_uword(179,1) - lda #<$b3 - ldy #>$b3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_261_afterif - ; source: test_uword_splitw_equalities.p8:2182 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_263_else - cpy p8v_sources_msb+1 - bne label_asm_263_else - ; source: test_uword_splitw_equalities.p8:2183 fail_uword(180,1) - lda #<$b4 - ldy #>$b4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_262_afterif -label_asm_263_else - ; source: test_uword_splitw_equalities.p8:2185 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_uword_splitw_equalities.p8:2188 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6c -+ - ; source: test_uword_splitw_equalities.p8:2190 goto skip6c - bra p8l_skip6c - ; source: test_uword_splitw_equalities.p8:2191 lbl6c: fail_uword(181,1) -p8l_lbl6c - lda #<$b5 - ldy #>$b5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2192 skip6c: -p8l_skip6c - ; source: test_uword_splitw_equalities.p8:2194 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2195 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2197 goto skip6d - bra p8l_skip6d - ; source: test_uword_splitw_equalities.p8:2198 lbl6d: fail_uword(182,1) -p8l_lbl6d - lda #<$b6 - ldy #>$b6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2199 skip6d: -p8l_skip6d - ; source: test_uword_splitw_equalities.p8:2201 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_264_afterif - cpy p8v_sources_msb+1 - bne label_asm_264_afterif - ; source: test_uword_splitw_equalities.p8:2202 fail_uword(183,1) - lda #<$b7 - ldy #>$b7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_264_afterif - ; source: test_uword_splitw_equalities.p8:2205 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_266_else - cpy p8v_sources_msb+1 - bne label_asm_266_else - ; source: test_uword_splitw_equalities.p8:2206 fail_uword(184,1) - lda #<$b8 - ldy #>$b8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_265_afterif -label_asm_266_else - ; source: test_uword_splitw_equalities.p8:2208 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_uword_splitw_equalities.p8:2210 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2211 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2212 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2214 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7a -+ - ; source: test_uword_splitw_equalities.p8:2216 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:2217 lbl7a: fail_uword(185,30464) -p8l_lbl7a - lda #<$b9 - ldy #>$b9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2218 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:2220 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2221 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2223 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:2224 lbl7b: fail_uword(186,30464) -p8l_lbl7b - lda #<$ba - ldy #>$ba - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2225 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:2227 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_267_afterif - cpy p8v_sources_msb+1 - bne label_asm_267_afterif - ; source: test_uword_splitw_equalities.p8:2228 fail_uword(187,30464) - lda #<$bb - ldy #>$bb - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_267_afterif - ; source: test_uword_splitw_equalities.p8:2231 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_269_else - cpy p8v_sources_msb+1 - bne label_asm_269_else - ; source: test_uword_splitw_equalities.p8:2232 fail_uword(188,30464) - lda #<$bc - ldy #>$bc - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_268_afterif -label_asm_269_else - ; source: test_uword_splitw_equalities.p8:2234 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_uword_splitw_equalities.p8:2237 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7c -+ - ; source: test_uword_splitw_equalities.p8:2239 goto skip7c - bra p8l_skip7c - ; source: test_uword_splitw_equalities.p8:2240 lbl7c: fail_uword(189,30464) -p8l_lbl7c - lda #<$bd - ldy #>$bd - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2241 skip7c: -p8l_skip7c - ; source: test_uword_splitw_equalities.p8:2243 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2244 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2246 goto skip7d - bra p8l_skip7d - ; source: test_uword_splitw_equalities.p8:2247 lbl7d: fail_uword(190,30464) -p8l_lbl7d - lda #<$be - ldy #>$be - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2248 skip7d: -p8l_skip7d - ; source: test_uword_splitw_equalities.p8:2250 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_270_afterif - cpy p8v_sources_msb+1 - bne label_asm_270_afterif - ; source: test_uword_splitw_equalities.p8:2251 fail_uword(191,30464) - lda #<$bf - ldy #>$bf - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_270_afterif - ; source: test_uword_splitw_equalities.p8:2254 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_272_else - cpy p8v_sources_msb+1 - bne label_asm_272_else - ; source: test_uword_splitw_equalities.p8:2255 fail_uword(192,30464) - lda #<$c0 - ldy #>$c0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_271_afterif -label_asm_272_else - ; source: test_uword_splitw_equalities.p8:2257 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_uword_splitw_equalities.p8:2259 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2261 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8a -+ - ; source: test_uword_splitw_equalities.p8:2263 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:2264 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2265 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:2267 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2268 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2270 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:2271 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2272 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:2274 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_273_afterif - cpy p8v_sources_msb+1 - bne label_asm_273_afterif - ; source: test_uword_splitw_equalities.p8:2275 success++ - inc p8b_main.p8v_success -label_asm_273_afterif - ; source: test_uword_splitw_equalities.p8:2278 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_275_else - cpy p8v_sources_msb+1 - bne label_asm_275_else - ; source: test_uword_splitw_equalities.p8:2279 success++ - inc p8b_main.p8v_success - bra label_asm_274_afterif -label_asm_275_else - ; source: test_uword_splitw_equalities.p8:2281 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_uword_splitw_equalities.p8:2284 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8c -+ - ; source: test_uword_splitw_equalities.p8:2286 goto skip8c - bra p8l_skip8c - ; source: test_uword_splitw_equalities.p8:2287 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2288 skip8c: -p8l_skip8c - ; source: test_uword_splitw_equalities.p8:2290 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2291 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2293 goto skip8d - bra p8l_skip8d - ; source: test_uword_splitw_equalities.p8:2294 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2295 skip8d: -p8l_skip8d - ; source: test_uword_splitw_equalities.p8:2297 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_276_afterif - cpy p8v_sources_msb+1 - bne label_asm_276_afterif - ; source: test_uword_splitw_equalities.p8:2298 success++ - inc p8b_main.p8v_success -label_asm_276_afterif - ; source: test_uword_splitw_equalities.p8:2301 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_278_else - cpy p8v_sources_msb+1 - bne label_asm_278_else - ; source: test_uword_splitw_equalities.p8:2302 success++ - inc p8b_main.p8v_success - bra label_asm_277_afterif -label_asm_278_else - ; source: test_uword_splitw_equalities.p8:2304 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_uword_splitw_equalities.p8:2306 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2308 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9a -+ - ; source: test_uword_splitw_equalities.p8:2310 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:2311 lbl9a: fail_uword(193,30464) -p8l_lbl9a - lda #<$c1 - ldy #>$c1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2312 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:2314 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2315 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2317 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:2318 lbl9b: fail_uword(194,30464) -p8l_lbl9b - lda #<$c2 - ldy #>$c2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2319 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:2321 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_279_afterif - cpy p8v_sources_msb+1 - bne label_asm_279_afterif - ; source: test_uword_splitw_equalities.p8:2322 fail_uword(195,30464) - lda #<$c3 - ldy #>$c3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_279_afterif - ; source: test_uword_splitw_equalities.p8:2325 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_281_else - cpy p8v_sources_msb+1 - bne label_asm_281_else - ; source: test_uword_splitw_equalities.p8:2326 fail_uword(196,30464) - lda #<$c4 - ldy #>$c4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_280_afterif -label_asm_281_else - ; source: test_uword_splitw_equalities.p8:2328 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_uword_splitw_equalities.p8:2331 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9c -+ - ; source: test_uword_splitw_equalities.p8:2333 goto skip9c - bra p8l_skip9c - ; source: test_uword_splitw_equalities.p8:2334 lbl9c: fail_uword(197,30464) -p8l_lbl9c - lda #<$c5 - ldy #>$c5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2335 skip9c: -p8l_skip9c - ; source: test_uword_splitw_equalities.p8:2337 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2338 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2340 goto skip9d - bra p8l_skip9d - ; source: test_uword_splitw_equalities.p8:2341 lbl9d: fail_uword(198,30464) -p8l_lbl9d - lda #<$c6 - ldy #>$c6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2342 skip9d: -p8l_skip9d - ; source: test_uword_splitw_equalities.p8:2344 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_282_afterif - cpy p8v_sources_msb+1 - bne label_asm_282_afterif - ; source: test_uword_splitw_equalities.p8:2345 fail_uword(199,30464) - lda #<$c7 - ldy #>$c7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_282_afterif - ; source: test_uword_splitw_equalities.p8:2348 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_284_else - cpy p8v_sources_msb+1 - bne label_asm_284_else - ; source: test_uword_splitw_equalities.p8:2349 fail_uword(200,30464) - lda #<$c8 - ldy #>$c8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_283_afterif -label_asm_284_else - ; source: test_uword_splitw_equalities.p8:2351 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_uword_splitw_equalities.p8:2353 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2354 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2355 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2357 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10a -+ - ; source: test_uword_splitw_equalities.p8:2359 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:2360 lbl10a: fail_uword(201,65535) -p8l_lbl10a - lda #<$c9 - ldy #>$c9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2361 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:2363 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2364 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2366 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:2367 lbl10b: fail_uword(202,65535) -p8l_lbl10b - lda #<$ca - ldy #>$ca - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2368 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:2370 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_285_afterif - cpy p8v_sources_msb+1 - bne label_asm_285_afterif - ; source: test_uword_splitw_equalities.p8:2371 fail_uword(203,65535) - lda #<$cb - ldy #>$cb - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_285_afterif - ; source: test_uword_splitw_equalities.p8:2374 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_287_else - cpy p8v_sources_msb+1 - bne label_asm_287_else - ; source: test_uword_splitw_equalities.p8:2375 fail_uword(204,65535) - lda #<$cc - ldy #>$cc - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_286_afterif -label_asm_287_else - ; source: test_uword_splitw_equalities.p8:2377 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_uword_splitw_equalities.p8:2380 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10c -+ - ; source: test_uword_splitw_equalities.p8:2382 goto skip10c - bra p8l_skip10c - ; source: test_uword_splitw_equalities.p8:2383 lbl10c: fail_uword(205,65535) -p8l_lbl10c - lda #<$cd - ldy #>$cd - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2384 skip10c: -p8l_skip10c - ; source: test_uword_splitw_equalities.p8:2386 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2387 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2389 goto skip10d - bra p8l_skip10d - ; source: test_uword_splitw_equalities.p8:2390 lbl10d: fail_uword(206,65535) -p8l_lbl10d - lda #<$ce - ldy #>$ce - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2391 skip10d: -p8l_skip10d - ; source: test_uword_splitw_equalities.p8:2393 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_288_afterif - cpy p8v_sources_msb+1 - bne label_asm_288_afterif - ; source: test_uword_splitw_equalities.p8:2394 fail_uword(207,65535) - lda #<$cf - ldy #>$cf - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_288_afterif - ; source: test_uword_splitw_equalities.p8:2397 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_290_else - cpy p8v_sources_msb+1 - bne label_asm_290_else - ; source: test_uword_splitw_equalities.p8:2398 fail_uword(208,65535) - lda #<$d0 - ldy #>$d0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_289_afterif -label_asm_290_else - ; source: test_uword_splitw_equalities.p8:2400 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_uword_splitw_equalities.p8:2402 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2404 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11a -+ - ; source: test_uword_splitw_equalities.p8:2406 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:2407 lbl11a: fail_uword(209,65535) -p8l_lbl11a - lda #<$d1 - ldy #>$d1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2408 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:2410 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2411 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2413 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:2414 lbl11b: fail_uword(210,65535) -p8l_lbl11b - lda #<$d2 - ldy #>$d2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2415 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:2417 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_291_afterif - cpy p8v_sources_msb+1 - bne label_asm_291_afterif - ; source: test_uword_splitw_equalities.p8:2418 fail_uword(211,65535) - lda #<$d3 - ldy #>$d3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_291_afterif - ; source: test_uword_splitw_equalities.p8:2421 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_293_else - cpy p8v_sources_msb+1 - bne label_asm_293_else - ; source: test_uword_splitw_equalities.p8:2422 fail_uword(212,65535) - lda #<$d4 - ldy #>$d4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_292_afterif -label_asm_293_else - ; source: test_uword_splitw_equalities.p8:2424 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_uword_splitw_equalities.p8:2427 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11c -+ - ; source: test_uword_splitw_equalities.p8:2429 goto skip11c - bra p8l_skip11c - ; source: test_uword_splitw_equalities.p8:2430 lbl11c: fail_uword(213,65535) -p8l_lbl11c - lda #<$d5 - ldy #>$d5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2431 skip11c: -p8l_skip11c - ; source: test_uword_splitw_equalities.p8:2433 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2434 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2436 goto skip11d - bra p8l_skip11d - ; source: test_uword_splitw_equalities.p8:2437 lbl11d: fail_uword(214,65535) -p8l_lbl11d - lda #<$d6 - ldy #>$d6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2438 skip11d: -p8l_skip11d - ; source: test_uword_splitw_equalities.p8:2440 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_294_afterif - cpy p8v_sources_msb+1 - bne label_asm_294_afterif - ; source: test_uword_splitw_equalities.p8:2441 fail_uword(215,65535) - lda #<$d7 - ldy #>$d7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_294_afterif - ; source: test_uword_splitw_equalities.p8:2444 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_296_else - cpy p8v_sources_msb+1 - bne label_asm_296_else - ; source: test_uword_splitw_equalities.p8:2445 fail_uword(216,65535) - lda #<$d8 - ldy #>$d8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_295_afterif -label_asm_296_else - ; source: test_uword_splitw_equalities.p8:2447 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_uword_splitw_equalities.p8:2449 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2451 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12a -+ - ; source: test_uword_splitw_equalities.p8:2453 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:2454 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2455 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:2457 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2458 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2460 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:2461 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2462 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:2464 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_297_afterif - cpy p8v_sources_msb+1 - bne label_asm_297_afterif - ; source: test_uword_splitw_equalities.p8:2465 success++ - inc p8b_main.p8v_success -label_asm_297_afterif - ; source: test_uword_splitw_equalities.p8:2468 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_299_else - cpy p8v_sources_msb+1 - bne label_asm_299_else - ; source: test_uword_splitw_equalities.p8:2469 success++ - inc p8b_main.p8v_success - bra label_asm_298_afterif -label_asm_299_else - ; source: test_uword_splitw_equalities.p8:2471 cx16.r0L++ - inc cx16.r0L -label_asm_298_afterif - ; source: test_uword_splitw_equalities.p8:2474 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12c -+ - ; source: test_uword_splitw_equalities.p8:2476 goto skip12c - bra p8l_skip12c - ; source: test_uword_splitw_equalities.p8:2477 lbl12c: success++ -p8l_lbl12c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2478 skip12c: -p8l_skip12c - ; source: test_uword_splitw_equalities.p8:2480 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2481 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2483 goto skip12d - bra p8l_skip12d - ; source: test_uword_splitw_equalities.p8:2484 lbl12d: success++ -p8l_lbl12d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2485 skip12d: -p8l_skip12d - ; source: test_uword_splitw_equalities.p8:2487 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_300_afterif - cpy p8v_sources_msb+1 - bne label_asm_300_afterif - ; source: test_uword_splitw_equalities.p8:2488 success++ - inc p8b_main.p8v_success -label_asm_300_afterif - ; source: test_uword_splitw_equalities.p8:2491 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_302_else - cpy p8v_sources_msb+1 - bne label_asm_302_else - ; source: test_uword_splitw_equalities.p8:2492 success++ - inc p8b_main.p8v_success - bra label_asm_301_afterif -label_asm_302_else - ; source: test_uword_splitw_equalities.p8:2494 cx16.r0L++ - inc cx16.r0L -label_asm_301_afterif - ; source: test_uword_splitw_equalities.p8:2496 verify_success(24) - lda #$18 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:1919 sub test_is_array_splitw() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $22b8 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $270f, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend - ; source: test_uword_splitw_equalities.p8:2498 sub test_not_array_splitw() { - -p8s_test_not_array_splitw .proc -; statements - ; source: test_uword_splitw_equalities.p8:2500 uword[] @split values = [9999, 8888] - ; source: test_uword_splitw_equalities.p8:2501 uword[] @split sources = [9999, 8888] - ; source: test_uword_splitw_equalities.p8:2502 success = 0 - stz p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2503 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2504 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2505 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2507 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1a - cpy p8v_sources_msb+1 - bne p8l_lbl1a - ; source: test_uword_splitw_equalities.p8:2509 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_equalities.p8:2510 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2511 skip1a: -p8l_skip1a - ; source: test_uword_splitw_equalities.p8:2513 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2514 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2516 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_equalities.p8:2517 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2518 skip1b: -p8l_skip1b - ; source: test_uword_splitw_equalities.p8:2520 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_303_afterif -+ - ; source: test_uword_splitw_equalities.p8:2521 success++ - inc p8b_main.p8v_success -label_asm_303_afterif - ; source: test_uword_splitw_equalities.p8:2524 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_305_else -+ - ; source: test_uword_splitw_equalities.p8:2525 success++ - inc p8b_main.p8v_success - bra label_asm_304_afterif -label_asm_305_else - ; source: test_uword_splitw_equalities.p8:2527 cx16.r0L++ - inc cx16.r0L -label_asm_304_afterif - ; source: test_uword_splitw_equalities.p8:2530 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1c - cpy p8v_sources_msb+1 - bne p8l_lbl1c - ; source: test_uword_splitw_equalities.p8:2532 goto skip1c - bra p8l_skip1c - ; source: test_uword_splitw_equalities.p8:2533 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2534 skip1c: -p8l_skip1c - ; source: test_uword_splitw_equalities.p8:2536 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2537 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2539 goto skip1d - bra p8l_skip1d - ; source: test_uword_splitw_equalities.p8:2540 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2541 skip1d: -p8l_skip1d - ; source: test_uword_splitw_equalities.p8:2543 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_306_afterif -+ - ; source: test_uword_splitw_equalities.p8:2544 success++ - inc p8b_main.p8v_success -label_asm_306_afterif - ; source: test_uword_splitw_equalities.p8:2547 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_308_else -+ - ; source: test_uword_splitw_equalities.p8:2548 success++ - inc p8b_main.p8v_success - bra label_asm_307_afterif -label_asm_308_else - ; source: test_uword_splitw_equalities.p8:2550 cx16.r0L++ - inc cx16.r0L -label_asm_307_afterif - ; source: test_uword_splitw_equalities.p8:2552 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2554 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl2a - cpy p8v_sources_msb+1 - bne p8l_lbl2a - ; source: test_uword_splitw_equalities.p8:2556 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_equalities.p8:2557 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2558 skip2a: -p8l_skip2a - ; source: test_uword_splitw_equalities.p8:2560 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2561 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2563 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_equalities.p8:2564 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2565 skip2b: -p8l_skip2b - ; source: test_uword_splitw_equalities.p8:2567 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_309_afterif -+ - ; source: test_uword_splitw_equalities.p8:2568 success++ - inc p8b_main.p8v_success -label_asm_309_afterif - ; source: test_uword_splitw_equalities.p8:2571 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_311_else -+ - ; source: test_uword_splitw_equalities.p8:2572 success++ - inc p8b_main.p8v_success - bra label_asm_310_afterif -label_asm_311_else - ; source: test_uword_splitw_equalities.p8:2574 cx16.r0L++ - inc cx16.r0L -label_asm_310_afterif - ; source: test_uword_splitw_equalities.p8:2577 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl2c - cpy p8v_sources_msb+1 - bne p8l_lbl2c - ; source: test_uword_splitw_equalities.p8:2579 goto skip2c - bra p8l_skip2c - ; source: test_uword_splitw_equalities.p8:2580 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2581 skip2c: -p8l_skip2c - ; source: test_uword_splitw_equalities.p8:2583 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2584 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2586 goto skip2d - bra p8l_skip2d - ; source: test_uword_splitw_equalities.p8:2587 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2588 skip2d: -p8l_skip2d - ; source: test_uword_splitw_equalities.p8:2590 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_312_afterif -+ - ; source: test_uword_splitw_equalities.p8:2591 success++ - inc p8b_main.p8v_success -label_asm_312_afterif - ; source: test_uword_splitw_equalities.p8:2594 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_314_else -+ - ; source: test_uword_splitw_equalities.p8:2595 success++ - inc p8b_main.p8v_success - bra label_asm_313_afterif -label_asm_314_else - ; source: test_uword_splitw_equalities.p8:2597 cx16.r0L++ - inc cx16.r0L -label_asm_313_afterif - ; source: test_uword_splitw_equalities.p8:2599 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2601 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl3a - cpy p8v_sources_msb+1 - bne p8l_lbl3a - ; source: test_uword_splitw_equalities.p8:2603 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_equalities.p8:2604 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2605 skip3a: -p8l_skip3a - ; source: test_uword_splitw_equalities.p8:2607 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2608 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2610 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_equalities.p8:2611 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2612 skip3b: -p8l_skip3b - ; source: test_uword_splitw_equalities.p8:2614 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_315_afterif -+ - ; source: test_uword_splitw_equalities.p8:2615 success++ - inc p8b_main.p8v_success -label_asm_315_afterif - ; source: test_uword_splitw_equalities.p8:2618 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_317_else -+ - ; source: test_uword_splitw_equalities.p8:2619 success++ - inc p8b_main.p8v_success - bra label_asm_316_afterif -label_asm_317_else - ; source: test_uword_splitw_equalities.p8:2621 cx16.r0L++ - inc cx16.r0L -label_asm_316_afterif - ; source: test_uword_splitw_equalities.p8:2624 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl3c - cpy p8v_sources_msb+1 - bne p8l_lbl3c - ; source: test_uword_splitw_equalities.p8:2626 goto skip3c - bra p8l_skip3c - ; source: test_uword_splitw_equalities.p8:2627 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2628 skip3c: -p8l_skip3c - ; source: test_uword_splitw_equalities.p8:2630 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2631 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2633 goto skip3d - bra p8l_skip3d - ; source: test_uword_splitw_equalities.p8:2634 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2635 skip3d: -p8l_skip3d - ; source: test_uword_splitw_equalities.p8:2637 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_318_afterif -+ - ; source: test_uword_splitw_equalities.p8:2638 success++ - inc p8b_main.p8v_success -label_asm_318_afterif - ; source: test_uword_splitw_equalities.p8:2641 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_320_else -+ - ; source: test_uword_splitw_equalities.p8:2642 success++ - inc p8b_main.p8v_success - bra label_asm_319_afterif -label_asm_320_else - ; source: test_uword_splitw_equalities.p8:2644 cx16.r0L++ - inc cx16.r0L -label_asm_319_afterif - ; source: test_uword_splitw_equalities.p8:2646 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2647 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2648 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2650 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4a - cpy p8v_sources_msb+1 - bne p8l_lbl4a - ; source: test_uword_splitw_equalities.p8:2652 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_equalities.p8:2653 lbl4a: fail_uword(217,1) -p8l_lbl4a - lda #<$d9 - ldy #>$d9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2654 skip4a: -p8l_skip4a - ; source: test_uword_splitw_equalities.p8:2656 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2657 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2659 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_equalities.p8:2660 lbl4b: fail_uword(218,1) -p8l_lbl4b - lda #<$da - ldy #>$da - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2661 skip4b: -p8l_skip4b - ; source: test_uword_splitw_equalities.p8:2663 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_321_afterif -+ - ; source: test_uword_splitw_equalities.p8:2664 fail_uword(219,1) - lda #<$db - ldy #>$db - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_321_afterif - ; source: test_uword_splitw_equalities.p8:2667 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_323_else -+ - ; source: test_uword_splitw_equalities.p8:2668 fail_uword(220,1) - lda #<$dc - ldy #>$dc - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_322_afterif -label_asm_323_else - ; source: test_uword_splitw_equalities.p8:2670 cx16.r0L++ - inc cx16.r0L -label_asm_322_afterif - ; source: test_uword_splitw_equalities.p8:2673 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4c - cpy p8v_sources_msb+1 - bne p8l_lbl4c - ; source: test_uword_splitw_equalities.p8:2675 goto skip4c - bra p8l_skip4c - ; source: test_uword_splitw_equalities.p8:2676 lbl4c: fail_uword(221,1) -p8l_lbl4c - lda #<$dd - ldy #>$dd - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2677 skip4c: -p8l_skip4c - ; source: test_uword_splitw_equalities.p8:2679 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2680 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2682 goto skip4d - bra p8l_skip4d - ; source: test_uword_splitw_equalities.p8:2683 lbl4d: fail_uword(222,1) -p8l_lbl4d - lda #<$de - ldy #>$de - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2684 skip4d: -p8l_skip4d - ; source: test_uword_splitw_equalities.p8:2686 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_324_afterif -+ - ; source: test_uword_splitw_equalities.p8:2687 fail_uword(223,1) - lda #<$df - ldy #>$df - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_324_afterif - ; source: test_uword_splitw_equalities.p8:2690 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_326_else -+ - ; source: test_uword_splitw_equalities.p8:2691 fail_uword(224,1) - lda #<$e0 - ldy #>$e0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_325_afterif -label_asm_326_else - ; source: test_uword_splitw_equalities.p8:2693 cx16.r0L++ - inc cx16.r0L -label_asm_325_afterif - ; source: test_uword_splitw_equalities.p8:2695 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2697 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl5a - cpy p8v_sources_msb+1 - bne p8l_lbl5a - ; source: test_uword_splitw_equalities.p8:2699 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_equalities.p8:2700 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2701 skip5a: -p8l_skip5a - ; source: test_uword_splitw_equalities.p8:2703 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2704 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2706 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_equalities.p8:2707 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2708 skip5b: -p8l_skip5b - ; source: test_uword_splitw_equalities.p8:2710 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_327_afterif -+ - ; source: test_uword_splitw_equalities.p8:2711 success++ - inc p8b_main.p8v_success -label_asm_327_afterif - ; source: test_uword_splitw_equalities.p8:2714 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_329_else -+ - ; source: test_uword_splitw_equalities.p8:2715 success++ - inc p8b_main.p8v_success - bra label_asm_328_afterif -label_asm_329_else - ; source: test_uword_splitw_equalities.p8:2717 cx16.r0L++ - inc cx16.r0L -label_asm_328_afterif - ; source: test_uword_splitw_equalities.p8:2720 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl5c - cpy p8v_sources_msb+1 - bne p8l_lbl5c - ; source: test_uword_splitw_equalities.p8:2722 goto skip5c - bra p8l_skip5c - ; source: test_uword_splitw_equalities.p8:2723 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2724 skip5c: -p8l_skip5c - ; source: test_uword_splitw_equalities.p8:2726 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2727 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2729 goto skip5d - bra p8l_skip5d - ; source: test_uword_splitw_equalities.p8:2730 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2731 skip5d: -p8l_skip5d - ; source: test_uword_splitw_equalities.p8:2733 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_330_afterif -+ - ; source: test_uword_splitw_equalities.p8:2734 success++ - inc p8b_main.p8v_success -label_asm_330_afterif - ; source: test_uword_splitw_equalities.p8:2737 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_332_else -+ - ; source: test_uword_splitw_equalities.p8:2738 success++ - inc p8b_main.p8v_success - bra label_asm_331_afterif -label_asm_332_else - ; source: test_uword_splitw_equalities.p8:2740 cx16.r0L++ - inc cx16.r0L -label_asm_331_afterif - ; source: test_uword_splitw_equalities.p8:2742 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2744 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl6a - cpy p8v_sources_msb+1 - bne p8l_lbl6a - ; source: test_uword_splitw_equalities.p8:2746 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_equalities.p8:2747 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2748 skip6a: -p8l_skip6a - ; source: test_uword_splitw_equalities.p8:2750 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2751 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2753 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_equalities.p8:2754 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2755 skip6b: -p8l_skip6b - ; source: test_uword_splitw_equalities.p8:2757 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_333_afterif -+ - ; source: test_uword_splitw_equalities.p8:2758 success++ - inc p8b_main.p8v_success -label_asm_333_afterif - ; source: test_uword_splitw_equalities.p8:2761 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_335_else -+ - ; source: test_uword_splitw_equalities.p8:2762 success++ - inc p8b_main.p8v_success - bra label_asm_334_afterif -label_asm_335_else - ; source: test_uword_splitw_equalities.p8:2764 cx16.r0L++ - inc cx16.r0L -label_asm_334_afterif - ; source: test_uword_splitw_equalities.p8:2767 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl6c - cpy p8v_sources_msb+1 - bne p8l_lbl6c - ; source: test_uword_splitw_equalities.p8:2769 goto skip6c - bra p8l_skip6c - ; source: test_uword_splitw_equalities.p8:2770 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2771 skip6c: -p8l_skip6c - ; source: test_uword_splitw_equalities.p8:2773 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2774 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2776 goto skip6d - bra p8l_skip6d - ; source: test_uword_splitw_equalities.p8:2777 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2778 skip6d: -p8l_skip6d - ; source: test_uword_splitw_equalities.p8:2780 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_336_afterif -+ - ; source: test_uword_splitw_equalities.p8:2781 success++ - inc p8b_main.p8v_success -label_asm_336_afterif - ; source: test_uword_splitw_equalities.p8:2784 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_338_else -+ - ; source: test_uword_splitw_equalities.p8:2785 success++ - inc p8b_main.p8v_success - bra label_asm_337_afterif -label_asm_338_else - ; source: test_uword_splitw_equalities.p8:2787 cx16.r0L++ - inc cx16.r0L -label_asm_337_afterif - ; source: test_uword_splitw_equalities.p8:2789 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2790 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2791 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2793 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7a - cpy p8v_sources_msb+1 - bne p8l_lbl7a - ; source: test_uword_splitw_equalities.p8:2795 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_equalities.p8:2796 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2797 skip7a: -p8l_skip7a - ; source: test_uword_splitw_equalities.p8:2799 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2800 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2802 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_equalities.p8:2803 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2804 skip7b: -p8l_skip7b - ; source: test_uword_splitw_equalities.p8:2806 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_339_afterif -+ - ; source: test_uword_splitw_equalities.p8:2807 success++ - inc p8b_main.p8v_success -label_asm_339_afterif - ; source: test_uword_splitw_equalities.p8:2810 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_341_else -+ - ; source: test_uword_splitw_equalities.p8:2811 success++ - inc p8b_main.p8v_success - bra label_asm_340_afterif -label_asm_341_else - ; source: test_uword_splitw_equalities.p8:2813 cx16.r0L++ - inc cx16.r0L -label_asm_340_afterif - ; source: test_uword_splitw_equalities.p8:2816 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7c - cpy p8v_sources_msb+1 - bne p8l_lbl7c - ; source: test_uword_splitw_equalities.p8:2818 goto skip7c - bra p8l_skip7c - ; source: test_uword_splitw_equalities.p8:2819 lbl7c: success++ -p8l_lbl7c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2820 skip7c: -p8l_skip7c - ; source: test_uword_splitw_equalities.p8:2822 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2823 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2825 goto skip7d - bra p8l_skip7d - ; source: test_uword_splitw_equalities.p8:2826 lbl7d: success++ -p8l_lbl7d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2827 skip7d: -p8l_skip7d - ; source: test_uword_splitw_equalities.p8:2829 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_342_afterif -+ - ; source: test_uword_splitw_equalities.p8:2830 success++ - inc p8b_main.p8v_success -label_asm_342_afterif - ; source: test_uword_splitw_equalities.p8:2833 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_344_else -+ - ; source: test_uword_splitw_equalities.p8:2834 success++ - inc p8b_main.p8v_success - bra label_asm_343_afterif -label_asm_344_else - ; source: test_uword_splitw_equalities.p8:2836 cx16.r0L++ - inc cx16.r0L -label_asm_343_afterif - ; source: test_uword_splitw_equalities.p8:2838 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2840 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl8a - cpy p8v_sources_msb+1 - bne p8l_lbl8a - ; source: test_uword_splitw_equalities.p8:2842 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_equalities.p8:2843 lbl8a: fail_uword(225,30464) -p8l_lbl8a - lda #<$e1 - ldy #>$e1 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2844 skip8a: -p8l_skip8a - ; source: test_uword_splitw_equalities.p8:2846 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2847 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2849 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_equalities.p8:2850 lbl8b: fail_uword(226,30464) -p8l_lbl8b - lda #<$e2 - ldy #>$e2 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2851 skip8b: -p8l_skip8b - ; source: test_uword_splitw_equalities.p8:2853 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_345_afterif -+ - ; source: test_uword_splitw_equalities.p8:2854 fail_uword(227,30464) - lda #<$e3 - ldy #>$e3 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_345_afterif - ; source: test_uword_splitw_equalities.p8:2857 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_347_else -+ - ; source: test_uword_splitw_equalities.p8:2858 fail_uword(228,30464) - lda #<$e4 - ldy #>$e4 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_346_afterif -label_asm_347_else - ; source: test_uword_splitw_equalities.p8:2860 cx16.r0L++ - inc cx16.r0L -label_asm_346_afterif - ; source: test_uword_splitw_equalities.p8:2863 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl8c - cpy p8v_sources_msb+1 - bne p8l_lbl8c - ; source: test_uword_splitw_equalities.p8:2865 goto skip8c - bra p8l_skip8c - ; source: test_uword_splitw_equalities.p8:2866 lbl8c: fail_uword(229,30464) -p8l_lbl8c - lda #<$e5 - ldy #>$e5 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2867 skip8c: -p8l_skip8c - ; source: test_uword_splitw_equalities.p8:2869 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2870 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2872 goto skip8d - bra p8l_skip8d - ; source: test_uword_splitw_equalities.p8:2873 lbl8d: fail_uword(230,30464) -p8l_lbl8d - lda #<$e6 - ldy #>$e6 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:2874 skip8d: -p8l_skip8d - ; source: test_uword_splitw_equalities.p8:2876 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_348_afterif -+ - ; source: test_uword_splitw_equalities.p8:2877 fail_uword(231,30464) - lda #<$e7 - ldy #>$e7 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_348_afterif - ; source: test_uword_splitw_equalities.p8:2880 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_350_else -+ - ; source: test_uword_splitw_equalities.p8:2881 fail_uword(232,30464) - lda #<$e8 - ldy #>$e8 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_uword.p8v_v1 - sty p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_349_afterif -label_asm_350_else - ; source: test_uword_splitw_equalities.p8:2883 cx16.r0L++ - inc cx16.r0L -label_asm_349_afterif - ; source: test_uword_splitw_equalities.p8:2885 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2887 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl9a - cpy p8v_sources_msb+1 - bne p8l_lbl9a - ; source: test_uword_splitw_equalities.p8:2889 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_equalities.p8:2890 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2891 skip9a: -p8l_skip9a - ; source: test_uword_splitw_equalities.p8:2893 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2894 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2896 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_equalities.p8:2897 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2898 skip9b: -p8l_skip9b - ; source: test_uword_splitw_equalities.p8:2900 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_351_afterif -+ - ; source: test_uword_splitw_equalities.p8:2901 success++ - inc p8b_main.p8v_success -label_asm_351_afterif - ; source: test_uword_splitw_equalities.p8:2904 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_353_else -+ - ; source: test_uword_splitw_equalities.p8:2905 success++ - inc p8b_main.p8v_success - bra label_asm_352_afterif -label_asm_353_else - ; source: test_uword_splitw_equalities.p8:2907 cx16.r0L++ - inc cx16.r0L -label_asm_352_afterif - ; source: test_uword_splitw_equalities.p8:2910 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl9c - cpy p8v_sources_msb+1 - bne p8l_lbl9c - ; source: test_uword_splitw_equalities.p8:2912 goto skip9c - bra p8l_skip9c - ; source: test_uword_splitw_equalities.p8:2913 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2914 skip9c: -p8l_skip9c - ; source: test_uword_splitw_equalities.p8:2916 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2917 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2919 goto skip9d - bra p8l_skip9d - ; source: test_uword_splitw_equalities.p8:2920 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2921 skip9d: -p8l_skip9d - ; source: test_uword_splitw_equalities.p8:2923 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_354_afterif -+ - ; source: test_uword_splitw_equalities.p8:2924 success++ - inc p8b_main.p8v_success -label_asm_354_afterif - ; source: test_uword_splitw_equalities.p8:2927 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_356_else -+ - ; source: test_uword_splitw_equalities.p8:2928 success++ - inc p8b_main.p8v_success - bra label_asm_355_afterif -label_asm_356_else - ; source: test_uword_splitw_equalities.p8:2930 cx16.r0L++ - inc cx16.r0L -label_asm_355_afterif - ; source: test_uword_splitw_equalities.p8:2932 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2933 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_equalities.p8:2934 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2936 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10a - cpy p8v_sources_msb+1 - bne p8l_lbl10a - ; source: test_uword_splitw_equalities.p8:2938 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_equalities.p8:2939 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2940 skip10a: -p8l_skip10a - ; source: test_uword_splitw_equalities.p8:2942 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2943 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2945 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_equalities.p8:2946 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2947 skip10b: -p8l_skip10b - ; source: test_uword_splitw_equalities.p8:2949 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_357_afterif -+ - ; source: test_uword_splitw_equalities.p8:2950 success++ - inc p8b_main.p8v_success -label_asm_357_afterif - ; source: test_uword_splitw_equalities.p8:2953 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_359_else -+ - ; source: test_uword_splitw_equalities.p8:2954 success++ - inc p8b_main.p8v_success - bra label_asm_358_afterif -label_asm_359_else - ; source: test_uword_splitw_equalities.p8:2956 cx16.r0L++ - inc cx16.r0L -label_asm_358_afterif - ; source: test_uword_splitw_equalities.p8:2959 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10c - cpy p8v_sources_msb+1 - bne p8l_lbl10c - ; source: test_uword_splitw_equalities.p8:2961 goto skip10c - bra p8l_skip10c - ; source: test_uword_splitw_equalities.p8:2962 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2963 skip10c: -p8l_skip10c - ; source: test_uword_splitw_equalities.p8:2965 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2966 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2968 goto skip10d - bra p8l_skip10d - ; source: test_uword_splitw_equalities.p8:2969 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2970 skip10d: -p8l_skip10d - ; source: test_uword_splitw_equalities.p8:2972 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_360_afterif -+ - ; source: test_uword_splitw_equalities.p8:2973 success++ - inc p8b_main.p8v_success -label_asm_360_afterif - ; source: test_uword_splitw_equalities.p8:2976 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_362_else -+ - ; source: test_uword_splitw_equalities.p8:2977 success++ - inc p8b_main.p8v_success - bra label_asm_361_afterif -label_asm_362_else - ; source: test_uword_splitw_equalities.p8:2979 cx16.r0L++ - inc cx16.r0L -label_asm_361_afterif - ; source: test_uword_splitw_equalities.p8:2981 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:2983 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl11a - cpy p8v_sources_msb+1 - bne p8l_lbl11a - ; source: test_uword_splitw_equalities.p8:2985 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_equalities.p8:2986 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2987 skip11a: -p8l_skip11a - ; source: test_uword_splitw_equalities.p8:2989 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:2990 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:2992 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_equalities.p8:2993 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:2994 skip11b: -p8l_skip11b - ; source: test_uword_splitw_equalities.p8:2996 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_363_afterif -+ - ; source: test_uword_splitw_equalities.p8:2997 success++ - inc p8b_main.p8v_success -label_asm_363_afterif - ; source: test_uword_splitw_equalities.p8:3000 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_365_else -+ - ; source: test_uword_splitw_equalities.p8:3001 success++ - inc p8b_main.p8v_success - bra label_asm_364_afterif -label_asm_365_else - ; source: test_uword_splitw_equalities.p8:3003 cx16.r0L++ - inc cx16.r0L -label_asm_364_afterif - ; source: test_uword_splitw_equalities.p8:3006 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl11c - cpy p8v_sources_msb+1 - bne p8l_lbl11c - ; source: test_uword_splitw_equalities.p8:3008 goto skip11c - bra p8l_skip11c - ; source: test_uword_splitw_equalities.p8:3009 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:3010 skip11c: -p8l_skip11c - ; source: test_uword_splitw_equalities.p8:3012 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:3013 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:3015 goto skip11d - bra p8l_skip11d - ; source: test_uword_splitw_equalities.p8:3016 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - ; source: test_uword_splitw_equalities.p8:3017 skip11d: -p8l_skip11d - ; source: test_uword_splitw_equalities.p8:3019 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_366_afterif -+ - ; source: test_uword_splitw_equalities.p8:3020 success++ - inc p8b_main.p8v_success -label_asm_366_afterif - ; source: test_uword_splitw_equalities.p8:3023 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_368_else -+ - ; source: test_uword_splitw_equalities.p8:3024 success++ - inc p8b_main.p8v_success - bra label_asm_367_afterif -label_asm_368_else - ; source: test_uword_splitw_equalities.p8:3026 cx16.r0L++ - inc cx16.r0L -label_asm_367_afterif - ; source: test_uword_splitw_equalities.p8:3028 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_equalities.p8:3030 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl12a - cpy p8v_sources_msb+1 - bne p8l_lbl12a - ; source: test_uword_splitw_equalities.p8:3032 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_equalities.p8:3033 lbl12a: fail_uword(233,65535) -p8l_lbl12a - lda #<$e9 - ldy #>$e9 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:3034 skip12a: -p8l_skip12a - ; source: test_uword_splitw_equalities.p8:3036 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:3037 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:3039 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_equalities.p8:3040 lbl12b: fail_uword(234,65535) -p8l_lbl12b - lda #<$ea - ldy #>$ea - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:3041 skip12b: -p8l_skip12b - ; source: test_uword_splitw_equalities.p8:3043 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_369_afterif -+ - ; source: test_uword_splitw_equalities.p8:3044 fail_uword(235,65535) - lda #<$eb - ldy #>$eb - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_369_afterif - ; source: test_uword_splitw_equalities.p8:3047 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_371_else -+ - ; source: test_uword_splitw_equalities.p8:3048 fail_uword(236,65535) - lda #<$ec - ldy #>$ec - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_370_afterif -label_asm_371_else - ; source: test_uword_splitw_equalities.p8:3050 cx16.r0L++ - inc cx16.r0L -label_asm_370_afterif - ; source: test_uword_splitw_equalities.p8:3053 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl12c - cpy p8v_sources_msb+1 - bne p8l_lbl12c - ; source: test_uword_splitw_equalities.p8:3055 goto skip12c - bra p8l_skip12c - ; source: test_uword_splitw_equalities.p8:3056 lbl12c: fail_uword(237,65535) -p8l_lbl12c - lda #<$ed - ldy #>$ed - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:3057 skip12c: -p8l_skip12c - ; source: test_uword_splitw_equalities.p8:3059 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_equalities.p8:3060 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_uword_splitw_equalities.p8:3062 goto skip12d - bra p8l_skip12d - ; source: test_uword_splitw_equalities.p8:3063 lbl12d: fail_uword(238,65535) -p8l_lbl12d - lda #<$ee - ldy #>$ee - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_equalities.p8:3064 skip12d: -p8l_skip12d - ; source: test_uword_splitw_equalities.p8:3066 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_372_afterif -+ - ; source: test_uword_splitw_equalities.p8:3067 fail_uword(239,65535) - lda #<$ef - ldy #>$ef - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword -label_asm_372_afterif - ; source: test_uword_splitw_equalities.p8:3070 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_374_else -+ - ; source: test_uword_splitw_equalities.p8:3071 fail_uword(240,65535) - lda #<$f0 - ldy #>$f0 - sta p8b_main.p8s_fail_uword.p8v_idx - sty p8b_main.p8s_fail_uword.p8v_idx+1 - - lda #$ff - sta p8b_main.p8s_fail_uword.p8v_v1 - sta p8b_main.p8s_fail_uword.p8v_v1+1 - - jsr p8b_main.p8s_fail_uword - bra label_asm_373_afterif -label_asm_374_else - ; source: test_uword_splitw_equalities.p8:3073 cx16.r0L++ - inc cx16.r0L -label_asm_373_afterif - ; source: test_uword_splitw_equalities.p8:3075 verify_success(72) - lda #$48 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_equalities.p8:2498 sub test_not_array_splitw() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $22b8 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $270f, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for split words datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $53, $50, $4c, $49, $54, $20, $57, $4f - .byte $52, $44, $53, $20, $44, $41, $54, $41, $54, $59, $50, $45, $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[] @split: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $20, $40, $53, $50, $4c, $49 - .byte $54, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[] @split: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $20, $40, $53, $50, $4c, $49 - .byte $54, $3a, $20, $00 - - ; source: test_uword_splitw_equalities.p8:14 txt.print("\n(in)equality tests for split words datatype: ") - ; source: test_uword_splitw_equalities.p8:18 txt.print("==0: ") - ; source: test_uword_splitw_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_uword_splitw_equalities.p8:22 txt.print("\n==number: ") - ; source: test_uword_splitw_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_uword_splitw_equalities.p8:26 txt.print("\n==var: ") - ; source: test_uword_splitw_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_uword_splitw_equalities.p8:30 txt.print("\n==array[] @split: ") - ; source: test_uword_splitw_equalities.p8:32 txt.print("\n!=array[] @split: ") - ; source: test_uword_splitw_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_uword_splitw_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_uword_splitw_equalities.p8:45 txt.print(" **failed** ") - ; source: test_uword_splitw_equalities.p8:47 txt.print(" success, expected ") - ; source: test_uword_splitw_equalities.p8:53 txt.print(" **fail#") - ; source: test_uword_splitw_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_splitw_equalities.p8 b/compiler/test/comparisons/test_uword_splitw_equalities.p8 deleted file mode 100644 index 1934d960e..000000000 --- a/compiler/test/comparisons/test_uword_splitw_equalities.p8 +++ /dev/null @@ -1,3079 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for split words datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[] @split: ") - test_is_array_splitw() - txt.print("\n!=array[] @split: ") - test_not_array_splitw() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - uword[] @split sources = [9999, 9999] - success = 0 - - sources[1]=0 - ; direct jump - if sources[1]==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if sources[1]==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if sources[1]==0 - success++ - - ; with else - if sources[1]==0 - success++ - else - cx16.r0L++ - - sources[1] = 9999 - ; direct jump - if sources[1]==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if sources[1]==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if sources[1]==0 - success-- - - ; with else - if sources[1]==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - uword[] @split sources = [9999, 9999] - success = 0 - - sources[1]=9999 - ; direct jump - if sources[1]!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if sources[1]!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if sources[1]!=0 - success++ - - ; with else - if sources[1]!=0 - success++ - else - cx16.r0L++ - - sources[1] = 0 - ; direct jump - if sources[1]!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if sources[1]!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if sources[1]!=0 - success-- - - ; with else - if sources[1]!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - uword[] @split sources = [9999, 9999] - success = 0 - sources[1]=0 - ; direct jump - if sources[1]==1 - goto lbl1a - goto skip1a -lbl1a: fail_uword(1,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==1 - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(2,0) -skip1b: - ; no else - if sources[1]==1 - fail_uword(3,0) - - ; with else - if sources[1]==1 - fail_uword(4,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl2a - goto skip2a -lbl2a: fail_uword(5,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==30464 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(6,0) -skip2b: - ; no else - if sources[1]==30464 - fail_uword(7,0) - - ; with else - if sources[1]==30464 - fail_uword(8,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==65535 - goto lbl3a - goto skip3a -lbl3a: fail_uword(9,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==65535 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(10,0) -skip3b: - ; no else - if sources[1]==65535 - fail_uword(11,0) - - ; with else - if sources[1]==65535 - fail_uword(12,0) - else - cx16.r0L++ - - sources[1]=1 - ; direct jump - if sources[1]==1 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==1 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]==1 - success++ - - ; with else - if sources[1]==1 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl5a - goto skip5a -lbl5a: fail_uword(13,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==30464 - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(14,1) -skip5b: - ; no else - if sources[1]==30464 - fail_uword(15,1) - - ; with else - if sources[1]==30464 - fail_uword(16,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==65535 - goto lbl6a - goto skip6a -lbl6a: fail_uword(17,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==65535 - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(18,1) -skip6b: - ; no else - if sources[1]==65535 - fail_uword(19,1) - - ; with else - if sources[1]==65535 - fail_uword(20,1) - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]==1 - goto lbl7a - goto skip7a -lbl7a: fail_uword(21,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==1 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(22,30464) -skip7b: - ; no else - if sources[1]==1 - fail_uword(23,30464) - - ; with else - if sources[1]==1 - fail_uword(24,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==30464 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]==30464 - success++ - - ; with else - if sources[1]==30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==65535 - goto lbl9a - goto skip9a -lbl9a: fail_uword(25,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==65535 - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(26,30464) -skip9b: - ; no else - if sources[1]==65535 - fail_uword(27,30464) - - ; with else - if sources[1]==65535 - fail_uword(28,30464) - else - cx16.r0L++ - - sources[1]=65535 - ; direct jump - if sources[1]==1 - goto lbl10a - goto skip10a -lbl10a: fail_uword(29,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==1 - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(30,65535) -skip10b: - ; no else - if sources[1]==1 - fail_uword(31,65535) - - ; with else - if sources[1]==1 - fail_uword(32,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl11a - goto skip11a -lbl11a: fail_uword(33,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==30464 - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(34,65535) -skip11b: - ; no else - if sources[1]==30464 - fail_uword(35,65535) - - ; with else - if sources[1]==30464 - fail_uword(36,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==65535 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==65535 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]==65535 - success++ - - ; with else - if sources[1]==65535 - success++ - else - cx16.r0L++ - - verify_success(12) -} - sub test_not_number() { - uword[] @split sources = [9999, 9999] - success = 0 - sources[1]=0 - ; direct jump - if sources[1]!=1 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=1 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]!=1 - success++ - - ; with else - if sources[1]!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=30464 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=65535 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=65535 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=65535 - success++ - - ; with else - if sources[1]!=65535 - success++ - else - cx16.r0L++ - - sources[1]=1 - ; direct jump - if sources[1]!=1 - goto lbl4a - goto skip4a -lbl4a: fail_uword(37,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=1 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(38,1) -skip4b: - ; no else - if sources[1]!=1 - fail_uword(39,1) - - ; with else - if sources[1]!=1 - fail_uword(40,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=30464 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=65535 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=65535 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=65535 - success++ - - ; with else - if sources[1]!=65535 - success++ - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]!=1 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=1 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=1 - success++ - - ; with else - if sources[1]!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl8a - goto skip8a -lbl8a: fail_uword(41,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=30464 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(42,30464) -skip8b: - ; no else - if sources[1]!=30464 - fail_uword(43,30464) - - ; with else - if sources[1]!=30464 - fail_uword(44,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=65535 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=65535 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=65535 - success++ - - ; with else - if sources[1]!=65535 - success++ - else - cx16.r0L++ - - sources[1]=65535 - ; direct jump - if sources[1]!=1 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=1 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]!=1 - success++ - - ; with else - if sources[1]!=1 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=30464 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=65535 - goto lbl12a - goto skip12a -lbl12a: fail_uword(45,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=65535 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(46,65535) -skip12b: - ; no else - if sources[1]!=65535 - fail_uword(47,65535) - - ; with else - if sources[1]!=65535 - fail_uword(48,65535) - else - cx16.r0L++ - - verify_success(36) -} - sub test_is_var() { - uword[] @split sources = [9999, 9999] - uword[] @split values = [8888,8888] - success = 0 - sources[1]=0 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl1a - goto skip1a -lbl1a: fail_uword(49,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(50,0) -skip1b: - ; no else - if sources[1]==values[1] - fail_uword(51,0) - - ; with else - if sources[1]==values[1] - fail_uword(52,0) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(53,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(54,0) -skip2b: - ; no else - if sources[1]==values[1] - fail_uword(55,0) - - ; with else - if sources[1]==values[1] - fail_uword(56,0) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(57,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(58,0) -skip3b: - ; no else - if sources[1]==values[1] - fail_uword(59,0) - - ; with else - if sources[1]==values[1] - fail_uword(60,0) - else - cx16.r0L++ - - sources[1]=1 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_uword(61,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(62,1) -skip5b: - ; no else - if sources[1]==values[1] - fail_uword(63,1) - - ; with else - if sources[1]==values[1] - fail_uword(64,1) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl6a - goto skip6a -lbl6a: fail_uword(65,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(66,1) -skip6b: - ; no else - if sources[1]==values[1] - fail_uword(67,1) - - ; with else - if sources[1]==values[1] - fail_uword(68,1) - else - cx16.r0L++ - - sources[1]=30464 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(69,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(70,30464) -skip7b: - ; no else - if sources[1]==values[1] - fail_uword(71,30464) - - ; with else - if sources[1]==values[1] - fail_uword(72,30464) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl9a - goto skip9a -lbl9a: fail_uword(73,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(74,30464) -skip9b: - ; no else - if sources[1]==values[1] - fail_uword(75,30464) - - ; with else - if sources[1]==values[1] - fail_uword(76,30464) - else - cx16.r0L++ - - sources[1]=65535 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl10a - goto skip10a -lbl10a: fail_uword(77,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(78,65535) -skip10b: - ; no else - if sources[1]==values[1] - fail_uword(79,65535) - - ; with else - if sources[1]==values[1] - fail_uword(80,65535) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl11a - goto skip11a -lbl11a: fail_uword(81,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(82,65535) -skip11b: - ; no else - if sources[1]==values[1] - fail_uword(83,65535) - - ; with else - if sources[1]==values[1] - fail_uword(84,65535) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(12) -} - sub test_not_var() { - uword[] @split sources = [9999, 9999] - uword[] @split values = [8888,8888] - success = 0 - sources[1]=0 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=1 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(85,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(86,1) -skip4b: - ; no else - if sources[1]!=values[1] - fail_uword(87,1) - - ; with else - if sources[1]!=values[1] - fail_uword(88,1) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=30464 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(89,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(90,30464) -skip8b: - ; no else - if sources[1]!=values[1] - fail_uword(91,30464) - - ; with else - if sources[1]!=values[1] - fail_uword(92,30464) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=65535 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(93,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(94,65535) -skip12b: - ; no else - if sources[1]!=values[1] - fail_uword(95,65535) - - ; with else - if sources[1]!=values[1] - fail_uword(96,65535) - else - cx16.r0L++ - - verify_success(36) -} - sub test_is_expr() { - uword[] @split sources = [9999, 9999] - cx16.r4 = 1 - cx16.r5 = 1 - success = 0 - sources[1]=0 - ; direct jump - if sources[1]==cx16.r4+1-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: fail_uword(97,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(98,0) -skip1b: - ; no else - if sources[1]==cx16.r4+1-cx16.r5 - fail_uword(99,0) - - ; with else - if sources[1]==cx16.r4+1-cx16.r5 - fail_uword(100,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+30464-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: fail_uword(101,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(102,0) -skip2b: - ; no else - if sources[1]==cx16.r4+30464-cx16.r5 - fail_uword(103,0) - - ; with else - if sources[1]==cx16.r4+30464-cx16.r5 - fail_uword(104,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+65535-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: fail_uword(105,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(106,0) -skip3b: - ; no else - if sources[1]==cx16.r4+65535-cx16.r5 - fail_uword(107,0) - - ; with else - if sources[1]==cx16.r4+65535-cx16.r5 - fail_uword(108,0) - else - cx16.r0L++ - - sources[1]=1 - ; direct jump - if sources[1]==cx16.r4+1-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]==cx16.r4+1-cx16.r5 - success++ - - ; with else - if sources[1]==cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+30464-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: fail_uword(109,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(110,1) -skip5b: - ; no else - if sources[1]==cx16.r4+30464-cx16.r5 - fail_uword(111,1) - - ; with else - if sources[1]==cx16.r4+30464-cx16.r5 - fail_uword(112,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+65535-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: fail_uword(113,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(114,1) -skip6b: - ; no else - if sources[1]==cx16.r4+65535-cx16.r5 - fail_uword(115,1) - - ; with else - if sources[1]==cx16.r4+65535-cx16.r5 - fail_uword(116,1) - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]==cx16.r4+1-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: fail_uword(117,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(118,30464) -skip7b: - ; no else - if sources[1]==cx16.r4+1-cx16.r5 - fail_uword(119,30464) - - ; with else - if sources[1]==cx16.r4+1-cx16.r5 - fail_uword(120,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+30464-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]==cx16.r4+30464-cx16.r5 - success++ - - ; with else - if sources[1]==cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+65535-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: fail_uword(121,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(122,30464) -skip9b: - ; no else - if sources[1]==cx16.r4+65535-cx16.r5 - fail_uword(123,30464) - - ; with else - if sources[1]==cx16.r4+65535-cx16.r5 - fail_uword(124,30464) - else - cx16.r0L++ - - sources[1]=65535 - ; direct jump - if sources[1]==cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: fail_uword(125,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(126,65535) -skip10b: - ; no else - if sources[1]==cx16.r4+1-cx16.r5 - fail_uword(127,65535) - - ; with else - if sources[1]==cx16.r4+1-cx16.r5 - fail_uword(128,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: fail_uword(129,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(130,65535) -skip11b: - ; no else - if sources[1]==cx16.r4+30464-cx16.r5 - fail_uword(131,65535) - - ; with else - if sources[1]==cx16.r4+30464-cx16.r5 - fail_uword(132,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]==cx16.r4+65535-cx16.r5 - success++ - - ; with else - if sources[1]==cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - verify_success(12) -} - sub test_not_expr() { - uword[] @split sources = [9999, 9999] - cx16.r4 = 1 - cx16.r5 = 1 - success = 0 - sources[1]=0 - ; direct jump - if sources[1]!=cx16.r4+1-cx16.r5 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]!=cx16.r4+1-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+30464-cx16.r5 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+65535-cx16.r5 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - sources[1]=1 - ; direct jump - if sources[1]!=cx16.r4+1-cx16.r5 - goto lbl4a - goto skip4a -lbl4a: fail_uword(133,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(134,1) -skip4b: - ; no else - if sources[1]!=cx16.r4+1-cx16.r5 - fail_uword(135,1) - - ; with else - if sources[1]!=cx16.r4+1-cx16.r5 - fail_uword(136,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+30464-cx16.r5 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+65535-cx16.r5 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]!=cx16.r4+1-cx16.r5 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=cx16.r4+1-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+30464-cx16.r5 - goto lbl8a - goto skip8a -lbl8a: fail_uword(137,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(138,30464) -skip8b: - ; no else - if sources[1]!=cx16.r4+30464-cx16.r5 - fail_uword(139,30464) - - ; with else - if sources[1]!=cx16.r4+30464-cx16.r5 - fail_uword(140,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+65535-cx16.r5 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=cx16.r4+65535-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+65535-cx16.r5 - success++ - else - cx16.r0L++ - - sources[1]=65535 - ; direct jump - if sources[1]!=cx16.r4+1-cx16.r5 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=cx16.r4+1-cx16.r5 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]!=cx16.r4+1-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+1-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+30464-cx16.r5 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=cx16.r4+30464-cx16.r5 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=cx16.r4+30464-cx16.r5 - success++ - - ; with else - if sources[1]!=cx16.r4+30464-cx16.r5 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4+65535-cx16.r5 - goto lbl12a - goto skip12a -lbl12a: fail_uword(141,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=cx16.r4+65535-cx16.r5 - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(142,65535) -skip12b: - ; no else - if sources[1]!=cx16.r4+65535-cx16.r5 - fail_uword(143,65535) - - ; with else - if sources[1]!=cx16.r4+65535-cx16.r5 - fail_uword(144,65535) - else - cx16.r0L++ - - verify_success(36) -} - sub test_is_array_splitw() { - - uword[] @split values = [9999, 8888] - uword[] @split sources = [9999, 8888] - success = 0 - values[1]=0 - sources[1]=0 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl1a - goto skip1a -lbl1a: fail_uword(145,0) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(146,0) -skip1b: - ; no else - if sources[1]==values[1] - fail_uword(147,0) - - ; with else - if sources[1]==values[1] - fail_uword(148,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: fail_uword(149,0) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_uword(150,0) -skip1d: - ; no else - if sources[1]==values[1] - fail_uword(151,0) - - ; with else - if sources[1]==values[1] - fail_uword(152,0) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(153,0) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(154,0) -skip2b: - ; no else - if sources[1]==values[1] - fail_uword(155,0) - - ; with else - if sources[1]==values[1] - fail_uword(156,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: fail_uword(157,0) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_uword(158,0) -skip2d: - ; no else - if sources[1]==values[1] - fail_uword(159,0) - - ; with else - if sources[1]==values[1] - fail_uword(160,0) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(161,0) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(162,0) -skip3b: - ; no else - if sources[1]==values[1] - fail_uword(163,0) - - ; with else - if sources[1]==values[1] - fail_uword(164,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl3c - goto skip3c -lbl3c: fail_uword(165,0) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]==values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_uword(166,0) -skip3d: - ; no else - if sources[1]==values[1] - fail_uword(167,0) - - ; with else - if sources[1]==values[1] - fail_uword(168,0) - else - cx16.r0L++ - - values[1]=1 - sources[1]=1 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]==values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_uword(169,1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(170,1) -skip5b: - ; no else - if sources[1]==values[1] - fail_uword(171,1) - - ; with else - if sources[1]==values[1] - fail_uword(172,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl5c - goto skip5c -lbl5c: fail_uword(173,1) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]==values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_uword(174,1) -skip5d: - ; no else - if sources[1]==values[1] - fail_uword(175,1) - - ; with else - if sources[1]==values[1] - fail_uword(176,1) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl6a - goto skip6a -lbl6a: fail_uword(177,1) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(178,1) -skip6b: - ; no else - if sources[1]==values[1] - fail_uword(179,1) - - ; with else - if sources[1]==values[1] - fail_uword(180,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl6c - goto skip6c -lbl6c: fail_uword(181,1) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]==values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_uword(182,1) -skip6d: - ; no else - if sources[1]==values[1] - fail_uword(183,1) - - ; with else - if sources[1]==values[1] - fail_uword(184,1) - else - cx16.r0L++ - - values[1]=30464 - sources[1]=30464 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(185,30464) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(186,30464) -skip7b: - ; no else - if sources[1]==values[1] - fail_uword(187,30464) - - ; with else - if sources[1]==values[1] - fail_uword(188,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl7c - goto skip7c -lbl7c: fail_uword(189,30464) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]==values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_uword(190,30464) -skip7d: - ; no else - if sources[1]==values[1] - fail_uword(191,30464) - - ; with else - if sources[1]==values[1] - fail_uword(192,30464) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]==values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl9a - goto skip9a -lbl9a: fail_uword(193,30464) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(194,30464) -skip9b: - ; no else - if sources[1]==values[1] - fail_uword(195,30464) - - ; with else - if sources[1]==values[1] - fail_uword(196,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl9c - goto skip9c -lbl9c: fail_uword(197,30464) -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]==values[1] - goto cx16.r3 - goto skip9d -lbl9d: fail_uword(198,30464) -skip9d: - ; no else - if sources[1]==values[1] - fail_uword(199,30464) - - ; with else - if sources[1]==values[1] - fail_uword(200,30464) - else - cx16.r0L++ - - values[1]=65535 - sources[1]=65535 - values[1]=1 - ; direct jump - if sources[1]==values[1] - goto lbl10a - goto skip10a -lbl10a: fail_uword(201,65535) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(202,65535) -skip10b: - ; no else - if sources[1]==values[1] - fail_uword(203,65535) - - ; with else - if sources[1]==values[1] - fail_uword(204,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl10c - goto skip10c -lbl10c: fail_uword(205,65535) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]==values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_uword(206,65535) -skip10d: - ; no else - if sources[1]==values[1] - fail_uword(207,65535) - - ; with else - if sources[1]==values[1] - fail_uword(208,65535) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl11a - goto skip11a -lbl11a: fail_uword(209,65535) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(210,65535) -skip11b: - ; no else - if sources[1]==values[1] - fail_uword(211,65535) - - ; with else - if sources[1]==values[1] - fail_uword(212,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl11c - goto skip11c -lbl11c: fail_uword(213,65535) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]==values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_uword(214,65535) -skip11d: - ; no else - if sources[1]==values[1] - fail_uword(215,65535) - - ; with else - if sources[1]==values[1] - fail_uword(216,65535) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]==values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl12c - goto skip12c -lbl12c: success++ -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]==values[1] - goto cx16.r3 - goto skip12d -lbl12d: success++ -skip12d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(24) -} - sub test_not_array_splitw() { - - uword[] @split values = [9999, 8888] - uword[] @split sources = [9999, 8888] - success = 0 - values[1]=0 - sources[1]=0 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]!=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - sources[1]=1 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(217,1) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(218,1) -skip4b: - ; no else - if sources[1]!=values[1] - fail_uword(219,1) - - ; with else - if sources[1]!=values[1] - fail_uword(220,1) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl4c - goto skip4c -lbl4c: fail_uword(221,1) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]!=values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_uword(222,1) -skip4d: - ; no else - if sources[1]!=values[1] - fail_uword(223,1) - - ; with else - if sources[1]!=values[1] - fail_uword(224,1) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]!=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]!=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - sources[1]=30464 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl7c - goto skip7c -lbl7c: success++ -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]!=values[1] - goto cx16.r3 - goto skip7d -lbl7d: success++ -skip7d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(225,30464) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(226,30464) -skip8b: - ; no else - if sources[1]!=values[1] - fail_uword(227,30464) - - ; with else - if sources[1]!=values[1] - fail_uword(228,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl8c - goto skip8c -lbl8c: fail_uword(229,30464) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]!=values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_uword(230,30464) -skip8d: - ; no else - if sources[1]!=values[1] - fail_uword(231,30464) - - ; with else - if sources[1]!=values[1] - fail_uword(232,30464) - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]!=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - sources[1]=65535 - values[1]=1 - ; direct jump - if sources[1]!=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]!=values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]!=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if sources[1]!=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(233,65535) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(234,65535) -skip12b: - ; no else - if sources[1]!=values[1] - fail_uword(235,65535) - - ; with else - if sources[1]!=values[1] - fail_uword(236,65535) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl12c - goto skip12c -lbl12c: fail_uword(237,65535) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]!=values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_uword(238,65535) -skip12d: - ; no else - if sources[1]!=values[1] - fail_uword(239,65535) - - ; with else - if sources[1]!=values[1] - fail_uword(240,65535) - else - cx16.r0L++ - - verify_success(72) -} - -} - diff --git a/compiler/test/comparisons/test_uword_splitw_gt.asm b/compiler/test/comparisons/test_uword_splitw_gt.asm deleted file mode 100644 index 44760eead..000000000 --- a/compiler/test/comparisons/test_uword_splitw_gt.asm +++ /dev/null @@ -1,9786 +0,0 @@ -; w65c02 assembly code for 'test_uword_splitw_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:44 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_splitw_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .word ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_splitw_gt.p8:9 uword success = 0 - ; source: test_uword_splitw_gt.p8:10 str datatype = "uword" - ; source: test_uword_splitw_gt.p8:11 uword @shared comparison - ; source: test_uword_splitw_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_splitw_gt.p8:14 txt.print("\ngreater-than split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #array[]: ") - ldy #>prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl1a - bne + - cmp p8v_x - bcc p8l_lbl1a -+ - ; source: test_uword_splitw_gt.p8:58 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_gt.p8:59 lbl1a: fail_uword(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:60 skip1a: -p8l_skip1a - ; source: test_uword_splitw_gt.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:63 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:65 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_gt.p8:66 lbl1b: fail_uword(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:67 skip1b: -p8l_skip1b - ; source: test_uword_splitw_gt.p8:69 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_3_afterif - ; source: test_uword_splitw_gt.p8:70 fail_uword(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_3_afterif - ; source: test_uword_splitw_gt.p8:73 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_5_else - ; source: test_uword_splitw_gt.p8:74 fail_uword(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_splitw_gt.p8:76 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_4_afterif - ; source: test_uword_splitw_gt.p8:79 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl1c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl1c -+ - ; source: test_uword_splitw_gt.p8:81 goto skip1c - bra p8l_skip1c - ; source: test_uword_splitw_gt.p8:82 lbl1c: fail_uword(5) -p8l_lbl1c - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:83 skip1c: -p8l_skip1c - ; source: test_uword_splitw_gt.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:86 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:88 goto skip1d - bra p8l_skip1d - ; source: test_uword_splitw_gt.p8:89 lbl1d: fail_uword(6) -p8l_lbl1d - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:90 skip1d: -p8l_skip1d - ; source: test_uword_splitw_gt.p8:92 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_6_afterif - ; source: test_uword_splitw_gt.p8:93 fail_uword(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_6_afterif - ; source: test_uword_splitw_gt.p8:96 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_8_else - ; source: test_uword_splitw_gt.p8:97 fail_uword(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_splitw_gt.p8:99 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_7_afterif - ; source: test_uword_splitw_gt.p8:101 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:103 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl2a - bne + - cmp p8v_x - bcc p8l_lbl2a -+ - ; source: test_uword_splitw_gt.p8:105 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_gt.p8:106 lbl2a: fail_uword(9) -p8l_lbl2a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:107 skip2a: -p8l_skip2a - ; source: test_uword_splitw_gt.p8:109 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:110 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:112 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_gt.p8:113 lbl2b: fail_uword(10) -p8l_lbl2b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:114 skip2b: -p8l_skip2b - ; source: test_uword_splitw_gt.p8:116 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_9_afterif - ; source: test_uword_splitw_gt.p8:117 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_9_afterif - ; source: test_uword_splitw_gt.p8:120 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_11_else - ; source: test_uword_splitw_gt.p8:121 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_splitw_gt.p8:123 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_10_afterif - ; source: test_uword_splitw_gt.p8:126 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl2c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl2c -+ - ; source: test_uword_splitw_gt.p8:128 goto skip2c - bra p8l_skip2c - ; source: test_uword_splitw_gt.p8:129 lbl2c: fail_uword(13) -p8l_lbl2c - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:130 skip2c: -p8l_skip2c - ; source: test_uword_splitw_gt.p8:132 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:133 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:135 goto skip2d - bra p8l_skip2d - ; source: test_uword_splitw_gt.p8:136 lbl2d: fail_uword(14) -p8l_lbl2d - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:137 skip2d: -p8l_skip2d - ; source: test_uword_splitw_gt.p8:139 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_12_afterif - ; source: test_uword_splitw_gt.p8:140 fail_uword(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_12_afterif - ; source: test_uword_splitw_gt.p8:143 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_14_else - ; source: test_uword_splitw_gt.p8:144 fail_uword(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_splitw_gt.p8:146 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_13_afterif - ; source: test_uword_splitw_gt.p8:148 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:150 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl3a - bne + - cmp p8v_x - bcc p8l_lbl3a -+ - ; source: test_uword_splitw_gt.p8:152 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_gt.p8:153 lbl3a: fail_uword(17) -p8l_lbl3a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:154 skip3a: -p8l_skip3a - ; source: test_uword_splitw_gt.p8:156 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:157 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:159 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_gt.p8:160 lbl3b: fail_uword(18) -p8l_lbl3b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:161 skip3b: -p8l_skip3b - ; source: test_uword_splitw_gt.p8:163 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_15_afterif - ; source: test_uword_splitw_gt.p8:164 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_15_afterif - ; source: test_uword_splitw_gt.p8:167 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_17_else - ; source: test_uword_splitw_gt.p8:168 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_splitw_gt.p8:170 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_16_afterif - ; source: test_uword_splitw_gt.p8:173 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl3c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl3c -+ - ; source: test_uword_splitw_gt.p8:175 goto skip3c - bra p8l_skip3c - ; source: test_uword_splitw_gt.p8:176 lbl3c: fail_uword(21) -p8l_lbl3c - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:177 skip3c: -p8l_skip3c - ; source: test_uword_splitw_gt.p8:179 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:180 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:182 goto skip3d - bra p8l_skip3d - ; source: test_uword_splitw_gt.p8:183 lbl3d: fail_uword(22) -p8l_lbl3d - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:184 skip3d: -p8l_skip3d - ; source: test_uword_splitw_gt.p8:186 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_18_afterif - ; source: test_uword_splitw_gt.p8:187 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_18_afterif - ; source: test_uword_splitw_gt.p8:190 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_20_else - ; source: test_uword_splitw_gt.p8:191 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_splitw_gt.p8:193 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_19_afterif - ; source: test_uword_splitw_gt.p8:195 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:197 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl4a - bne + - cmp p8v_x - bcc p8l_lbl4a -+ - ; source: test_uword_splitw_gt.p8:199 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_gt.p8:200 lbl4a: fail_uword(25) -p8l_lbl4a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:201 skip4a: -p8l_skip4a - ; source: test_uword_splitw_gt.p8:203 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:204 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:206 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_gt.p8:207 lbl4b: fail_uword(26) -p8l_lbl4b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:208 skip4b: -p8l_skip4b - ; source: test_uword_splitw_gt.p8:210 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_21_afterif - ; source: test_uword_splitw_gt.p8:211 fail_uword(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_21_afterif - ; source: test_uword_splitw_gt.p8:214 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_23_else - ; source: test_uword_splitw_gt.p8:215 fail_uword(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_splitw_gt.p8:217 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_22_afterif - ; source: test_uword_splitw_gt.p8:220 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl4c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl4c -+ - ; source: test_uword_splitw_gt.p8:222 goto skip4c - bra p8l_skip4c - ; source: test_uword_splitw_gt.p8:223 lbl4c: fail_uword(29) -p8l_lbl4c - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:224 skip4c: -p8l_skip4c - ; source: test_uword_splitw_gt.p8:226 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:227 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:229 goto skip4d - bra p8l_skip4d - ; source: test_uword_splitw_gt.p8:230 lbl4d: fail_uword(30) -p8l_lbl4d - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:231 skip4d: -p8l_skip4d - ; source: test_uword_splitw_gt.p8:233 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_24_afterif - ; source: test_uword_splitw_gt.p8:234 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_24_afterif - ; source: test_uword_splitw_gt.p8:237 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_26_else - ; source: test_uword_splitw_gt.p8:238 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_splitw_gt.p8:240 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_25_afterif - ; source: test_uword_splitw_gt.p8:242 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_gt.p8:243 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_gt.p8:244 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:246 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl5a - bne + - cmp p8v_x - bcc p8l_lbl5a -+ - ; source: test_uword_splitw_gt.p8:248 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_gt.p8:249 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:250 skip5a: -p8l_skip5a - ; source: test_uword_splitw_gt.p8:252 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:253 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:255 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_gt.p8:256 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:257 skip5b: -p8l_skip5b - ; source: test_uword_splitw_gt.p8:259 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_27_afterif - ; source: test_uword_splitw_gt.p8:260 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_27_afterif - ; source: test_uword_splitw_gt.p8:263 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_29_else - ; source: test_uword_splitw_gt.p8:264 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_splitw_gt.p8:266 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_uword_splitw_gt.p8:269 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl5c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl5c -+ - ; source: test_uword_splitw_gt.p8:271 goto skip5c - bra p8l_skip5c - ; source: test_uword_splitw_gt.p8:272 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:273 skip5c: -p8l_skip5c - ; source: test_uword_splitw_gt.p8:275 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:276 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:278 goto skip5d - bra p8l_skip5d - ; source: test_uword_splitw_gt.p8:279 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:280 skip5d: -p8l_skip5d - ; source: test_uword_splitw_gt.p8:282 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_30_afterif - ; source: test_uword_splitw_gt.p8:283 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_30_afterif - ; source: test_uword_splitw_gt.p8:286 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_32_else - ; source: test_uword_splitw_gt.p8:287 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_splitw_gt.p8:289 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_uword_splitw_gt.p8:291 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:293 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl6a - bne + - cmp p8v_x - bcc p8l_lbl6a -+ - ; source: test_uword_splitw_gt.p8:295 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_gt.p8:296 lbl6a: fail_uword(33) -p8l_lbl6a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:297 skip6a: -p8l_skip6a - ; source: test_uword_splitw_gt.p8:299 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:300 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:302 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_gt.p8:303 lbl6b: fail_uword(34) -p8l_lbl6b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:304 skip6b: -p8l_skip6b - ; source: test_uword_splitw_gt.p8:306 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_33_afterif - ; source: test_uword_splitw_gt.p8:307 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_33_afterif - ; source: test_uword_splitw_gt.p8:310 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_35_else - ; source: test_uword_splitw_gt.p8:311 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_splitw_gt.p8:313 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_34_afterif - ; source: test_uword_splitw_gt.p8:316 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl6c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl6c -+ - ; source: test_uword_splitw_gt.p8:318 goto skip6c - bra p8l_skip6c - ; source: test_uword_splitw_gt.p8:319 lbl6c: fail_uword(37) -p8l_lbl6c - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:320 skip6c: -p8l_skip6c - ; source: test_uword_splitw_gt.p8:322 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:323 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:325 goto skip6d - bra p8l_skip6d - ; source: test_uword_splitw_gt.p8:326 lbl6d: fail_uword(38) -p8l_lbl6d - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:327 skip6d: -p8l_skip6d - ; source: test_uword_splitw_gt.p8:329 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_36_afterif - ; source: test_uword_splitw_gt.p8:330 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_36_afterif - ; source: test_uword_splitw_gt.p8:333 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_38_else - ; source: test_uword_splitw_gt.p8:334 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_splitw_gt.p8:336 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_37_afterif - ; source: test_uword_splitw_gt.p8:338 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:340 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl7a - bne + - cmp p8v_x - bcc p8l_lbl7a -+ - ; source: test_uword_splitw_gt.p8:342 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_gt.p8:343 lbl7a: fail_uword(41) -p8l_lbl7a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:344 skip7a: -p8l_skip7a - ; source: test_uword_splitw_gt.p8:346 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:347 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:349 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_gt.p8:350 lbl7b: fail_uword(42) -p8l_lbl7b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:351 skip7b: -p8l_skip7b - ; source: test_uword_splitw_gt.p8:353 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_39_afterif - ; source: test_uword_splitw_gt.p8:354 fail_uword(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_39_afterif - ; source: test_uword_splitw_gt.p8:357 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_41_else - ; source: test_uword_splitw_gt.p8:358 fail_uword(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_splitw_gt.p8:360 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_40_afterif - ; source: test_uword_splitw_gt.p8:363 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl7c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl7c -+ - ; source: test_uword_splitw_gt.p8:365 goto skip7c - bra p8l_skip7c - ; source: test_uword_splitw_gt.p8:366 lbl7c: fail_uword(45) -p8l_lbl7c - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:367 skip7c: -p8l_skip7c - ; source: test_uword_splitw_gt.p8:369 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:370 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:372 goto skip7d - bra p8l_skip7d - ; source: test_uword_splitw_gt.p8:373 lbl7d: fail_uword(46) -p8l_lbl7d - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:374 skip7d: -p8l_skip7d - ; source: test_uword_splitw_gt.p8:376 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_42_afterif - ; source: test_uword_splitw_gt.p8:377 fail_uword(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_42_afterif - ; source: test_uword_splitw_gt.p8:380 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_44_else - ; source: test_uword_splitw_gt.p8:381 fail_uword(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_splitw_gt.p8:383 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_43_afterif - ; source: test_uword_splitw_gt.p8:385 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:387 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl8a - bne + - cmp p8v_x - bcc p8l_lbl8a -+ - ; source: test_uword_splitw_gt.p8:389 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_gt.p8:390 lbl8a: fail_uword(49) -p8l_lbl8a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:391 skip8a: -p8l_skip8a - ; source: test_uword_splitw_gt.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:394 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:396 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_gt.p8:397 lbl8b: fail_uword(50) -p8l_lbl8b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:398 skip8b: -p8l_skip8b - ; source: test_uword_splitw_gt.p8:400 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_45_afterif - ; source: test_uword_splitw_gt.p8:401 fail_uword(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_uword -label_asm_45_afterif - ; source: test_uword_splitw_gt.p8:404 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_47_else - ; source: test_uword_splitw_gt.p8:405 fail_uword(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_uword - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_splitw_gt.p8:407 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_46_afterif - ; source: test_uword_splitw_gt.p8:410 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl8c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl8c -+ - ; source: test_uword_splitw_gt.p8:412 goto skip8c - bra p8l_skip8c - ; source: test_uword_splitw_gt.p8:413 lbl8c: fail_uword(53) -p8l_lbl8c - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:414 skip8c: -p8l_skip8c - ; source: test_uword_splitw_gt.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:417 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:419 goto skip8d - bra p8l_skip8d - ; source: test_uword_splitw_gt.p8:420 lbl8d: fail_uword(54) -p8l_lbl8d - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:421 skip8d: -p8l_skip8d - ; source: test_uword_splitw_gt.p8:423 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_48_afterif - ; source: test_uword_splitw_gt.p8:424 fail_uword(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_uword -label_asm_48_afterif - ; source: test_uword_splitw_gt.p8:427 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_50_else - ; source: test_uword_splitw_gt.p8:428 fail_uword(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_uword - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_splitw_gt.p8:430 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_49_afterif - ; source: test_uword_splitw_gt.p8:432 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_gt.p8:433 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_gt.p8:434 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:436 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl9a - bne + - cmp p8v_x - bcc p8l_lbl9a -+ - ; source: test_uword_splitw_gt.p8:438 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_gt.p8:439 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:440 skip9a: -p8l_skip9a - ; source: test_uword_splitw_gt.p8:442 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:443 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:445 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_gt.p8:446 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:447 skip9b: -p8l_skip9b - ; source: test_uword_splitw_gt.p8:449 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_51_afterif - ; source: test_uword_splitw_gt.p8:450 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_51_afterif - ; source: test_uword_splitw_gt.p8:453 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_53_else - ; source: test_uword_splitw_gt.p8:454 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_splitw_gt.p8:456 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_uword_splitw_gt.p8:459 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl9c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl9c -+ - ; source: test_uword_splitw_gt.p8:461 goto skip9c - bra p8l_skip9c - ; source: test_uword_splitw_gt.p8:462 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:463 skip9c: -p8l_skip9c - ; source: test_uword_splitw_gt.p8:465 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:466 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:468 goto skip9d - bra p8l_skip9d - ; source: test_uword_splitw_gt.p8:469 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:470 skip9d: -p8l_skip9d - ; source: test_uword_splitw_gt.p8:472 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_54_afterif - ; source: test_uword_splitw_gt.p8:473 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_54_afterif - ; source: test_uword_splitw_gt.p8:476 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_56_else - ; source: test_uword_splitw_gt.p8:477 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_splitw_gt.p8:479 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_uword_splitw_gt.p8:481 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:483 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl10a - bne + - cmp p8v_x - bcc p8l_lbl10a -+ - ; source: test_uword_splitw_gt.p8:485 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_gt.p8:486 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:487 skip10a: -p8l_skip10a - ; source: test_uword_splitw_gt.p8:489 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:490 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:492 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_gt.p8:493 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:494 skip10b: -p8l_skip10b - ; source: test_uword_splitw_gt.p8:496 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_57_afterif - ; source: test_uword_splitw_gt.p8:497 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_57_afterif - ; source: test_uword_splitw_gt.p8:500 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_59_else - ; source: test_uword_splitw_gt.p8:501 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_splitw_gt.p8:503 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_uword_splitw_gt.p8:506 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl10c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl10c -+ - ; source: test_uword_splitw_gt.p8:508 goto skip10c - bra p8l_skip10c - ; source: test_uword_splitw_gt.p8:509 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:510 skip10c: -p8l_skip10c - ; source: test_uword_splitw_gt.p8:512 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:513 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:515 goto skip10d - bra p8l_skip10d - ; source: test_uword_splitw_gt.p8:516 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:517 skip10d: -p8l_skip10d - ; source: test_uword_splitw_gt.p8:519 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_60_afterif - ; source: test_uword_splitw_gt.p8:520 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_60_afterif - ; source: test_uword_splitw_gt.p8:523 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_62_else - ; source: test_uword_splitw_gt.p8:524 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_splitw_gt.p8:526 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_uword_splitw_gt.p8:528 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:530 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl11a - bne + - cmp p8v_x - bcc p8l_lbl11a -+ - ; source: test_uword_splitw_gt.p8:532 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_gt.p8:533 lbl11a: fail_uword(57) -p8l_lbl11a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:534 skip11a: -p8l_skip11a - ; source: test_uword_splitw_gt.p8:536 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:537 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:539 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_gt.p8:540 lbl11b: fail_uword(58) -p8l_lbl11b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:541 skip11b: -p8l_skip11b - ; source: test_uword_splitw_gt.p8:543 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_63_afterif - ; source: test_uword_splitw_gt.p8:544 fail_uword(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_uword -label_asm_63_afterif - ; source: test_uword_splitw_gt.p8:547 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_65_else - ; source: test_uword_splitw_gt.p8:548 fail_uword(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_uword - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_splitw_gt.p8:550 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_64_afterif - ; source: test_uword_splitw_gt.p8:553 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl11c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl11c -+ - ; source: test_uword_splitw_gt.p8:555 goto skip11c - bra p8l_skip11c - ; source: test_uword_splitw_gt.p8:556 lbl11c: fail_uword(61) -p8l_lbl11c - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:557 skip11c: -p8l_skip11c - ; source: test_uword_splitw_gt.p8:559 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:560 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:562 goto skip11d - bra p8l_skip11d - ; source: test_uword_splitw_gt.p8:563 lbl11d: fail_uword(62) -p8l_lbl11d - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:564 skip11d: -p8l_skip11d - ; source: test_uword_splitw_gt.p8:566 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_66_afterif - ; source: test_uword_splitw_gt.p8:567 fail_uword(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_uword -label_asm_66_afterif - ; source: test_uword_splitw_gt.p8:570 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_68_else - ; source: test_uword_splitw_gt.p8:571 fail_uword(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_uword - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_splitw_gt.p8:573 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_67_afterif - ; source: test_uword_splitw_gt.p8:575 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:577 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl12a - bne + - cmp p8v_x - bcc p8l_lbl12a -+ - ; source: test_uword_splitw_gt.p8:579 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_gt.p8:580 lbl12a: fail_uword(65) -p8l_lbl12a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:581 skip12a: -p8l_skip12a - ; source: test_uword_splitw_gt.p8:583 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:584 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:586 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_gt.p8:587 lbl12b: fail_uword(66) -p8l_lbl12b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:588 skip12b: -p8l_skip12b - ; source: test_uword_splitw_gt.p8:590 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_69_afterif - ; source: test_uword_splitw_gt.p8:591 fail_uword(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_uword -label_asm_69_afterif - ; source: test_uword_splitw_gt.p8:594 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_71_else - ; source: test_uword_splitw_gt.p8:595 fail_uword(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_uword - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_splitw_gt.p8:597 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_70_afterif - ; source: test_uword_splitw_gt.p8:600 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl12c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl12c -+ - ; source: test_uword_splitw_gt.p8:602 goto skip12c - bra p8l_skip12c - ; source: test_uword_splitw_gt.p8:603 lbl12c: fail_uword(69) -p8l_lbl12c - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:604 skip12c: -p8l_skip12c - ; source: test_uword_splitw_gt.p8:606 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:607 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:609 goto skip12d - bra p8l_skip12d - ; source: test_uword_splitw_gt.p8:610 lbl12d: fail_uword(70) -p8l_lbl12d - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:611 skip12d: -p8l_skip12d - ; source: test_uword_splitw_gt.p8:613 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_72_afterif - ; source: test_uword_splitw_gt.p8:614 fail_uword(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_uword -label_asm_72_afterif - ; source: test_uword_splitw_gt.p8:617 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_74_else - ; source: test_uword_splitw_gt.p8:618 fail_uword(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_uword - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_splitw_gt.p8:620 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_73_afterif - ; source: test_uword_splitw_gt.p8:622 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_splitw_gt.p8:623 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_gt.p8:624 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:626 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl13a - bne + - cmp p8v_x - bcc p8l_lbl13a -+ - ; source: test_uword_splitw_gt.p8:628 goto skip13a - bra p8l_skip13a - ; source: test_uword_splitw_gt.p8:629 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:630 skip13a: -p8l_skip13a - ; source: test_uword_splitw_gt.p8:632 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:633 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:635 goto skip13b - bra p8l_skip13b - ; source: test_uword_splitw_gt.p8:636 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:637 skip13b: -p8l_skip13b - ; source: test_uword_splitw_gt.p8:639 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_75_afterif - ; source: test_uword_splitw_gt.p8:640 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_75_afterif - ; source: test_uword_splitw_gt.p8:643 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_77_else - ; source: test_uword_splitw_gt.p8:644 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_splitw_gt.p8:646 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_uword_splitw_gt.p8:649 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl13c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl13c -+ - ; source: test_uword_splitw_gt.p8:651 goto skip13c - bra p8l_skip13c - ; source: test_uword_splitw_gt.p8:652 lbl13c: success++ -p8l_lbl13c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:653 skip13c: -p8l_skip13c - ; source: test_uword_splitw_gt.p8:655 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:656 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:658 goto skip13d - bra p8l_skip13d - ; source: test_uword_splitw_gt.p8:659 lbl13d: success++ -p8l_lbl13d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:660 skip13d: -p8l_skip13d - ; source: test_uword_splitw_gt.p8:662 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_78_afterif - ; source: test_uword_splitw_gt.p8:663 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_78_afterif - ; source: test_uword_splitw_gt.p8:666 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_80_else - ; source: test_uword_splitw_gt.p8:667 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_splitw_gt.p8:669 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_uword_splitw_gt.p8:671 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:673 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl14a - bne + - cmp p8v_x - bcc p8l_lbl14a -+ - ; source: test_uword_splitw_gt.p8:675 goto skip14a - bra p8l_skip14a - ; source: test_uword_splitw_gt.p8:676 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:677 skip14a: -p8l_skip14a - ; source: test_uword_splitw_gt.p8:679 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:680 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:682 goto skip14b - bra p8l_skip14b - ; source: test_uword_splitw_gt.p8:683 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:684 skip14b: -p8l_skip14b - ; source: test_uword_splitw_gt.p8:686 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_81_afterif - ; source: test_uword_splitw_gt.p8:687 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_81_afterif - ; source: test_uword_splitw_gt.p8:690 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_83_else - ; source: test_uword_splitw_gt.p8:691 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_splitw_gt.p8:693 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_uword_splitw_gt.p8:696 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl14c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl14c -+ - ; source: test_uword_splitw_gt.p8:698 goto skip14c - bra p8l_skip14c - ; source: test_uword_splitw_gt.p8:699 lbl14c: success++ -p8l_lbl14c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:700 skip14c: -p8l_skip14c - ; source: test_uword_splitw_gt.p8:702 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:703 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:705 goto skip14d - bra p8l_skip14d - ; source: test_uword_splitw_gt.p8:706 lbl14d: success++ -p8l_lbl14d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:707 skip14d: -p8l_skip14d - ; source: test_uword_splitw_gt.p8:709 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_84_afterif - ; source: test_uword_splitw_gt.p8:710 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_84_afterif - ; source: test_uword_splitw_gt.p8:713 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_86_else - ; source: test_uword_splitw_gt.p8:714 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_splitw_gt.p8:716 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_uword_splitw_gt.p8:718 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:720 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl15a - bne + - cmp p8v_x - bcc p8l_lbl15a -+ - ; source: test_uword_splitw_gt.p8:722 goto skip15a - bra p8l_skip15a - ; source: test_uword_splitw_gt.p8:723 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:724 skip15a: -p8l_skip15a - ; source: test_uword_splitw_gt.p8:726 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:727 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:729 goto skip15b - bra p8l_skip15b - ; source: test_uword_splitw_gt.p8:730 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:731 skip15b: -p8l_skip15b - ; source: test_uword_splitw_gt.p8:733 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_87_afterif - ; source: test_uword_splitw_gt.p8:734 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_87_afterif - ; source: test_uword_splitw_gt.p8:737 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_89_else - ; source: test_uword_splitw_gt.p8:738 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_splitw_gt.p8:740 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_uword_splitw_gt.p8:743 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl15c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl15c -+ - ; source: test_uword_splitw_gt.p8:745 goto skip15c - bra p8l_skip15c - ; source: test_uword_splitw_gt.p8:746 lbl15c: success++ -p8l_lbl15c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:747 skip15c: -p8l_skip15c - ; source: test_uword_splitw_gt.p8:749 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:750 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:752 goto skip15d - bra p8l_skip15d - ; source: test_uword_splitw_gt.p8:753 lbl15d: success++ -p8l_lbl15d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gt.p8:754 skip15d: -p8l_skip15d - ; source: test_uword_splitw_gt.p8:756 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_90_afterif - ; source: test_uword_splitw_gt.p8:757 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_90_afterif - ; source: test_uword_splitw_gt.p8:760 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_92_else - ; source: test_uword_splitw_gt.p8:761 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_splitw_gt.p8:763 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_uword_splitw_gt.p8:765 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gt.p8:767 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc p8l_lbl16a - bne + - cmp p8v_x - bcc p8l_lbl16a -+ - ; source: test_uword_splitw_gt.p8:769 goto skip16a - bra p8l_skip16a - ; source: test_uword_splitw_gt.p8:770 lbl16a: fail_uword(73) -p8l_lbl16a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:771 skip16a: -p8l_skip16a - ; source: test_uword_splitw_gt.p8:773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:774 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy p8v_x+1 - bcc _jump -+ bne + - cmp p8v_x - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:776 goto skip16b - bra p8l_skip16b - ; source: test_uword_splitw_gt.p8:777 lbl16b: fail_uword(74) -p8l_lbl16b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:778 skip16b: -p8l_skip16b - ; source: test_uword_splitw_gt.p8:780 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_93_afterif - ; source: test_uword_splitw_gt.p8:781 fail_uword(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_uword -label_asm_93_afterif - ; source: test_uword_splitw_gt.p8:784 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs label_asm_95_else - ; source: test_uword_splitw_gt.p8:785 fail_uword(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_uword - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_splitw_gt.p8:787 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_94_afterif - ; source: test_uword_splitw_gt.p8:790 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc p8l_lbl16c - bne + - cmp P8ZP_SCRATCH_W2 - bcc p8l_lbl16c -+ - ; source: test_uword_splitw_gt.p8:792 goto skip16c - bra p8l_skip16c - ; source: test_uword_splitw_gt.p8:793 lbl16c: fail_uword(77) -p8l_lbl16c - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:794 skip16c: -p8l_skip16c - ; source: test_uword_splitw_gt.p8:796 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gt.p8:797 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cpy P8ZP_SCRATCH_W2+1 - bcc _jump -+ bne + - cmp P8ZP_SCRATCH_W2 - bcs + -_jump jmp (cx16.r3) -+ - ; source: test_uword_splitw_gt.p8:799 goto skip16d - bra p8l_skip16d - ; source: test_uword_splitw_gt.p8:800 lbl16d: fail_uword(78) -p8l_lbl16d - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gt.p8:801 skip16d: -p8l_skip16d - ; source: test_uword_splitw_gt.p8:803 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_96_afterif - ; source: test_uword_splitw_gt.p8:804 fail_uword(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_uword -label_asm_96_afterif - ; source: test_uword_splitw_gt.p8:807 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs label_asm_98_else - ; source: test_uword_splitw_gt.p8:808 fail_uword(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_uword - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_splitw_gt.p8:810 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_97_afterif - ; source: test_uword_splitw_gt.p8:812 verify_success(68) - ldy #>$44 - lda #<$44 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_gt.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than split words array tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $53, $50 - .byte $4c, $49, $54, $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59, $20 - .byte $54, $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_4 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_5 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_6 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_7 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 - - ; source: test_uword_splitw_gt.p8:14 txt.print("\ngreater-than split words array tests for: ") - ; source: test_uword_splitw_gt.p8:18 txt.print("\n>array[]: ") - ; source: test_uword_splitw_gt.p8:27 txt.print(" **failed** ") - ; source: test_uword_splitw_gt.p8:29 txt.print(" success, expected ") - ; source: test_uword_splitw_gt.p8:35 txt.print(" **fail#") - ; source: test_uword_splitw_gt.p8:37 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_splitw_gt.p8 b/compiler/test/comparisons/test_uword_splitw_gt.p8 deleted file mode 100644 index 8c23d3e56..000000000 --- a/compiler/test/comparisons/test_uword_splitw_gt.p8 +++ /dev/null @@ -1,816 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>array[]: ") - test_cmp_array() - test_stack.test() - } - - sub verify_success(uword expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_uw(success) - txt.print(" success, expected ") - txt.print_uw(expected) - } - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_array() { - uword @shared x - uword[] @split values = [0, 0] - uword[] @split sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_uword(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_uword(2) -skip1b: - ; no else - if x>values[1] - fail_uword(3) - - ; with else - if x>values[1] - fail_uword(4) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl1c - goto skip1c -lbl1c: fail_uword(5) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]>values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_uword(6) -skip1d: - ; no else - if sources[1]>values[1] - fail_uword(7) - - ; with else - if sources[1]>values[1] - fail_uword(8) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(9) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(10) -skip2b: - ; no else - if x>values[1] - fail_uword(11) - - ; with else - if x>values[1] - fail_uword(12) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl2c - goto skip2c -lbl2c: fail_uword(13) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]>values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_uword(14) -skip2d: - ; no else - if sources[1]>values[1] - fail_uword(15) - - ; with else - if sources[1]>values[1] - fail_uword(16) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(17) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(18) -skip3b: - ; no else - if x>values[1] - fail_uword(19) - - ; with else - if x>values[1] - fail_uword(20) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl3c - goto skip3c -lbl3c: fail_uword(21) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]>values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_uword(22) -skip3d: - ; no else - if sources[1]>values[1] - fail_uword(23) - - ; with else - if sources[1]>values[1] - fail_uword(24) - else - success++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(25) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(26) -skip4b: - ; no else - if x>values[1] - fail_uword(27) - - ; with else - if x>values[1] - fail_uword(28) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl4c - goto skip4c -lbl4c: fail_uword(29) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]>values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_uword(30) -skip4d: - ; no else - if sources[1]>values[1] - fail_uword(31) - - ; with else - if sources[1]>values[1] - fail_uword(32) - else - success++ - - x=1 - sources[1]=1 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]>values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl6a - goto skip6a -lbl6a: fail_uword(33) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_uword(34) -skip6b: - ; no else - if x>values[1] - fail_uword(35) - - ; with else - if x>values[1] - fail_uword(36) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl6c - goto skip6c -lbl6c: fail_uword(37) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]>values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_uword(38) -skip6d: - ; no else - if sources[1]>values[1] - fail_uword(39) - - ; with else - if sources[1]>values[1] - fail_uword(40) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(41) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(42) -skip7b: - ; no else - if x>values[1] - fail_uword(43) - - ; with else - if x>values[1] - fail_uword(44) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl7c - goto skip7c -lbl7c: fail_uword(45) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]>values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_uword(46) -skip7d: - ; no else - if sources[1]>values[1] - fail_uword(47) - - ; with else - if sources[1]>values[1] - fail_uword(48) - else - success++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(49) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(50) -skip8b: - ; no else - if x>values[1] - fail_uword(51) - - ; with else - if x>values[1] - fail_uword(52) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl8c - goto skip8c -lbl8c: fail_uword(53) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]>values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_uword(54) -skip8d: - ; no else - if sources[1]>values[1] - fail_uword(55) - - ; with else - if sources[1]>values[1] - fail_uword(56) - else - success++ - - x=30464 - sources[1]=30464 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]>values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]>values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl11a - goto skip11a -lbl11a: fail_uword(57) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_uword(58) -skip11b: - ; no else - if x>values[1] - fail_uword(59) - - ; with else - if x>values[1] - fail_uword(60) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl11c - goto skip11c -lbl11c: fail_uword(61) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]>values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_uword(62) -skip11d: - ; no else - if sources[1]>values[1] - fail_uword(63) - - ; with else - if sources[1]>values[1] - fail_uword(64) - else - success++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(65) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(66) -skip12b: - ; no else - if x>values[1] - fail_uword(67) - - ; with else - if x>values[1] - fail_uword(68) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl12c - goto skip12c -lbl12c: fail_uword(69) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]>values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_uword(70) -skip12d: - ; no else - if sources[1]>values[1] - fail_uword(71) - - ; with else - if sources[1]>values[1] - fail_uword(72) - else - success++ - - x=65535 - sources[1]=65535 - values[1]=0 - ; direct jump - if x>values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl13c - goto skip13c -lbl13c: success++ -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]>values[1] - goto cx16.r3 - goto skip13d -lbl13d: success++ -skip13d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl14c - goto skip14c -lbl14c: success++ -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]>values[1] - goto cx16.r3 - goto skip14d -lbl14d: success++ -skip14d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl15c - goto skip15c -lbl15c: success++ -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]>values[1] - goto cx16.r3 - goto skip15d -lbl15d: success++ -skip15d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x>values[1] - goto lbl16a - goto skip16a -lbl16a: fail_uword(73) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_uword(74) -skip16b: - ; no else - if x>values[1] - fail_uword(75) - - ; with else - if x>values[1] - fail_uword(76) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl16c - goto skip16c -lbl16c: fail_uword(77) -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]>values[1] - goto cx16.r3 - goto skip16d -lbl16d: fail_uword(78) -skip16d: - ; no else - if sources[1]>values[1] - fail_uword(79) - - ; with else - if sources[1]>values[1] - fail_uword(80) - else - success++ - - verify_success(68) -} - -} - diff --git a/compiler/test/comparisons/test_uword_splitw_gte.asm b/compiler/test/comparisons/test_uword_splitw_gte.asm deleted file mode 100644 index 7708828d3..000000000 --- a/compiler/test/comparisons/test_uword_splitw_gte.asm +++ /dev/null @@ -1,9954 +0,0 @@ -; w65c02 assembly code for 'test_uword_splitw_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:44 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_splitw_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .word ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_splitw_gte.p8:9 uword success = 0 - ; source: test_uword_splitw_gte.p8:10 str datatype = "uword" - ; source: test_uword_splitw_gte.p8:11 uword @shared comparison - ; source: test_uword_splitw_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_splitw_gte.p8:14 txt.print("\ngreater-equal split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=array[]: ") - ldy #>prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl1a - ; source: test_uword_splitw_gte.p8:58 goto skip1a - bra p8l_skip1a - ; source: test_uword_splitw_gte.p8:59 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:60 skip1a: -p8l_skip1a - ; source: test_uword_splitw_gte.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:63 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:65 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_gte.p8:66 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:67 skip1b: -p8l_skip1b - ; source: test_uword_splitw_gte.p8:69 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_3_afterif - ; source: test_uword_splitw_gte.p8:70 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_3_afterif - ; source: test_uword_splitw_gte.p8:73 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_5_else - ; source: test_uword_splitw_gte.p8:74 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_splitw_gte.p8:76 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_uword_splitw_gte.p8:79 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl1c - ; source: test_uword_splitw_gte.p8:81 goto skip1c - bra p8l_skip1c - ; source: test_uword_splitw_gte.p8:82 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:83 skip1c: -p8l_skip1c - ; source: test_uword_splitw_gte.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:86 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:88 goto skip1d - bra p8l_skip1d - ; source: test_uword_splitw_gte.p8:89 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:90 skip1d: -p8l_skip1d - ; source: test_uword_splitw_gte.p8:92 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_6_afterif - ; source: test_uword_splitw_gte.p8:93 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_6_afterif - ; source: test_uword_splitw_gte.p8:96 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_8_else - ; source: test_uword_splitw_gte.p8:97 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_splitw_gte.p8:99 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_uword_splitw_gte.p8:101 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:103 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl2a - ; source: test_uword_splitw_gte.p8:105 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_gte.p8:106 lbl2a: fail_uword(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:107 skip2a: -p8l_skip2a - ; source: test_uword_splitw_gte.p8:109 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:110 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:112 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_gte.p8:113 lbl2b: fail_uword(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:114 skip2b: -p8l_skip2b - ; source: test_uword_splitw_gte.p8:116 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_9_afterif - ; source: test_uword_splitw_gte.p8:117 fail_uword(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_9_afterif - ; source: test_uword_splitw_gte.p8:120 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_11_else - ; source: test_uword_splitw_gte.p8:121 fail_uword(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_splitw_gte.p8:123 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_10_afterif - ; source: test_uword_splitw_gte.p8:126 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl2c - ; source: test_uword_splitw_gte.p8:128 goto skip2c - bra p8l_skip2c - ; source: test_uword_splitw_gte.p8:129 lbl2c: fail_uword(5) -p8l_lbl2c - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:130 skip2c: -p8l_skip2c - ; source: test_uword_splitw_gte.p8:132 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:133 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:135 goto skip2d - bra p8l_skip2d - ; source: test_uword_splitw_gte.p8:136 lbl2d: fail_uword(6) -p8l_lbl2d - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:137 skip2d: -p8l_skip2d - ; source: test_uword_splitw_gte.p8:139 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_12_afterif - ; source: test_uword_splitw_gte.p8:140 fail_uword(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_12_afterif - ; source: test_uword_splitw_gte.p8:143 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_14_else - ; source: test_uword_splitw_gte.p8:144 fail_uword(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_splitw_gte.p8:146 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_13_afterif - ; source: test_uword_splitw_gte.p8:148 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:150 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl3a - ; source: test_uword_splitw_gte.p8:152 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_gte.p8:153 lbl3a: fail_uword(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:154 skip3a: -p8l_skip3a - ; source: test_uword_splitw_gte.p8:156 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:157 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:159 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_gte.p8:160 lbl3b: fail_uword(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:161 skip3b: -p8l_skip3b - ; source: test_uword_splitw_gte.p8:163 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_15_afterif - ; source: test_uword_splitw_gte.p8:164 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_15_afterif - ; source: test_uword_splitw_gte.p8:167 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_17_else - ; source: test_uword_splitw_gte.p8:168 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_splitw_gte.p8:170 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_16_afterif - ; source: test_uword_splitw_gte.p8:173 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl3c - ; source: test_uword_splitw_gte.p8:175 goto skip3c - bra p8l_skip3c - ; source: test_uword_splitw_gte.p8:176 lbl3c: fail_uword(13) -p8l_lbl3c - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:177 skip3c: -p8l_skip3c - ; source: test_uword_splitw_gte.p8:179 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:180 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:182 goto skip3d - bra p8l_skip3d - ; source: test_uword_splitw_gte.p8:183 lbl3d: fail_uword(14) -p8l_lbl3d - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:184 skip3d: -p8l_skip3d - ; source: test_uword_splitw_gte.p8:186 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_18_afterif - ; source: test_uword_splitw_gte.p8:187 fail_uword(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_18_afterif - ; source: test_uword_splitw_gte.p8:190 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_20_else - ; source: test_uword_splitw_gte.p8:191 fail_uword(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_splitw_gte.p8:193 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_19_afterif - ; source: test_uword_splitw_gte.p8:195 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:197 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl4a - ; source: test_uword_splitw_gte.p8:199 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_gte.p8:200 lbl4a: fail_uword(17) -p8l_lbl4a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:201 skip4a: -p8l_skip4a - ; source: test_uword_splitw_gte.p8:203 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:204 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:206 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_gte.p8:207 lbl4b: fail_uword(18) -p8l_lbl4b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:208 skip4b: -p8l_skip4b - ; source: test_uword_splitw_gte.p8:210 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_21_afterif - ; source: test_uword_splitw_gte.p8:211 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_21_afterif - ; source: test_uword_splitw_gte.p8:214 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_23_else - ; source: test_uword_splitw_gte.p8:215 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_splitw_gte.p8:217 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_22_afterif - ; source: test_uword_splitw_gte.p8:220 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl4c - ; source: test_uword_splitw_gte.p8:222 goto skip4c - bra p8l_skip4c - ; source: test_uword_splitw_gte.p8:223 lbl4c: fail_uword(21) -p8l_lbl4c - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:224 skip4c: -p8l_skip4c - ; source: test_uword_splitw_gte.p8:226 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:227 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:229 goto skip4d - bra p8l_skip4d - ; source: test_uword_splitw_gte.p8:230 lbl4d: fail_uword(22) -p8l_lbl4d - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:231 skip4d: -p8l_skip4d - ; source: test_uword_splitw_gte.p8:233 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_24_afterif - ; source: test_uword_splitw_gte.p8:234 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_24_afterif - ; source: test_uword_splitw_gte.p8:237 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_26_else - ; source: test_uword_splitw_gte.p8:238 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_splitw_gte.p8:240 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_25_afterif - ; source: test_uword_splitw_gte.p8:242 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_gte.p8:243 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_gte.p8:244 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:246 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl5a - ; source: test_uword_splitw_gte.p8:248 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_gte.p8:249 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:250 skip5a: -p8l_skip5a - ; source: test_uword_splitw_gte.p8:252 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:253 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:255 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_gte.p8:256 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:257 skip5b: -p8l_skip5b - ; source: test_uword_splitw_gte.p8:259 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_27_afterif - ; source: test_uword_splitw_gte.p8:260 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_27_afterif - ; source: test_uword_splitw_gte.p8:263 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_29_else - ; source: test_uword_splitw_gte.p8:264 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_splitw_gte.p8:266 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_uword_splitw_gte.p8:269 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl5c - ; source: test_uword_splitw_gte.p8:271 goto skip5c - bra p8l_skip5c - ; source: test_uword_splitw_gte.p8:272 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:273 skip5c: -p8l_skip5c - ; source: test_uword_splitw_gte.p8:275 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:276 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:278 goto skip5d - bra p8l_skip5d - ; source: test_uword_splitw_gte.p8:279 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:280 skip5d: -p8l_skip5d - ; source: test_uword_splitw_gte.p8:282 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_30_afterif - ; source: test_uword_splitw_gte.p8:283 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_30_afterif - ; source: test_uword_splitw_gte.p8:286 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_32_else - ; source: test_uword_splitw_gte.p8:287 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_splitw_gte.p8:289 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_uword_splitw_gte.p8:291 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:293 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl6a - ; source: test_uword_splitw_gte.p8:295 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_gte.p8:296 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:297 skip6a: -p8l_skip6a - ; source: test_uword_splitw_gte.p8:299 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:300 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:302 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_gte.p8:303 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:304 skip6b: -p8l_skip6b - ; source: test_uword_splitw_gte.p8:306 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_33_afterif - ; source: test_uword_splitw_gte.p8:307 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_33_afterif - ; source: test_uword_splitw_gte.p8:310 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_35_else - ; source: test_uword_splitw_gte.p8:311 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_splitw_gte.p8:313 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_uword_splitw_gte.p8:316 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl6c - ; source: test_uword_splitw_gte.p8:318 goto skip6c - bra p8l_skip6c - ; source: test_uword_splitw_gte.p8:319 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:320 skip6c: -p8l_skip6c - ; source: test_uword_splitw_gte.p8:322 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:323 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:325 goto skip6d - bra p8l_skip6d - ; source: test_uword_splitw_gte.p8:326 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:327 skip6d: -p8l_skip6d - ; source: test_uword_splitw_gte.p8:329 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_36_afterif - ; source: test_uword_splitw_gte.p8:330 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_36_afterif - ; source: test_uword_splitw_gte.p8:333 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_38_else - ; source: test_uword_splitw_gte.p8:334 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_splitw_gte.p8:336 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_uword_splitw_gte.p8:338 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:340 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl7a - ; source: test_uword_splitw_gte.p8:342 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_gte.p8:343 lbl7a: fail_uword(25) -p8l_lbl7a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:344 skip7a: -p8l_skip7a - ; source: test_uword_splitw_gte.p8:346 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:347 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:349 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_gte.p8:350 lbl7b: fail_uword(26) -p8l_lbl7b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:351 skip7b: -p8l_skip7b - ; source: test_uword_splitw_gte.p8:353 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_39_afterif - ; source: test_uword_splitw_gte.p8:354 fail_uword(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_39_afterif - ; source: test_uword_splitw_gte.p8:357 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_41_else - ; source: test_uword_splitw_gte.p8:358 fail_uword(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_splitw_gte.p8:360 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_40_afterif - ; source: test_uword_splitw_gte.p8:363 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl7c - ; source: test_uword_splitw_gte.p8:365 goto skip7c - bra p8l_skip7c - ; source: test_uword_splitw_gte.p8:366 lbl7c: fail_uword(29) -p8l_lbl7c - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:367 skip7c: -p8l_skip7c - ; source: test_uword_splitw_gte.p8:369 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:370 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:372 goto skip7d - bra p8l_skip7d - ; source: test_uword_splitw_gte.p8:373 lbl7d: fail_uword(30) -p8l_lbl7d - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:374 skip7d: -p8l_skip7d - ; source: test_uword_splitw_gte.p8:376 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_42_afterif - ; source: test_uword_splitw_gte.p8:377 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_42_afterif - ; source: test_uword_splitw_gte.p8:380 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_44_else - ; source: test_uword_splitw_gte.p8:381 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_splitw_gte.p8:383 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_43_afterif - ; source: test_uword_splitw_gte.p8:385 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:387 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl8a - ; source: test_uword_splitw_gte.p8:389 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_gte.p8:390 lbl8a: fail_uword(33) -p8l_lbl8a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:391 skip8a: -p8l_skip8a - ; source: test_uword_splitw_gte.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:394 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:396 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_gte.p8:397 lbl8b: fail_uword(34) -p8l_lbl8b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:398 skip8b: -p8l_skip8b - ; source: test_uword_splitw_gte.p8:400 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_45_afterif - ; source: test_uword_splitw_gte.p8:401 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_45_afterif - ; source: test_uword_splitw_gte.p8:404 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_47_else - ; source: test_uword_splitw_gte.p8:405 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_splitw_gte.p8:407 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_46_afterif - ; source: test_uword_splitw_gte.p8:410 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl8c - ; source: test_uword_splitw_gte.p8:412 goto skip8c - bra p8l_skip8c - ; source: test_uword_splitw_gte.p8:413 lbl8c: fail_uword(37) -p8l_lbl8c - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:414 skip8c: -p8l_skip8c - ; source: test_uword_splitw_gte.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:417 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:419 goto skip8d - bra p8l_skip8d - ; source: test_uword_splitw_gte.p8:420 lbl8d: fail_uword(38) -p8l_lbl8d - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:421 skip8d: -p8l_skip8d - ; source: test_uword_splitw_gte.p8:423 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_48_afterif - ; source: test_uword_splitw_gte.p8:424 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_48_afterif - ; source: test_uword_splitw_gte.p8:427 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_50_else - ; source: test_uword_splitw_gte.p8:428 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_splitw_gte.p8:430 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_49_afterif - ; source: test_uword_splitw_gte.p8:432 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_gte.p8:433 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_gte.p8:434 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:436 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl9a - ; source: test_uword_splitw_gte.p8:438 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_gte.p8:439 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:440 skip9a: -p8l_skip9a - ; source: test_uword_splitw_gte.p8:442 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:443 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:445 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_gte.p8:446 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:447 skip9b: -p8l_skip9b - ; source: test_uword_splitw_gte.p8:449 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_51_afterif - ; source: test_uword_splitw_gte.p8:450 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_51_afterif - ; source: test_uword_splitw_gte.p8:453 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_53_else - ; source: test_uword_splitw_gte.p8:454 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_splitw_gte.p8:456 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_uword_splitw_gte.p8:459 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl9c - ; source: test_uword_splitw_gte.p8:461 goto skip9c - bra p8l_skip9c - ; source: test_uword_splitw_gte.p8:462 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:463 skip9c: -p8l_skip9c - ; source: test_uword_splitw_gte.p8:465 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:466 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:468 goto skip9d - bra p8l_skip9d - ; source: test_uword_splitw_gte.p8:469 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:470 skip9d: -p8l_skip9d - ; source: test_uword_splitw_gte.p8:472 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_54_afterif - ; source: test_uword_splitw_gte.p8:473 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_54_afterif - ; source: test_uword_splitw_gte.p8:476 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_56_else - ; source: test_uword_splitw_gte.p8:477 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_splitw_gte.p8:479 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_uword_splitw_gte.p8:481 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:483 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl10a - ; source: test_uword_splitw_gte.p8:485 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_gte.p8:486 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:487 skip10a: -p8l_skip10a - ; source: test_uword_splitw_gte.p8:489 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:490 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:492 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_gte.p8:493 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:494 skip10b: -p8l_skip10b - ; source: test_uword_splitw_gte.p8:496 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_57_afterif - ; source: test_uword_splitw_gte.p8:497 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_57_afterif - ; source: test_uword_splitw_gte.p8:500 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_59_else - ; source: test_uword_splitw_gte.p8:501 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_splitw_gte.p8:503 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_uword_splitw_gte.p8:506 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl10c - ; source: test_uword_splitw_gte.p8:508 goto skip10c - bra p8l_skip10c - ; source: test_uword_splitw_gte.p8:509 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:510 skip10c: -p8l_skip10c - ; source: test_uword_splitw_gte.p8:512 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:513 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:515 goto skip10d - bra p8l_skip10d - ; source: test_uword_splitw_gte.p8:516 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:517 skip10d: -p8l_skip10d - ; source: test_uword_splitw_gte.p8:519 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_60_afterif - ; source: test_uword_splitw_gte.p8:520 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_60_afterif - ; source: test_uword_splitw_gte.p8:523 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_62_else - ; source: test_uword_splitw_gte.p8:524 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_splitw_gte.p8:526 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_uword_splitw_gte.p8:528 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:530 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl11a - ; source: test_uword_splitw_gte.p8:532 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_gte.p8:533 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:534 skip11a: -p8l_skip11a - ; source: test_uword_splitw_gte.p8:536 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:537 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:539 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_gte.p8:540 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:541 skip11b: -p8l_skip11b - ; source: test_uword_splitw_gte.p8:543 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_63_afterif - ; source: test_uword_splitw_gte.p8:544 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_63_afterif - ; source: test_uword_splitw_gte.p8:547 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_65_else - ; source: test_uword_splitw_gte.p8:548 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_splitw_gte.p8:550 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_uword_splitw_gte.p8:553 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl11c - ; source: test_uword_splitw_gte.p8:555 goto skip11c - bra p8l_skip11c - ; source: test_uword_splitw_gte.p8:556 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:557 skip11c: -p8l_skip11c - ; source: test_uword_splitw_gte.p8:559 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:560 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:562 goto skip11d - bra p8l_skip11d - ; source: test_uword_splitw_gte.p8:563 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:564 skip11d: -p8l_skip11d - ; source: test_uword_splitw_gte.p8:566 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_66_afterif - ; source: test_uword_splitw_gte.p8:567 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_66_afterif - ; source: test_uword_splitw_gte.p8:570 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_68_else - ; source: test_uword_splitw_gte.p8:571 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_splitw_gte.p8:573 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_uword_splitw_gte.p8:575 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:577 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl12a - ; source: test_uword_splitw_gte.p8:579 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_gte.p8:580 lbl12a: fail_uword(41) -p8l_lbl12a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:581 skip12a: -p8l_skip12a - ; source: test_uword_splitw_gte.p8:583 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:584 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:586 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_gte.p8:587 lbl12b: fail_uword(42) -p8l_lbl12b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:588 skip12b: -p8l_skip12b - ; source: test_uword_splitw_gte.p8:590 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_69_afterif - ; source: test_uword_splitw_gte.p8:591 fail_uword(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_69_afterif - ; source: test_uword_splitw_gte.p8:594 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_71_else - ; source: test_uword_splitw_gte.p8:595 fail_uword(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_splitw_gte.p8:597 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_70_afterif - ; source: test_uword_splitw_gte.p8:600 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl12c - ; source: test_uword_splitw_gte.p8:602 goto skip12c - bra p8l_skip12c - ; source: test_uword_splitw_gte.p8:603 lbl12c: fail_uword(45) -p8l_lbl12c - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:604 skip12c: -p8l_skip12c - ; source: test_uword_splitw_gte.p8:606 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:607 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:609 goto skip12d - bra p8l_skip12d - ; source: test_uword_splitw_gte.p8:610 lbl12d: fail_uword(46) -p8l_lbl12d - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_gte.p8:611 skip12d: -p8l_skip12d - ; source: test_uword_splitw_gte.p8:613 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_72_afterif - ; source: test_uword_splitw_gte.p8:614 fail_uword(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_72_afterif - ; source: test_uword_splitw_gte.p8:617 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_74_else - ; source: test_uword_splitw_gte.p8:618 fail_uword(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_splitw_gte.p8:620 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_73_afterif - ; source: test_uword_splitw_gte.p8:622 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_splitw_gte.p8:623 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_gte.p8:624 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:626 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl13a - ; source: test_uword_splitw_gte.p8:628 goto skip13a - bra p8l_skip13a - ; source: test_uword_splitw_gte.p8:629 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:630 skip13a: -p8l_skip13a - ; source: test_uword_splitw_gte.p8:632 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:633 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:635 goto skip13b - bra p8l_skip13b - ; source: test_uword_splitw_gte.p8:636 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:637 skip13b: -p8l_skip13b - ; source: test_uword_splitw_gte.p8:639 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_75_afterif - ; source: test_uword_splitw_gte.p8:640 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_75_afterif - ; source: test_uword_splitw_gte.p8:643 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_77_else - ; source: test_uword_splitw_gte.p8:644 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_splitw_gte.p8:646 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_uword_splitw_gte.p8:649 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl13c - ; source: test_uword_splitw_gte.p8:651 goto skip13c - bra p8l_skip13c - ; source: test_uword_splitw_gte.p8:652 lbl13c: success++ -p8l_lbl13c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:653 skip13c: -p8l_skip13c - ; source: test_uword_splitw_gte.p8:655 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:656 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:658 goto skip13d - bra p8l_skip13d - ; source: test_uword_splitw_gte.p8:659 lbl13d: success++ -p8l_lbl13d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:660 skip13d: -p8l_skip13d - ; source: test_uword_splitw_gte.p8:662 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_78_afterif - ; source: test_uword_splitw_gte.p8:663 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_78_afterif - ; source: test_uword_splitw_gte.p8:666 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_80_else - ; source: test_uword_splitw_gte.p8:667 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_splitw_gte.p8:669 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_uword_splitw_gte.p8:671 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:673 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl14a - ; source: test_uword_splitw_gte.p8:675 goto skip14a - bra p8l_skip14a - ; source: test_uword_splitw_gte.p8:676 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:677 skip14a: -p8l_skip14a - ; source: test_uword_splitw_gte.p8:679 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:680 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:682 goto skip14b - bra p8l_skip14b - ; source: test_uword_splitw_gte.p8:683 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:684 skip14b: -p8l_skip14b - ; source: test_uword_splitw_gte.p8:686 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_81_afterif - ; source: test_uword_splitw_gte.p8:687 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_81_afterif - ; source: test_uword_splitw_gte.p8:690 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_83_else - ; source: test_uword_splitw_gte.p8:691 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_splitw_gte.p8:693 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_uword_splitw_gte.p8:696 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl14c - ; source: test_uword_splitw_gte.p8:698 goto skip14c - bra p8l_skip14c - ; source: test_uword_splitw_gte.p8:699 lbl14c: success++ -p8l_lbl14c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:700 skip14c: -p8l_skip14c - ; source: test_uword_splitw_gte.p8:702 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:703 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:705 goto skip14d - bra p8l_skip14d - ; source: test_uword_splitw_gte.p8:706 lbl14d: success++ -p8l_lbl14d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:707 skip14d: -p8l_skip14d - ; source: test_uword_splitw_gte.p8:709 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_84_afterif - ; source: test_uword_splitw_gte.p8:710 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_84_afterif - ; source: test_uword_splitw_gte.p8:713 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_86_else - ; source: test_uword_splitw_gte.p8:714 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_splitw_gte.p8:716 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_uword_splitw_gte.p8:718 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:720 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl15a - ; source: test_uword_splitw_gte.p8:722 goto skip15a - bra p8l_skip15a - ; source: test_uword_splitw_gte.p8:723 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:724 skip15a: -p8l_skip15a - ; source: test_uword_splitw_gte.p8:726 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:727 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:729 goto skip15b - bra p8l_skip15b - ; source: test_uword_splitw_gte.p8:730 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:731 skip15b: -p8l_skip15b - ; source: test_uword_splitw_gte.p8:733 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_87_afterif - ; source: test_uword_splitw_gte.p8:734 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_87_afterif - ; source: test_uword_splitw_gte.p8:737 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_89_else - ; source: test_uword_splitw_gte.p8:738 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_splitw_gte.p8:740 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_uword_splitw_gte.p8:743 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl15c - ; source: test_uword_splitw_gte.p8:745 goto skip15c - bra p8l_skip15c - ; source: test_uword_splitw_gte.p8:746 lbl15c: success++ -p8l_lbl15c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:747 skip15c: -p8l_skip15c - ; source: test_uword_splitw_gte.p8:749 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:750 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:752 goto skip15d - bra p8l_skip15d - ; source: test_uword_splitw_gte.p8:753 lbl15d: success++ -p8l_lbl15d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:754 skip15d: -p8l_skip15d - ; source: test_uword_splitw_gte.p8:756 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_90_afterif - ; source: test_uword_splitw_gte.p8:757 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_90_afterif - ; source: test_uword_splitw_gte.p8:760 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_92_else - ; source: test_uword_splitw_gte.p8:761 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_splitw_gte.p8:763 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_uword_splitw_gte.p8:765 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_gte.p8:767 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl16a - ; source: test_uword_splitw_gte.p8:769 goto skip16a - bra p8l_skip16a - ; source: test_uword_splitw_gte.p8:770 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:771 skip16a: -p8l_skip16a - ; source: test_uword_splitw_gte.p8:773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:774 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:776 goto skip16b - bra p8l_skip16b - ; source: test_uword_splitw_gte.p8:777 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:778 skip16b: -p8l_skip16b - ; source: test_uword_splitw_gte.p8:780 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_93_afterif - ; source: test_uword_splitw_gte.p8:781 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_93_afterif - ; source: test_uword_splitw_gte.p8:784 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_95_else - ; source: test_uword_splitw_gte.p8:785 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_splitw_gte.p8:787 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_uword_splitw_gte.p8:790 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl16c - ; source: test_uword_splitw_gte.p8:792 goto skip16c - bra p8l_skip16c - ; source: test_uword_splitw_gte.p8:793 lbl16c: success++ -p8l_lbl16c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:794 skip16c: -p8l_skip16c - ; source: test_uword_splitw_gte.p8:796 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_gte.p8:797 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_gte.p8:799 goto skip16d - bra p8l_skip16d - ; source: test_uword_splitw_gte.p8:800 lbl16d: success++ -p8l_lbl16d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_gte.p8:801 skip16d: -p8l_skip16d - ; source: test_uword_splitw_gte.p8:803 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_96_afterif - ; source: test_uword_splitw_gte.p8:804 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_96_afterif - ; source: test_uword_splitw_gte.p8:807 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_98_else - ; source: test_uword_splitw_gte.p8:808 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_splitw_gte.p8:810 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_uword_splitw_gte.p8:812 verify_success(92) - ldy #>$5c - lda #<$5c - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_gte.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal split words array tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $53 - .byte $50, $4c, $49, $54, $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59 - .byte $20, $54, $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_4 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_5 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_6 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_7 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 - - ; source: test_uword_splitw_gte.p8:14 txt.print("\ngreater-equal split words array tests for: ") - ; source: test_uword_splitw_gte.p8:18 txt.print("\n>=array[]: ") - ; source: test_uword_splitw_gte.p8:27 txt.print(" **failed** ") - ; source: test_uword_splitw_gte.p8:29 txt.print(" success, expected ") - ; source: test_uword_splitw_gte.p8:35 txt.print(" **fail#") - ; source: test_uword_splitw_gte.p8:37 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_splitw_gte.p8 b/compiler/test/comparisons/test_uword_splitw_gte.p8 deleted file mode 100644 index 1423a9b33..000000000 --- a/compiler/test/comparisons/test_uword_splitw_gte.p8 +++ /dev/null @@ -1,816 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=array[]: ") - test_cmp_array() - test_stack.test() - } - - sub verify_success(uword expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_uw(success) - txt.print(" success, expected ") - txt.print_uw(expected) - } - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_array() { - uword @shared x - uword[] @split values = [0, 0] - uword[] @split sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]>=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_uword(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_uword(2) -skip2b: - ; no else - if x>=values[1] - fail_uword(3) - - ; with else - if x>=values[1] - fail_uword(4) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl2c - goto skip2c -lbl2c: fail_uword(5) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]>=values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_uword(6) -skip2d: - ; no else - if sources[1]>=values[1] - fail_uword(7) - - ; with else - if sources[1]>=values[1] - fail_uword(8) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_uword(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_uword(10) -skip3b: - ; no else - if x>=values[1] - fail_uword(11) - - ; with else - if x>=values[1] - fail_uword(12) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl3c - goto skip3c -lbl3c: fail_uword(13) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]>=values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_uword(14) -skip3d: - ; no else - if sources[1]>=values[1] - fail_uword(15) - - ; with else - if sources[1]>=values[1] - fail_uword(16) - else - success++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_uword(17) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_uword(18) -skip4b: - ; no else - if x>=values[1] - fail_uword(19) - - ; with else - if x>=values[1] - fail_uword(20) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl4c - goto skip4c -lbl4c: fail_uword(21) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]>=values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_uword(22) -skip4d: - ; no else - if sources[1]>=values[1] - fail_uword(23) - - ; with else - if sources[1]>=values[1] - fail_uword(24) - else - success++ - - x=1 - sources[1]=1 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]>=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]>=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl7a - goto skip7a -lbl7a: fail_uword(25) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_uword(26) -skip7b: - ; no else - if x>=values[1] - fail_uword(27) - - ; with else - if x>=values[1] - fail_uword(28) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl7c - goto skip7c -lbl7c: fail_uword(29) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]>=values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_uword(30) -skip7d: - ; no else - if sources[1]>=values[1] - fail_uword(31) - - ; with else - if sources[1]>=values[1] - fail_uword(32) - else - success++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_uword(33) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_uword(34) -skip8b: - ; no else - if x>=values[1] - fail_uword(35) - - ; with else - if x>=values[1] - fail_uword(36) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl8c - goto skip8c -lbl8c: fail_uword(37) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]>=values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_uword(38) -skip8d: - ; no else - if sources[1]>=values[1] - fail_uword(39) - - ; with else - if sources[1]>=values[1] - fail_uword(40) - else - success++ - - x=30464 - sources[1]=30464 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]>=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]>=values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]>=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_uword(41) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_uword(42) -skip12b: - ; no else - if x>=values[1] - fail_uword(43) - - ; with else - if x>=values[1] - fail_uword(44) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl12c - goto skip12c -lbl12c: fail_uword(45) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]>=values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_uword(46) -skip12d: - ; no else - if sources[1]>=values[1] - fail_uword(47) - - ; with else - if sources[1]>=values[1] - fail_uword(48) - else - success++ - - x=65535 - sources[1]=65535 - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl13c - goto skip13c -lbl13c: success++ -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]>=values[1] - goto cx16.r3 - goto skip13d -lbl13d: success++ -skip13d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl14c - goto skip14c -lbl14c: success++ -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]>=values[1] - goto cx16.r3 - goto skip14d -lbl14d: success++ -skip14d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl15c - goto skip15c -lbl15c: success++ -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]>=values[1] - goto cx16.r3 - goto skip15d -lbl15d: success++ -skip15d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x>=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl16c - goto skip16c -lbl16c: success++ -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]>=values[1] - goto cx16.r3 - goto skip16d -lbl16d: success++ -skip16d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - verify_success(92) -} - -} - diff --git a/compiler/test/comparisons/test_uword_splitw_lt.asm b/compiler/test/comparisons/test_uword_splitw_lt.asm deleted file mode 100644 index 86123e6fc..000000000 --- a/compiler/test/comparisons/test_uword_splitw_lt.asm +++ /dev/null @@ -1,10042 +0,0 @@ -; w65c02 assembly code for 'test_uword_splitw_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:45 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_uword_splitw_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .word ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"uword" - .byte $55, $57, $4f, $52, $44, $00 - - ; source: test_uword_splitw_lt.p8:9 uword success = 0 - ; source: test_uword_splitw_lt.p8:10 str datatype = "uword" - ; source: test_uword_splitw_lt.p8:11 uword @shared comparison - ; source: test_uword_splitw_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_splitw_lt.p8:14 txt.print("\nless-than split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:60 skip1a: -p8l_skip1a - ; source: test_uword_splitw_lt.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:63 if x2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:67 skip1b: -p8l_skip1b - ; source: test_uword_splitw_lt.p8:69 if x3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_3_afterif - ; source: test_uword_splitw_lt.p8:73 if x4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_splitw_lt.p8:76 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_4_afterif - ; source: test_uword_splitw_lt.p8:79 if sources[1]5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:83 skip1c: -p8l_skip1c - ; source: test_uword_splitw_lt.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:86 if sources[1]6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:90 skip1d: -p8l_skip1d - ; source: test_uword_splitw_lt.p8:92 if sources[1]7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_6_afterif - ; source: test_uword_splitw_lt.p8:96 if sources[1]8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_splitw_lt.p8:99 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_7_afterif - ; source: test_uword_splitw_lt.p8:101 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:103 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:110 if xp8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:133 if sources[1]$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:150 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:157 if xp8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:180 if sources[1]$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:197 if xp8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:204 if xp8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:227 if sources[1]1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_lt.p8:243 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_lt.p8:244 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:246 if x9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:250 skip5a: -p8l_skip5a - ; source: test_uword_splitw_lt.p8:252 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:253 if x10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:257 skip5b: -p8l_skip5b - ; source: test_uword_splitw_lt.p8:259 if x11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_27_afterif - ; source: test_uword_splitw_lt.p8:263 if x12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_splitw_lt.p8:266 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_28_afterif - ; source: test_uword_splitw_lt.p8:269 if sources[1]13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:273 skip5c: -p8l_skip5c - ; source: test_uword_splitw_lt.p8:275 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:276 if sources[1]14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:280 skip5d: -p8l_skip5d - ; source: test_uword_splitw_lt.p8:282 if sources[1]15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_30_afterif - ; source: test_uword_splitw_lt.p8:286 if sources[1]$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_splitw_lt.p8:289 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_31_afterif - ; source: test_uword_splitw_lt.p8:291 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:293 if x$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:297 skip6a: -p8l_skip6a - ; source: test_uword_splitw_lt.p8:299 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:300 if x$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:304 skip6b: -p8l_skip6b - ; source: test_uword_splitw_lt.p8:306 if x$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_33_afterif - ; source: test_uword_splitw_lt.p8:310 if x$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_splitw_lt.p8:313 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_34_afterif - ; source: test_uword_splitw_lt.p8:316 if sources[1]$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:320 skip6c: -p8l_skip6c - ; source: test_uword_splitw_lt.p8:322 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:323 if sources[1]$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:327 skip6d: -p8l_skip6d - ; source: test_uword_splitw_lt.p8:329 if sources[1]$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_36_afterif - ; source: test_uword_splitw_lt.p8:333 if sources[1]$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_splitw_lt.p8:336 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_37_afterif - ; source: test_uword_splitw_lt.p8:338 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:340 if xp8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:347 if xp8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:370 if sources[1]$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:387 if xp8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:394 if xp8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:417 if sources[1]$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_lt.p8:433 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_lt.p8:434 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:436 if x$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:440 skip9a: -p8l_skip9a - ; source: test_uword_splitw_lt.p8:442 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:443 if x$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:447 skip9b: -p8l_skip9b - ; source: test_uword_splitw_lt.p8:449 if x$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_51_afterif - ; source: test_uword_splitw_lt.p8:453 if x$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_splitw_lt.p8:456 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_52_afterif - ; source: test_uword_splitw_lt.p8:459 if sources[1]$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:463 skip9c: -p8l_skip9c - ; source: test_uword_splitw_lt.p8:465 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:466 if sources[1]$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:470 skip9d: -p8l_skip9d - ; source: test_uword_splitw_lt.p8:472 if sources[1]$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_54_afterif - ; source: test_uword_splitw_lt.p8:476 if sources[1]$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_splitw_lt.p8:479 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_55_afterif - ; source: test_uword_splitw_lt.p8:481 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:483 if x$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:487 skip10a: -p8l_skip10a - ; source: test_uword_splitw_lt.p8:489 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:490 if x$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:494 skip10b: -p8l_skip10b - ; source: test_uword_splitw_lt.p8:496 if x$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_57_afterif - ; source: test_uword_splitw_lt.p8:500 if x$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_splitw_lt.p8:503 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_58_afterif - ; source: test_uword_splitw_lt.p8:506 if sources[1]$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:510 skip10c: -p8l_skip10c - ; source: test_uword_splitw_lt.p8:512 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:513 if sources[1]$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:517 skip10d: -p8l_skip10d - ; source: test_uword_splitw_lt.p8:519 if sources[1]$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_60_afterif - ; source: test_uword_splitw_lt.p8:523 if sources[1]$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_splitw_lt.p8:526 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_61_afterif - ; source: test_uword_splitw_lt.p8:528 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:530 if x$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:534 skip11a: -p8l_skip11a - ; source: test_uword_splitw_lt.p8:536 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:537 if x$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:541 skip11b: -p8l_skip11b - ; source: test_uword_splitw_lt.p8:543 if x$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_63_afterif - ; source: test_uword_splitw_lt.p8:547 if x$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_splitw_lt.p8:550 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_64_afterif - ; source: test_uword_splitw_lt.p8:553 if sources[1]$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:557 skip11c: -p8l_skip11c - ; source: test_uword_splitw_lt.p8:559 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:560 if sources[1]$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:564 skip11d: -p8l_skip11d - ; source: test_uword_splitw_lt.p8:566 if sources[1]$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_66_afterif - ; source: test_uword_splitw_lt.p8:570 if sources[1]$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_splitw_lt.p8:573 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_67_afterif - ; source: test_uword_splitw_lt.p8:575 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:577 if xp8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:584 if xp8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:607 if sources[1]$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_lt.p8:624 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:626 if x$31 - lda #<$31 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:630 skip13a: -p8l_skip13a - ; source: test_uword_splitw_lt.p8:632 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:633 if x$32 - lda #<$32 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:637 skip13b: -p8l_skip13b - ; source: test_uword_splitw_lt.p8:639 if x$33 - lda #<$33 - jsr p8b_main.p8s_fail_uword -label_asm_75_afterif - ; source: test_uword_splitw_lt.p8:643 if x$34 - lda #<$34 - jsr p8b_main.p8s_fail_uword - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_splitw_lt.p8:646 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_76_afterif - ; source: test_uword_splitw_lt.p8:649 if sources[1]$35 - lda #<$35 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:653 skip13c: -p8l_skip13c - ; source: test_uword_splitw_lt.p8:655 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:656 if sources[1]$36 - lda #<$36 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:660 skip13d: -p8l_skip13d - ; source: test_uword_splitw_lt.p8:662 if sources[1]$37 - lda #<$37 - jsr p8b_main.p8s_fail_uword -label_asm_78_afterif - ; source: test_uword_splitw_lt.p8:666 if sources[1]$38 - lda #<$38 - jsr p8b_main.p8s_fail_uword - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_splitw_lt.p8:669 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_79_afterif - ; source: test_uword_splitw_lt.p8:671 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:673 if x$39 - lda #<$39 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:677 skip14a: -p8l_skip14a - ; source: test_uword_splitw_lt.p8:679 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:680 if x$3a - lda #<$3a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:684 skip14b: -p8l_skip14b - ; source: test_uword_splitw_lt.p8:686 if x$3b - lda #<$3b - jsr p8b_main.p8s_fail_uword -label_asm_81_afterif - ; source: test_uword_splitw_lt.p8:690 if x$3c - lda #<$3c - jsr p8b_main.p8s_fail_uword - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_splitw_lt.p8:693 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_82_afterif - ; source: test_uword_splitw_lt.p8:696 if sources[1]$3d - lda #<$3d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:700 skip14c: -p8l_skip14c - ; source: test_uword_splitw_lt.p8:702 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:703 if sources[1]$3e - lda #<$3e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:707 skip14d: -p8l_skip14d - ; source: test_uword_splitw_lt.p8:709 if sources[1]$3f - lda #<$3f - jsr p8b_main.p8s_fail_uword -label_asm_84_afterif - ; source: test_uword_splitw_lt.p8:713 if sources[1]$40 - lda #<$40 - jsr p8b_main.p8s_fail_uword - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_splitw_lt.p8:716 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_85_afterif - ; source: test_uword_splitw_lt.p8:718 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:720 if x$41 - lda #<$41 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:724 skip15a: -p8l_skip15a - ; source: test_uword_splitw_lt.p8:726 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:727 if x$42 - lda #<$42 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:731 skip15b: -p8l_skip15b - ; source: test_uword_splitw_lt.p8:733 if x$43 - lda #<$43 - jsr p8b_main.p8s_fail_uword -label_asm_87_afterif - ; source: test_uword_splitw_lt.p8:737 if x$44 - lda #<$44 - jsr p8b_main.p8s_fail_uword - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_splitw_lt.p8:740 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_88_afterif - ; source: test_uword_splitw_lt.p8:743 if sources[1]$45 - lda #<$45 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:747 skip15c: -p8l_skip15c - ; source: test_uword_splitw_lt.p8:749 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:750 if sources[1]$46 - lda #<$46 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:754 skip15d: -p8l_skip15d - ; source: test_uword_splitw_lt.p8:756 if sources[1]$47 - lda #<$47 - jsr p8b_main.p8s_fail_uword -label_asm_90_afterif - ; source: test_uword_splitw_lt.p8:760 if sources[1]$48 - lda #<$48 - jsr p8b_main.p8s_fail_uword - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_splitw_lt.p8:763 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_91_afterif - ; source: test_uword_splitw_lt.p8:765 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lt.p8:767 if x$49 - lda #<$49 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:771 skip16a: -p8l_skip16a - ; source: test_uword_splitw_lt.p8:773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:774 if x$4a - lda #<$4a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:778 skip16b: -p8l_skip16b - ; source: test_uword_splitw_lt.p8:780 if x$4b - lda #<$4b - jsr p8b_main.p8s_fail_uword -label_asm_93_afterif - ; source: test_uword_splitw_lt.p8:784 if x$4c - lda #<$4c - jsr p8b_main.p8s_fail_uword - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_splitw_lt.p8:787 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_94_afterif - ; source: test_uword_splitw_lt.p8:790 if sources[1]$4d - lda #<$4d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:794 skip16c: -p8l_skip16c - ; source: test_uword_splitw_lt.p8:796 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lt.p8:797 if sources[1]$4e - lda #<$4e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lt.p8:801 skip16d: -p8l_skip16d - ; source: test_uword_splitw_lt.p8:803 if sources[1]$4f - lda #<$4f - jsr p8b_main.p8s_fail_uword -label_asm_96_afterif - ; source: test_uword_splitw_lt.p8:807 if sources[1]$50 - lda #<$50 - jsr p8b_main.p8s_fail_uword - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_splitw_lt.p8:810 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_97_afterif - ; source: test_uword_splitw_lt.p8:812 verify_success(68) - ldy #>$44 - lda #<$44 - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_lt.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than split words array tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $53, $50, $4c, $49, $54 - .byte $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59, $20, $54, $45, $53 - .byte $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_splitw_lt.p8 b/compiler/test/comparisons/test_uword_splitw_lt.p8 deleted file mode 100644 index ba436c09f..000000000 --- a/compiler/test/comparisons/test_uword_splitw_lt.p8 +++ /dev/null @@ -1,816 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\nless-than split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_uword_splitw_lte.p8:14 txt.print("\nless-equal split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:63 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:65 goto skip1b - bra p8l_skip1b - ; source: test_uword_splitw_lte.p8:66 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:67 skip1b: -p8l_skip1b - ; source: test_uword_splitw_lte.p8:69 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_3_afterif - ; source: test_uword_splitw_lte.p8:70 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_3_afterif - ; source: test_uword_splitw_lte.p8:73 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_5_else - ; source: test_uword_splitw_lte.p8:74 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_4_afterif -label_asm_5_else - ; source: test_uword_splitw_lte.p8:76 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_uword_splitw_lte.p8:79 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl1c - ; source: test_uword_splitw_lte.p8:81 goto skip1c - bra p8l_skip1c - ; source: test_uword_splitw_lte.p8:82 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:83 skip1c: -p8l_skip1c - ; source: test_uword_splitw_lte.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:86 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:88 goto skip1d - bra p8l_skip1d - ; source: test_uword_splitw_lte.p8:89 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:90 skip1d: -p8l_skip1d - ; source: test_uword_splitw_lte.p8:92 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_6_afterif - ; source: test_uword_splitw_lte.p8:93 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_6_afterif - ; source: test_uword_splitw_lte.p8:96 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_8_else - ; source: test_uword_splitw_lte.p8:97 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_7_afterif -label_asm_8_else - ; source: test_uword_splitw_lte.p8:99 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_uword_splitw_lte.p8:101 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:103 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl2a - ; source: test_uword_splitw_lte.p8:105 goto skip2a - bra p8l_skip2a - ; source: test_uword_splitw_lte.p8:106 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:107 skip2a: -p8l_skip2a - ; source: test_uword_splitw_lte.p8:109 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:110 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:112 goto skip2b - bra p8l_skip2b - ; source: test_uword_splitw_lte.p8:113 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:114 skip2b: -p8l_skip2b - ; source: test_uword_splitw_lte.p8:116 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_9_afterif - ; source: test_uword_splitw_lte.p8:117 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_9_afterif - ; source: test_uword_splitw_lte.p8:120 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_11_else - ; source: test_uword_splitw_lte.p8:121 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_10_afterif -label_asm_11_else - ; source: test_uword_splitw_lte.p8:123 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_uword_splitw_lte.p8:126 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl2c - ; source: test_uword_splitw_lte.p8:128 goto skip2c - bra p8l_skip2c - ; source: test_uword_splitw_lte.p8:129 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:130 skip2c: -p8l_skip2c - ; source: test_uword_splitw_lte.p8:132 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:133 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:135 goto skip2d - bra p8l_skip2d - ; source: test_uword_splitw_lte.p8:136 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:137 skip2d: -p8l_skip2d - ; source: test_uword_splitw_lte.p8:139 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_12_afterif - ; source: test_uword_splitw_lte.p8:140 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_12_afterif - ; source: test_uword_splitw_lte.p8:143 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_14_else - ; source: test_uword_splitw_lte.p8:144 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_13_afterif -label_asm_14_else - ; source: test_uword_splitw_lte.p8:146 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_uword_splitw_lte.p8:148 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:150 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl3a - ; source: test_uword_splitw_lte.p8:152 goto skip3a - bra p8l_skip3a - ; source: test_uword_splitw_lte.p8:153 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:154 skip3a: -p8l_skip3a - ; source: test_uword_splitw_lte.p8:156 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:157 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:159 goto skip3b - bra p8l_skip3b - ; source: test_uword_splitw_lte.p8:160 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:161 skip3b: -p8l_skip3b - ; source: test_uword_splitw_lte.p8:163 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_15_afterif - ; source: test_uword_splitw_lte.p8:164 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_15_afterif - ; source: test_uword_splitw_lte.p8:167 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_17_else - ; source: test_uword_splitw_lte.p8:168 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_16_afterif -label_asm_17_else - ; source: test_uword_splitw_lte.p8:170 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_uword_splitw_lte.p8:173 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl3c - ; source: test_uword_splitw_lte.p8:175 goto skip3c - bra p8l_skip3c - ; source: test_uword_splitw_lte.p8:176 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:177 skip3c: -p8l_skip3c - ; source: test_uword_splitw_lte.p8:179 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:180 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:182 goto skip3d - bra p8l_skip3d - ; source: test_uword_splitw_lte.p8:183 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:184 skip3d: -p8l_skip3d - ; source: test_uword_splitw_lte.p8:186 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_18_afterif - ; source: test_uword_splitw_lte.p8:187 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_18_afterif - ; source: test_uword_splitw_lte.p8:190 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_20_else - ; source: test_uword_splitw_lte.p8:191 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_19_afterif -label_asm_20_else - ; source: test_uword_splitw_lte.p8:193 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_uword_splitw_lte.p8:195 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:197 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl4a - ; source: test_uword_splitw_lte.p8:199 goto skip4a - bra p8l_skip4a - ; source: test_uword_splitw_lte.p8:200 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:201 skip4a: -p8l_skip4a - ; source: test_uword_splitw_lte.p8:203 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:204 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:206 goto skip4b - bra p8l_skip4b - ; source: test_uword_splitw_lte.p8:207 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:208 skip4b: -p8l_skip4b - ; source: test_uword_splitw_lte.p8:210 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_21_afterif - ; source: test_uword_splitw_lte.p8:211 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_21_afterif - ; source: test_uword_splitw_lte.p8:214 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_23_else - ; source: test_uword_splitw_lte.p8:215 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_22_afterif -label_asm_23_else - ; source: test_uword_splitw_lte.p8:217 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_uword_splitw_lte.p8:220 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl4c - ; source: test_uword_splitw_lte.p8:222 goto skip4c - bra p8l_skip4c - ; source: test_uword_splitw_lte.p8:223 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:224 skip4c: -p8l_skip4c - ; source: test_uword_splitw_lte.p8:226 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:227 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:229 goto skip4d - bra p8l_skip4d - ; source: test_uword_splitw_lte.p8:230 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:231 skip4d: -p8l_skip4d - ; source: test_uword_splitw_lte.p8:233 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_24_afterif - ; source: test_uword_splitw_lte.p8:234 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_24_afterif - ; source: test_uword_splitw_lte.p8:237 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_26_else - ; source: test_uword_splitw_lte.p8:238 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_25_afterif -label_asm_26_else - ; source: test_uword_splitw_lte.p8:240 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_uword_splitw_lte.p8:242 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_lte.p8:243 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_uword_splitw_lte.p8:244 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:246 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl5a - ; source: test_uword_splitw_lte.p8:248 goto skip5a - bra p8l_skip5a - ; source: test_uword_splitw_lte.p8:249 lbl5a: fail_uword(1) -p8l_lbl5a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:250 skip5a: -p8l_skip5a - ; source: test_uword_splitw_lte.p8:252 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:253 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:255 goto skip5b - bra p8l_skip5b - ; source: test_uword_splitw_lte.p8:256 lbl5b: fail_uword(2) -p8l_lbl5b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:257 skip5b: -p8l_skip5b - ; source: test_uword_splitw_lte.p8:259 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_27_afterif - ; source: test_uword_splitw_lte.p8:260 fail_uword(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_uword -label_asm_27_afterif - ; source: test_uword_splitw_lte.p8:263 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_29_else - ; source: test_uword_splitw_lte.p8:264 fail_uword(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_uword - bra label_asm_28_afterif -label_asm_29_else - ; source: test_uword_splitw_lte.p8:266 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_28_afterif - ; source: test_uword_splitw_lte.p8:269 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl5c - ; source: test_uword_splitw_lte.p8:271 goto skip5c - bra p8l_skip5c - ; source: test_uword_splitw_lte.p8:272 lbl5c: fail_uword(5) -p8l_lbl5c - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:273 skip5c: -p8l_skip5c - ; source: test_uword_splitw_lte.p8:275 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:276 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:278 goto skip5d - bra p8l_skip5d - ; source: test_uword_splitw_lte.p8:279 lbl5d: fail_uword(6) -p8l_lbl5d - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:280 skip5d: -p8l_skip5d - ; source: test_uword_splitw_lte.p8:282 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_30_afterif - ; source: test_uword_splitw_lte.p8:283 fail_uword(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_uword -label_asm_30_afterif - ; source: test_uword_splitw_lte.p8:286 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_32_else - ; source: test_uword_splitw_lte.p8:287 fail_uword(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_uword - bra label_asm_31_afterif -label_asm_32_else - ; source: test_uword_splitw_lte.p8:289 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_31_afterif - ; source: test_uword_splitw_lte.p8:291 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:293 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl6a - ; source: test_uword_splitw_lte.p8:295 goto skip6a - bra p8l_skip6a - ; source: test_uword_splitw_lte.p8:296 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:297 skip6a: -p8l_skip6a - ; source: test_uword_splitw_lte.p8:299 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:300 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:302 goto skip6b - bra p8l_skip6b - ; source: test_uword_splitw_lte.p8:303 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:304 skip6b: -p8l_skip6b - ; source: test_uword_splitw_lte.p8:306 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_33_afterif - ; source: test_uword_splitw_lte.p8:307 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_33_afterif - ; source: test_uword_splitw_lte.p8:310 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_35_else - ; source: test_uword_splitw_lte.p8:311 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_34_afterif -label_asm_35_else - ; source: test_uword_splitw_lte.p8:313 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_uword_splitw_lte.p8:316 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl6c - ; source: test_uword_splitw_lte.p8:318 goto skip6c - bra p8l_skip6c - ; source: test_uword_splitw_lte.p8:319 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:320 skip6c: -p8l_skip6c - ; source: test_uword_splitw_lte.p8:322 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:323 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:325 goto skip6d - bra p8l_skip6d - ; source: test_uword_splitw_lte.p8:326 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:327 skip6d: -p8l_skip6d - ; source: test_uword_splitw_lte.p8:329 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_36_afterif - ; source: test_uword_splitw_lte.p8:330 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_36_afterif - ; source: test_uword_splitw_lte.p8:333 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_38_else - ; source: test_uword_splitw_lte.p8:334 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_37_afterif -label_asm_38_else - ; source: test_uword_splitw_lte.p8:336 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_uword_splitw_lte.p8:338 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:340 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl7a - ; source: test_uword_splitw_lte.p8:342 goto skip7a - bra p8l_skip7a - ; source: test_uword_splitw_lte.p8:343 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:344 skip7a: -p8l_skip7a - ; source: test_uword_splitw_lte.p8:346 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:347 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:349 goto skip7b - bra p8l_skip7b - ; source: test_uword_splitw_lte.p8:350 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:351 skip7b: -p8l_skip7b - ; source: test_uword_splitw_lte.p8:353 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_39_afterif - ; source: test_uword_splitw_lte.p8:354 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_39_afterif - ; source: test_uword_splitw_lte.p8:357 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_41_else - ; source: test_uword_splitw_lte.p8:358 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_40_afterif -label_asm_41_else - ; source: test_uword_splitw_lte.p8:360 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_uword_splitw_lte.p8:363 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl7c - ; source: test_uword_splitw_lte.p8:365 goto skip7c - bra p8l_skip7c - ; source: test_uword_splitw_lte.p8:366 lbl7c: success++ -p8l_lbl7c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:367 skip7c: -p8l_skip7c - ; source: test_uword_splitw_lte.p8:369 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:370 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:372 goto skip7d - bra p8l_skip7d - ; source: test_uword_splitw_lte.p8:373 lbl7d: success++ -p8l_lbl7d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:374 skip7d: -p8l_skip7d - ; source: test_uword_splitw_lte.p8:376 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_42_afterif - ; source: test_uword_splitw_lte.p8:377 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_42_afterif - ; source: test_uword_splitw_lte.p8:380 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_44_else - ; source: test_uword_splitw_lte.p8:381 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_43_afterif -label_asm_44_else - ; source: test_uword_splitw_lte.p8:383 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_uword_splitw_lte.p8:385 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:387 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl8a - ; source: test_uword_splitw_lte.p8:389 goto skip8a - bra p8l_skip8a - ; source: test_uword_splitw_lte.p8:390 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:391 skip8a: -p8l_skip8a - ; source: test_uword_splitw_lte.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:394 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:396 goto skip8b - bra p8l_skip8b - ; source: test_uword_splitw_lte.p8:397 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:398 skip8b: -p8l_skip8b - ; source: test_uword_splitw_lte.p8:400 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_45_afterif - ; source: test_uword_splitw_lte.p8:401 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_45_afterif - ; source: test_uword_splitw_lte.p8:404 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_47_else - ; source: test_uword_splitw_lte.p8:405 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_46_afterif -label_asm_47_else - ; source: test_uword_splitw_lte.p8:407 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_uword_splitw_lte.p8:410 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl8c - ; source: test_uword_splitw_lte.p8:412 goto skip8c - bra p8l_skip8c - ; source: test_uword_splitw_lte.p8:413 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:414 skip8c: -p8l_skip8c - ; source: test_uword_splitw_lte.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:417 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:419 goto skip8d - bra p8l_skip8d - ; source: test_uword_splitw_lte.p8:420 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:421 skip8d: -p8l_skip8d - ; source: test_uword_splitw_lte.p8:423 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_48_afterif - ; source: test_uword_splitw_lte.p8:424 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_48_afterif - ; source: test_uword_splitw_lte.p8:427 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_50_else - ; source: test_uword_splitw_lte.p8:428 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_49_afterif -label_asm_50_else - ; source: test_uword_splitw_lte.p8:430 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_uword_splitw_lte.p8:432 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_uword_splitw_lte.p8:433 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_uword_splitw_lte.p8:434 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:436 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl9a - ; source: test_uword_splitw_lte.p8:438 goto skip9a - bra p8l_skip9a - ; source: test_uword_splitw_lte.p8:439 lbl9a: fail_uword(9) -p8l_lbl9a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:440 skip9a: -p8l_skip9a - ; source: test_uword_splitw_lte.p8:442 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:443 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:445 goto skip9b - bra p8l_skip9b - ; source: test_uword_splitw_lte.p8:446 lbl9b: fail_uword(10) -p8l_lbl9b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:447 skip9b: -p8l_skip9b - ; source: test_uword_splitw_lte.p8:449 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_51_afterif - ; source: test_uword_splitw_lte.p8:450 fail_uword(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_uword -label_asm_51_afterif - ; source: test_uword_splitw_lte.p8:453 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_53_else - ; source: test_uword_splitw_lte.p8:454 fail_uword(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_uword - bra label_asm_52_afterif -label_asm_53_else - ; source: test_uword_splitw_lte.p8:456 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_52_afterif - ; source: test_uword_splitw_lte.p8:459 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl9c - ; source: test_uword_splitw_lte.p8:461 goto skip9c - bra p8l_skip9c - ; source: test_uword_splitw_lte.p8:462 lbl9c: fail_uword(13) -p8l_lbl9c - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:463 skip9c: -p8l_skip9c - ; source: test_uword_splitw_lte.p8:465 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:466 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:468 goto skip9d - bra p8l_skip9d - ; source: test_uword_splitw_lte.p8:469 lbl9d: fail_uword(14) -p8l_lbl9d - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:470 skip9d: -p8l_skip9d - ; source: test_uword_splitw_lte.p8:472 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_54_afterif - ; source: test_uword_splitw_lte.p8:473 fail_uword(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_uword -label_asm_54_afterif - ; source: test_uword_splitw_lte.p8:476 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_56_else - ; source: test_uword_splitw_lte.p8:477 fail_uword(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_uword - bra label_asm_55_afterif -label_asm_56_else - ; source: test_uword_splitw_lte.p8:479 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_55_afterif - ; source: test_uword_splitw_lte.p8:481 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:483 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl10a - ; source: test_uword_splitw_lte.p8:485 goto skip10a - bra p8l_skip10a - ; source: test_uword_splitw_lte.p8:486 lbl10a: fail_uword(17) -p8l_lbl10a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:487 skip10a: -p8l_skip10a - ; source: test_uword_splitw_lte.p8:489 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:490 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:492 goto skip10b - bra p8l_skip10b - ; source: test_uword_splitw_lte.p8:493 lbl10b: fail_uword(18) -p8l_lbl10b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:494 skip10b: -p8l_skip10b - ; source: test_uword_splitw_lte.p8:496 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_57_afterif - ; source: test_uword_splitw_lte.p8:497 fail_uword(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_uword -label_asm_57_afterif - ; source: test_uword_splitw_lte.p8:500 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_59_else - ; source: test_uword_splitw_lte.p8:501 fail_uword(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_uword - bra label_asm_58_afterif -label_asm_59_else - ; source: test_uword_splitw_lte.p8:503 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_58_afterif - ; source: test_uword_splitw_lte.p8:506 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl10c - ; source: test_uword_splitw_lte.p8:508 goto skip10c - bra p8l_skip10c - ; source: test_uword_splitw_lte.p8:509 lbl10c: fail_uword(21) -p8l_lbl10c - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:510 skip10c: -p8l_skip10c - ; source: test_uword_splitw_lte.p8:512 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:513 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:515 goto skip10d - bra p8l_skip10d - ; source: test_uword_splitw_lte.p8:516 lbl10d: fail_uword(22) -p8l_lbl10d - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:517 skip10d: -p8l_skip10d - ; source: test_uword_splitw_lte.p8:519 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_60_afterif - ; source: test_uword_splitw_lte.p8:520 fail_uword(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_uword -label_asm_60_afterif - ; source: test_uword_splitw_lte.p8:523 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_62_else - ; source: test_uword_splitw_lte.p8:524 fail_uword(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_uword - bra label_asm_61_afterif -label_asm_62_else - ; source: test_uword_splitw_lte.p8:526 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_61_afterif - ; source: test_uword_splitw_lte.p8:528 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:530 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl11a - ; source: test_uword_splitw_lte.p8:532 goto skip11a - bra p8l_skip11a - ; source: test_uword_splitw_lte.p8:533 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:534 skip11a: -p8l_skip11a - ; source: test_uword_splitw_lte.p8:536 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:537 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:539 goto skip11b - bra p8l_skip11b - ; source: test_uword_splitw_lte.p8:540 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:541 skip11b: -p8l_skip11b - ; source: test_uword_splitw_lte.p8:543 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_63_afterif - ; source: test_uword_splitw_lte.p8:544 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_63_afterif - ; source: test_uword_splitw_lte.p8:547 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_65_else - ; source: test_uword_splitw_lte.p8:548 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_64_afterif -label_asm_65_else - ; source: test_uword_splitw_lte.p8:550 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_uword_splitw_lte.p8:553 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl11c - ; source: test_uword_splitw_lte.p8:555 goto skip11c - bra p8l_skip11c - ; source: test_uword_splitw_lte.p8:556 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:557 skip11c: -p8l_skip11c - ; source: test_uword_splitw_lte.p8:559 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:560 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:562 goto skip11d - bra p8l_skip11d - ; source: test_uword_splitw_lte.p8:563 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:564 skip11d: -p8l_skip11d - ; source: test_uword_splitw_lte.p8:566 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_66_afterif - ; source: test_uword_splitw_lte.p8:567 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_66_afterif - ; source: test_uword_splitw_lte.p8:570 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_68_else - ; source: test_uword_splitw_lte.p8:571 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_67_afterif -label_asm_68_else - ; source: test_uword_splitw_lte.p8:573 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_uword_splitw_lte.p8:575 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:577 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl12a - ; source: test_uword_splitw_lte.p8:579 goto skip12a - bra p8l_skip12a - ; source: test_uword_splitw_lte.p8:580 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:581 skip12a: -p8l_skip12a - ; source: test_uword_splitw_lte.p8:583 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:584 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:586 goto skip12b - bra p8l_skip12b - ; source: test_uword_splitw_lte.p8:587 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:588 skip12b: -p8l_skip12b - ; source: test_uword_splitw_lte.p8:590 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_69_afterif - ; source: test_uword_splitw_lte.p8:591 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_69_afterif - ; source: test_uword_splitw_lte.p8:594 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_71_else - ; source: test_uword_splitw_lte.p8:595 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_70_afterif -label_asm_71_else - ; source: test_uword_splitw_lte.p8:597 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_uword_splitw_lte.p8:600 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl12c - ; source: test_uword_splitw_lte.p8:602 goto skip12c - bra p8l_skip12c - ; source: test_uword_splitw_lte.p8:603 lbl12c: success++ -p8l_lbl12c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:604 skip12c: -p8l_skip12c - ; source: test_uword_splitw_lte.p8:606 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:607 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:609 goto skip12d - bra p8l_skip12d - ; source: test_uword_splitw_lte.p8:610 lbl12d: success++ -p8l_lbl12d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:611 skip12d: -p8l_skip12d - ; source: test_uword_splitw_lte.p8:613 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_72_afterif - ; source: test_uword_splitw_lte.p8:614 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_72_afterif - ; source: test_uword_splitw_lte.p8:617 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_74_else - ; source: test_uword_splitw_lte.p8:618 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_73_afterif -label_asm_74_else - ; source: test_uword_splitw_lte.p8:620 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_uword_splitw_lte.p8:622 x=65535 - lda #$ff - sta p8v_x - sta p8v_x+1 - - ; source: test_uword_splitw_lte.p8:623 sources[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_sources_lsb,y - lda #>$ffff - sta p8v_sources_msb,y - ; source: test_uword_splitw_lte.p8:624 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:626 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl13a - ; source: test_uword_splitw_lte.p8:628 goto skip13a - bra p8l_skip13a - ; source: test_uword_splitw_lte.p8:629 lbl13a: fail_uword(25) -p8l_lbl13a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:630 skip13a: -p8l_skip13a - ; source: test_uword_splitw_lte.p8:632 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:633 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:635 goto skip13b - bra p8l_skip13b - ; source: test_uword_splitw_lte.p8:636 lbl13b: fail_uword(26) -p8l_lbl13b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:637 skip13b: -p8l_skip13b - ; source: test_uword_splitw_lte.p8:639 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_75_afterif - ; source: test_uword_splitw_lte.p8:640 fail_uword(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_uword -label_asm_75_afterif - ; source: test_uword_splitw_lte.p8:643 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_77_else - ; source: test_uword_splitw_lte.p8:644 fail_uword(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_uword - bra label_asm_76_afterif -label_asm_77_else - ; source: test_uword_splitw_lte.p8:646 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_76_afterif - ; source: test_uword_splitw_lte.p8:649 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl13c - ; source: test_uword_splitw_lte.p8:651 goto skip13c - bra p8l_skip13c - ; source: test_uword_splitw_lte.p8:652 lbl13c: fail_uword(29) -p8l_lbl13c - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:653 skip13c: -p8l_skip13c - ; source: test_uword_splitw_lte.p8:655 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:656 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:658 goto skip13d - bra p8l_skip13d - ; source: test_uword_splitw_lte.p8:659 lbl13d: fail_uword(30) -p8l_lbl13d - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:660 skip13d: -p8l_skip13d - ; source: test_uword_splitw_lte.p8:662 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_78_afterif - ; source: test_uword_splitw_lte.p8:663 fail_uword(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_uword -label_asm_78_afterif - ; source: test_uword_splitw_lte.p8:666 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_80_else - ; source: test_uword_splitw_lte.p8:667 fail_uword(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_uword - bra label_asm_79_afterif -label_asm_80_else - ; source: test_uword_splitw_lte.p8:669 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_79_afterif - ; source: test_uword_splitw_lte.p8:671 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:673 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl14a - ; source: test_uword_splitw_lte.p8:675 goto skip14a - bra p8l_skip14a - ; source: test_uword_splitw_lte.p8:676 lbl14a: fail_uword(33) -p8l_lbl14a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:677 skip14a: -p8l_skip14a - ; source: test_uword_splitw_lte.p8:679 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:680 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:682 goto skip14b - bra p8l_skip14b - ; source: test_uword_splitw_lte.p8:683 lbl14b: fail_uword(34) -p8l_lbl14b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:684 skip14b: -p8l_skip14b - ; source: test_uword_splitw_lte.p8:686 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_81_afterif - ; source: test_uword_splitw_lte.p8:687 fail_uword(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_uword -label_asm_81_afterif - ; source: test_uword_splitw_lte.p8:690 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_83_else - ; source: test_uword_splitw_lte.p8:691 fail_uword(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_uword - bra label_asm_82_afterif -label_asm_83_else - ; source: test_uword_splitw_lte.p8:693 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_82_afterif - ; source: test_uword_splitw_lte.p8:696 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl14c - ; source: test_uword_splitw_lte.p8:698 goto skip14c - bra p8l_skip14c - ; source: test_uword_splitw_lte.p8:699 lbl14c: fail_uword(37) -p8l_lbl14c - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:700 skip14c: -p8l_skip14c - ; source: test_uword_splitw_lte.p8:702 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:703 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:705 goto skip14d - bra p8l_skip14d - ; source: test_uword_splitw_lte.p8:706 lbl14d: fail_uword(38) -p8l_lbl14d - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:707 skip14d: -p8l_skip14d - ; source: test_uword_splitw_lte.p8:709 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_84_afterif - ; source: test_uword_splitw_lte.p8:710 fail_uword(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_uword -label_asm_84_afterif - ; source: test_uword_splitw_lte.p8:713 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_86_else - ; source: test_uword_splitw_lte.p8:714 fail_uword(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_uword - bra label_asm_85_afterif -label_asm_86_else - ; source: test_uword_splitw_lte.p8:716 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_85_afterif - ; source: test_uword_splitw_lte.p8:718 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:720 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl15a - ; source: test_uword_splitw_lte.p8:722 goto skip15a - bra p8l_skip15a - ; source: test_uword_splitw_lte.p8:723 lbl15a: fail_uword(41) -p8l_lbl15a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:724 skip15a: -p8l_skip15a - ; source: test_uword_splitw_lte.p8:726 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:727 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:729 goto skip15b - bra p8l_skip15b - ; source: test_uword_splitw_lte.p8:730 lbl15b: fail_uword(42) -p8l_lbl15b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:731 skip15b: -p8l_skip15b - ; source: test_uword_splitw_lte.p8:733 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_87_afterif - ; source: test_uword_splitw_lte.p8:734 fail_uword(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_uword -label_asm_87_afterif - ; source: test_uword_splitw_lte.p8:737 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_89_else - ; source: test_uword_splitw_lte.p8:738 fail_uword(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_uword - bra label_asm_88_afterif -label_asm_89_else - ; source: test_uword_splitw_lte.p8:740 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_88_afterif - ; source: test_uword_splitw_lte.p8:743 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl15c - ; source: test_uword_splitw_lte.p8:745 goto skip15c - bra p8l_skip15c - ; source: test_uword_splitw_lte.p8:746 lbl15c: fail_uword(45) -p8l_lbl15c - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:747 skip15c: -p8l_skip15c - ; source: test_uword_splitw_lte.p8:749 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:750 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:752 goto skip15d - bra p8l_skip15d - ; source: test_uword_splitw_lte.p8:753 lbl15d: fail_uword(46) -p8l_lbl15d - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_uword - ; source: test_uword_splitw_lte.p8:754 skip15d: -p8l_skip15d - ; source: test_uword_splitw_lte.p8:756 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_90_afterif - ; source: test_uword_splitw_lte.p8:757 fail_uword(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_uword -label_asm_90_afterif - ; source: test_uword_splitw_lte.p8:760 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_92_else - ; source: test_uword_splitw_lte.p8:761 fail_uword(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_uword - bra label_asm_91_afterif -label_asm_92_else - ; source: test_uword_splitw_lte.p8:763 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_91_afterif - ; source: test_uword_splitw_lte.p8:765 values[1]=65535 - ldy #1 - lda #<$ffff - sta p8v_values_lsb,y - lda #>$ffff - sta p8v_values_msb,y - ; source: test_uword_splitw_lte.p8:767 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcs p8l_lbl16a - ; source: test_uword_splitw_lte.p8:769 goto skip16a - bra p8l_skip16a - ; source: test_uword_splitw_lte.p8:770 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:771 skip16a: -p8l_skip16a - ; source: test_uword_splitw_lte.p8:773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:774 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:776 goto skip16b - bra p8l_skip16b - ; source: test_uword_splitw_lte.p8:777 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:778 skip16b: -p8l_skip16b - ; source: test_uword_splitw_lte.p8:780 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_93_afterif - ; source: test_uword_splitw_lte.p8:781 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_93_afterif - ; source: test_uword_splitw_lte.p8:784 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bcc label_asm_95_else - ; source: test_uword_splitw_lte.p8:785 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_94_afterif -label_asm_95_else - ; source: test_uword_splitw_lte.p8:787 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_uword_splitw_lte.p8:790 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcs p8l_lbl16c - ; source: test_uword_splitw_lte.p8:792 goto skip16c - bra p8l_skip16c - ; source: test_uword_splitw_lte.p8:793 lbl16c: success++ -p8l_lbl16c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:794 skip16c: -p8l_skip16c - ; source: test_uword_splitw_lte.p8:796 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_uword_splitw_lte.p8:797 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc + - jmp (cx16.r3) -+ - ; source: test_uword_splitw_lte.p8:799 goto skip16d - bra p8l_skip16d - ; source: test_uword_splitw_lte.p8:800 lbl16d: success++ -p8l_lbl16d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_uword_splitw_lte.p8:801 skip16d: -p8l_skip16d - ; source: test_uword_splitw_lte.p8:803 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_96_afterif - ; source: test_uword_splitw_lte.p8:804 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_96_afterif - ; source: test_uword_splitw_lte.p8:807 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bcc label_asm_98_else - ; source: test_uword_splitw_lte.p8:808 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_97_afterif -label_asm_98_else - ; source: test_uword_splitw_lte.p8:810 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_uword_splitw_lte.p8:812 verify_success(92) - ldy #>$5c - lda #<$5c - jmp p8b_main.p8s_verify_success - ; source: test_uword_splitw_lte.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .word ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal split words array tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $53, $50, $4c, $49 - .byte $54, $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_4 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_5 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_6 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_7 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 - - ; source: test_uword_splitw_lte.p8:14 txt.print("\nless-equal split words array tests for: ") - ; source: test_uword_splitw_lte.p8:18 txt.print("\n<=array[]: ") - ; source: test_uword_splitw_lte.p8:27 txt.print(" **failed** ") - ; source: test_uword_splitw_lte.p8:29 txt.print(" success, expected ") - ; source: test_uword_splitw_lte.p8:35 txt.print(" **fail#") - ; source: test_uword_splitw_lte.p8:37 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_uword_splitw_lte.p8 b/compiler/test/comparisons/test_uword_splitw_lte.p8 deleted file mode 100644 index eb05a53f5..000000000 --- a/compiler/test/comparisons/test_uword_splitw_lte.p8 +++ /dev/null @@ -1,816 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "uword" - uword @shared comparison - - sub start() { - txt.print("\nless-equal split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=array[]: ") - test_cmp_array() - test_stack.test() - } - - sub verify_success(uword expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_uw(success) - txt.print(" success, expected ") - txt.print_uw(expected) - } - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_array() { - uword @shared x - uword[] @split values = [0, 0] - uword[] @split sources = [0, 0] - success = 0 - x=0 - sources[1]=0 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]<=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]<=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]<=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]<=values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=1 - sources[1]=1 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl5a - goto skip5a -lbl5a: fail_uword(1) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_uword(2) -skip5b: - ; no else - if x<=values[1] - fail_uword(3) - - ; with else - if x<=values[1] - fail_uword(4) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl5c - goto skip5c -lbl5c: fail_uword(5) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]<=values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_uword(6) -skip5d: - ; no else - if sources[1]<=values[1] - fail_uword(7) - - ; with else - if sources[1]<=values[1] - fail_uword(8) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]<=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl7c - goto skip7c -lbl7c: success++ -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]<=values[1] - goto cx16.r3 - goto skip7d -lbl7d: success++ -skip7d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]<=values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=30464 - sources[1]=30464 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl9a - goto skip9a -lbl9a: fail_uword(9) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_uword(10) -skip9b: - ; no else - if x<=values[1] - fail_uword(11) - - ; with else - if x<=values[1] - fail_uword(12) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl9c - goto skip9c -lbl9c: fail_uword(13) -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]<=values[1] - goto cx16.r3 - goto skip9d -lbl9d: fail_uword(14) -skip9d: - ; no else - if sources[1]<=values[1] - fail_uword(15) - - ; with else - if sources[1]<=values[1] - fail_uword(16) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_uword(17) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_uword(18) -skip10b: - ; no else - if x<=values[1] - fail_uword(19) - - ; with else - if x<=values[1] - fail_uword(20) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl10c - goto skip10c -lbl10c: fail_uword(21) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]<=values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_uword(22) -skip10d: - ; no else - if sources[1]<=values[1] - fail_uword(23) - - ; with else - if sources[1]<=values[1] - fail_uword(24) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]<=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl12c - goto skip12c -lbl12c: success++ -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]<=values[1] - goto cx16.r3 - goto skip12d -lbl12d: success++ -skip12d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=65535 - sources[1]=65535 - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl13a - goto skip13a -lbl13a: fail_uword(25) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_uword(26) -skip13b: - ; no else - if x<=values[1] - fail_uword(27) - - ; with else - if x<=values[1] - fail_uword(28) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl13c - goto skip13c -lbl13c: fail_uword(29) -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]<=values[1] - goto cx16.r3 - goto skip13d -lbl13d: fail_uword(30) -skip13d: - ; no else - if sources[1]<=values[1] - fail_uword(31) - - ; with else - if sources[1]<=values[1] - fail_uword(32) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl14a - goto skip14a -lbl14a: fail_uword(33) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_uword(34) -skip14b: - ; no else - if x<=values[1] - fail_uword(35) - - ; with else - if x<=values[1] - fail_uword(36) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl14c - goto skip14c -lbl14c: fail_uword(37) -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]<=values[1] - goto cx16.r3 - goto skip14d -lbl14d: fail_uword(38) -skip14d: - ; no else - if sources[1]<=values[1] - fail_uword(39) - - ; with else - if sources[1]<=values[1] - fail_uword(40) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_uword(41) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_uword(42) -skip15b: - ; no else - if x<=values[1] - fail_uword(43) - - ; with else - if x<=values[1] - fail_uword(44) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl15c - goto skip15c -lbl15c: fail_uword(45) -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]<=values[1] - goto cx16.r3 - goto skip15d -lbl15d: fail_uword(46) -skip15d: - ; no else - if sources[1]<=values[1] - fail_uword(47) - - ; with else - if sources[1]<=values[1] - fail_uword(48) - else - success++ - - values[1]=65535 - ; direct jump - if x<=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl16c - goto skip16c -lbl16c: success++ -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]<=values[1] - goto cx16.r3 - goto skip16d -lbl16d: success++ -skip16d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - verify_success(92) -} - -} - diff --git a/compiler/test/comparisons/test_word_equalities.asm b/compiler/test/comparisons/test_word_equalities.asm deleted file mode 100644 index e849830d9..000000000 --- a/compiler/test/comparisons/test_word_equalities.asm +++ /dev/null @@ -1,26435 +0,0 @@ -; w65c02 assembly code for 'test_word_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:45 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_equalities.p8:9 ubyte success = 0 - ; source: test_word_equalities.p8:10 str datatype = "word" - ; source: test_word_equalities.p8:11 uword @shared comparison - ; source: test_word_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:107 if x==0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:109 goto skip2 - bra p8l_skip2 - ; source: test_word_equalities.p8:110 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:111 skip2: -p8l_skip2 - ; source: test_word_equalities.p8:113 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_3_afterif - ; source: test_word_equalities.p8:114 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_word_equalities.p8:117 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_5_else - ; source: test_word_equalities.p8:118 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_equalities.p8:120 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_word_equalities.p8:122 x = -9999 - lda #<-$270f - ldy #>-$270f - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:124 if x==0 - ora p8v_x+1 - beq p8l_skip3 - ; source: test_word_equalities.p8:126 success++ - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:127 skip3: -p8l_skip3 - ; source: test_word_equalities.p8:129 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:130 if x==0 - lda p8v_x - ora p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:132 success++ - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:133 skip4: -p8l_skip4 - ; source: test_word_equalities.p8:135 success++ - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:136 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_6_afterif - ; source: test_word_equalities.p8:137 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_word_equalities.p8:140 if x==0 - lda p8v_x - ora p8v_x+1 - bne label_asm_8_else - ; source: test_word_equalities.p8:141 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_equalities.p8:143 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_word_equalities.p8:145 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:94 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:149 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_word_equalities.p8:150 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:151 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:153 x=-9999 - lda #<-$270f - ldy #>-$270f - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:155 if x!=0 - ora p8v_x+1 - bne p8l_lbl1 - ; source: test_word_equalities.p8:157 goto skip1 - bra p8l_skip1 - ; source: test_word_equalities.p8:158 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:159 skip1: -p8l_skip1 - ; source: test_word_equalities.p8:161 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:162 if x!=0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:164 goto skip2 - bra p8l_skip2 - ; source: test_word_equalities.p8:165 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:166 skip2: -p8l_skip2 - ; source: test_word_equalities.p8:168 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_9_afterif - ; source: test_word_equalities.p8:169 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_word_equalities.p8:172 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_11_else - ; source: test_word_equalities.p8:173 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_equalities.p8:175 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_word_equalities.p8:177 x = 0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:179 if x!=0 - lda p8v_x - ora p8v_x+1 - bne p8l_skip3 - ; source: test_word_equalities.p8:181 success++ - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:182 skip3: -p8l_skip3 - ; source: test_word_equalities.p8:184 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:185 if x!=0 - lda p8v_x - ora p8v_x+1 - beq + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:187 success++ - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:188 skip4: -p8l_skip4 - ; source: test_word_equalities.p8:190 success++ - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:191 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_12_afterif - ; source: test_word_equalities.p8:192 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_word_equalities.p8:195 if x!=0 - lda p8v_x - ora p8v_x+1 - beq label_asm_14_else - ; source: test_word_equalities.p8:196 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_equalities.p8:198 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_word_equalities.p8:200 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:149 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:203 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_word_equalities.p8:204 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:205 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:206 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:208 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - beq p8l_lbl1a -+ - ; source: test_word_equalities.p8:210 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:211 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:212 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:214 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:215 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:217 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:218 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:219 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:221 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_15_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_15_afterif - ; source: test_word_equalities.p8:222 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_word_equalities.p8:225 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_17_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_17_else - ; source: test_word_equalities.p8:226 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_equalities.p8:228 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_word_equalities.p8:231 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - beq p8l_lbl2a -+ - ; source: test_word_equalities.p8:233 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:234 lbl2a: fail_word(1,-21829) -p8l_lbl2a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:235 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:237 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:238 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:240 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:241 lbl2b: fail_word(2,-21829) -p8l_lbl2b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:242 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:244 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_18_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_18_afterif - ; source: test_word_equalities.p8:245 fail_word(3,-21829) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_18_afterif - ; source: test_word_equalities.p8:248 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_20_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_20_else - ; source: test_word_equalities.p8:249 fail_word(4,-21829) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_equalities.p8:251 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_word_equalities.p8:254 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl3a -+ - ; source: test_word_equalities.p8:256 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:257 lbl3a: fail_word(5,-21829) -p8l_lbl3a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:258 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:260 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:261 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:263 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:264 lbl3b: fail_word(6,-21829) -p8l_lbl3b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:265 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:267 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_21_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_21_afterif - ; source: test_word_equalities.p8:268 fail_word(7,-21829) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_21_afterif - ; source: test_word_equalities.p8:271 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_23_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_23_else - ; source: test_word_equalities.p8:272 fail_word(8,-21829) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_equalities.p8:274 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_word_equalities.p8:277 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - beq p8l_lbl4a -+ - ; source: test_word_equalities.p8:279 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:280 lbl4a: fail_word(9,-21829) -p8l_lbl4a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:281 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:283 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:284 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:286 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:287 lbl4b: fail_word(10,-21829) -p8l_lbl4b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:288 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:290 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_24_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_24_afterif - ; source: test_word_equalities.p8:291 fail_word(11,-21829) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_24_afterif - ; source: test_word_equalities.p8:294 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_26_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_26_else - ; source: test_word_equalities.p8:295 fail_word(12,-21829) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_equalities.p8:297 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_word_equalities.p8:299 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:301 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - beq p8l_lbl5a -+ - ; source: test_word_equalities.p8:303 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:304 lbl5a: fail_word(13,0) -p8l_lbl5a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:305 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:307 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:308 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:310 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:311 lbl5b: fail_word(14,0) -p8l_lbl5b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:312 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:314 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_27_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_27_afterif - ; source: test_word_equalities.p8:315 fail_word(15,0) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_27_afterif - ; source: test_word_equalities.p8:318 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_29_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_29_else - ; source: test_word_equalities.p8:319 fail_word(16,0) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_equalities.p8:321 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_word_equalities.p8:324 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - beq p8l_lbl6a -+ - ; source: test_word_equalities.p8:326 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:327 lbl6a: fail_word(17,0) -p8l_lbl6a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:328 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:330 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:331 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:333 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:334 lbl6b: fail_word(18,0) -p8l_lbl6b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:335 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:337 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_30_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_30_afterif - ; source: test_word_equalities.p8:338 fail_word(19,0) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_30_afterif - ; source: test_word_equalities.p8:341 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_32_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_32_else - ; source: test_word_equalities.p8:342 fail_word(20,0) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_equalities.p8:344 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_word_equalities.p8:347 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl7a -+ - ; source: test_word_equalities.p8:349 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:350 lbl7a: fail_word(21,0) -p8l_lbl7a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:351 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:353 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:354 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:356 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:357 lbl7b: fail_word(22,0) -p8l_lbl7b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:358 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:360 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_33_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_33_afterif - ; source: test_word_equalities.p8:361 fail_word(23,0) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_33_afterif - ; source: test_word_equalities.p8:364 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_35_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_35_else - ; source: test_word_equalities.p8:365 fail_word(24,0) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_equalities.p8:367 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_word_equalities.p8:370 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - beq p8l_lbl8a -+ - ; source: test_word_equalities.p8:372 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:373 lbl8a: fail_word(25,0) -p8l_lbl8a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:374 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:376 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:377 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:379 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:380 lbl8b: fail_word(26,0) -p8l_lbl8b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:381 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:383 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_36_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_36_afterif - ; source: test_word_equalities.p8:384 fail_word(27,0) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_36_afterif - ; source: test_word_equalities.p8:387 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_38_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_38_else - ; source: test_word_equalities.p8:388 fail_word(28,0) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_equalities.p8:390 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_word_equalities.p8:392 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:394 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - beq p8l_lbl9a -+ - ; source: test_word_equalities.p8:396 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:397 lbl9a: fail_word(29,170) -p8l_lbl9a - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:398 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:400 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:401 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:403 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:404 lbl9b: fail_word(30,170) -p8l_lbl9b - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:405 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:407 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_39_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_39_afterif - ; source: test_word_equalities.p8:408 fail_word(31,170) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_39_afterif - ; source: test_word_equalities.p8:411 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_41_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_41_else - ; source: test_word_equalities.p8:412 fail_word(32,170) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_equalities.p8:414 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_word_equalities.p8:417 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - beq p8l_lbl10a -+ - ; source: test_word_equalities.p8:419 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:420 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:421 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:423 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:424 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:426 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:427 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:428 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:430 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_42_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_42_afterif - ; source: test_word_equalities.p8:431 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_word_equalities.p8:434 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_44_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_44_else - ; source: test_word_equalities.p8:435 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_equalities.p8:437 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_word_equalities.p8:440 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl11a -+ - ; source: test_word_equalities.p8:442 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:443 lbl11a: fail_word(33,170) -p8l_lbl11a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:444 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:446 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:447 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:449 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:450 lbl11b: fail_word(34,170) -p8l_lbl11b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:451 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:453 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_45_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_45_afterif - ; source: test_word_equalities.p8:454 fail_word(35,170) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_45_afterif - ; source: test_word_equalities.p8:457 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_47_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_47_else - ; source: test_word_equalities.p8:458 fail_word(36,170) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_equalities.p8:460 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_word_equalities.p8:463 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - beq p8l_lbl12a -+ - ; source: test_word_equalities.p8:465 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:466 lbl12a: fail_word(37,170) -p8l_lbl12a - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:467 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:469 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:470 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:472 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:473 lbl12b: fail_word(38,170) -p8l_lbl12b - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:474 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:476 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_48_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_48_afterif - ; source: test_word_equalities.p8:477 fail_word(39,170) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_48_afterif - ; source: test_word_equalities.p8:480 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_50_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_50_else - ; source: test_word_equalities.p8:481 fail_word(40,170) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_equalities.p8:483 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_word_equalities.p8:485 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:487 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - beq p8l_lbl13a -+ - ; source: test_word_equalities.p8:489 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:490 lbl13a: fail_word(41,30464) -p8l_lbl13a - lda #<$29 - ldy #>$29 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:491 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:493 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:494 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:496 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:497 lbl13b: fail_word(42,30464) -p8l_lbl13b - lda #<$2a - ldy #>$2a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:498 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:500 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_51_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_51_afterif - ; source: test_word_equalities.p8:501 fail_word(43,30464) - lda #<$2b - ldy #>$2b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_51_afterif - ; source: test_word_equalities.p8:504 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_53_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_53_else - ; source: test_word_equalities.p8:505 fail_word(44,30464) - lda #<$2c - ldy #>$2c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_equalities.p8:507 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_word_equalities.p8:510 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - beq p8l_lbl14a -+ - ; source: test_word_equalities.p8:512 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:513 lbl14a: fail_word(45,30464) -p8l_lbl14a - lda #<$2d - ldy #>$2d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:514 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:516 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:517 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:519 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:520 lbl14b: fail_word(46,30464) -p8l_lbl14b - lda #<$2e - ldy #>$2e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:521 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:523 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_54_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_54_afterif - ; source: test_word_equalities.p8:524 fail_word(47,30464) - lda #<$2f - ldy #>$2f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_54_afterif - ; source: test_word_equalities.p8:527 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_56_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_56_else - ; source: test_word_equalities.p8:528 fail_word(48,30464) - lda #<$30 - ldy #>$30 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_equalities.p8:530 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_word_equalities.p8:533 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl15a -+ - ; source: test_word_equalities.p8:535 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:536 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:537 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:539 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:540 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:542 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:543 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:544 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:546 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_57_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_57_afterif - ; source: test_word_equalities.p8:547 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_word_equalities.p8:550 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_59_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_59_else - ; source: test_word_equalities.p8:551 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_equalities.p8:553 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_word_equalities.p8:556 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - beq p8l_lbl16a -+ - ; source: test_word_equalities.p8:558 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:559 lbl16a: fail_word(49,30464) -p8l_lbl16a - lda #<$31 - ldy #>$31 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:560 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:562 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:563 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:565 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:566 lbl16b: fail_word(50,30464) -p8l_lbl16b - lda #<$32 - ldy #>$32 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:567 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:569 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_60_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_60_afterif - ; source: test_word_equalities.p8:570 fail_word(51,30464) - lda #<$33 - ldy #>$33 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_60_afterif - ; source: test_word_equalities.p8:573 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_62_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_62_else - ; source: test_word_equalities.p8:574 fail_word(52,30464) - lda #<$34 - ldy #>$34 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_equalities.p8:576 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_word_equalities.p8:578 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:580 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - beq p8l_lbl17a -+ - ; source: test_word_equalities.p8:582 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:583 lbl17a: fail_word(53,32767) -p8l_lbl17a - lda #<$35 - ldy #>$35 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:584 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:586 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:587 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:589 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:590 lbl17b: fail_word(54,32767) -p8l_lbl17b - lda #<$36 - ldy #>$36 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:591 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:593 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_63_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_63_afterif - ; source: test_word_equalities.p8:594 fail_word(55,32767) - lda #<$37 - ldy #>$37 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_63_afterif - ; source: test_word_equalities.p8:597 if x==-21829 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<-21829 - bne label_asm_65_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>-21829 - bne label_asm_65_else - ; source: test_word_equalities.p8:598 fail_word(56,32767) - lda #<$38 - ldy #>$38 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_equalities.p8:600 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_word_equalities.p8:603 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - beq p8l_lbl18a -+ - ; source: test_word_equalities.p8:605 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:606 lbl18a: fail_word(57,32767) -p8l_lbl18a - lda #<$39 - ldy #>$39 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:607 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:609 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:610 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:612 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:613 lbl18b: fail_word(58,32767) -p8l_lbl18b - lda #<$3a - ldy #>$3a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:614 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:616 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_66_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_66_afterif - ; source: test_word_equalities.p8:617 fail_word(59,32767) - lda #<$3b - ldy #>$3b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_66_afterif - ; source: test_word_equalities.p8:620 if x==170 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<170 - bne label_asm_68_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>170 - bne label_asm_68_else - ; source: test_word_equalities.p8:621 fail_word(60,32767) - lda #<$3c - ldy #>$3c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_equalities.p8:623 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_word_equalities.p8:626 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - beq p8l_lbl19a -+ - ; source: test_word_equalities.p8:628 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:629 lbl19a: fail_word(61,32767) -p8l_lbl19a - lda #<$3d - ldy #>$3d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:630 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:632 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:633 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:635 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:636 lbl19b: fail_word(62,32767) -p8l_lbl19b - lda #<$3e - ldy #>$3e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:637 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:639 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_69_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_69_afterif - ; source: test_word_equalities.p8:640 fail_word(63,32767) - lda #<$3f - ldy #>$3f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_69_afterif - ; source: test_word_equalities.p8:643 if x==30464 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<30464 - bne label_asm_71_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>30464 - bne label_asm_71_else - ; source: test_word_equalities.p8:644 fail_word(64,32767) - lda #<$40 - ldy #>$40 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_equalities.p8:646 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_word_equalities.p8:649 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - beq p8l_lbl20a -+ - ; source: test_word_equalities.p8:651 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:652 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:653 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:655 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:656 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:658 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:659 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:660 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:662 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_72_afterif - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_72_afterif - ; source: test_word_equalities.p8:663 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_word_equalities.p8:666 if x==32767 - lda p8b_main.p8s_test_is_number.p8v_x - cmp #<32767 - bne label_asm_74_else - lda p8b_main.p8s_test_is_number.p8v_x+1 - cmp #>32767 - bne label_asm_74_else - ; source: test_word_equalities.p8:667 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_equalities.p8:669 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_word_equalities.p8:671 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:203 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:673 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_word_equalities.p8:674 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:675 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:676 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:678 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne p8l_lbl1a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - bne p8l_lbl1a - ; source: test_word_equalities.p8:680 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:681 lbl1a: fail_word(65,-21829) -p8l_lbl1a - lda #<$41 - ldy #>$41 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:682 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:684 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:685 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:687 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:688 lbl1b: fail_word(66,-21829) -p8l_lbl1b - lda #<$42 - ldy #>$42 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:689 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:691 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_75_afterif -+ - ; source: test_word_equalities.p8:692 fail_word(67,-21829) - lda #<$43 - ldy #>$43 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_75_afterif - ; source: test_word_equalities.p8:695 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_77_else -+ - ; source: test_word_equalities.p8:696 fail_word(68,-21829) - lda #<$44 - ldy #>$44 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_equalities.p8:698 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_word_equalities.p8:701 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne p8l_lbl2a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - bne p8l_lbl2a - ; source: test_word_equalities.p8:703 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:704 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:705 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:707 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:708 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:710 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:711 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:712 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:714 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_78_afterif -+ - ; source: test_word_equalities.p8:715 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_word_equalities.p8:718 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_80_else -+ - ; source: test_word_equalities.p8:719 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_equalities.p8:721 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_word_equalities.p8:724 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl3a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl3a - ; source: test_word_equalities.p8:726 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:727 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:728 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:730 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:731 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:733 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:734 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:735 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:737 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_81_afterif -+ - ; source: test_word_equalities.p8:738 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_word_equalities.p8:741 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_83_else -+ - ; source: test_word_equalities.p8:742 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_equalities.p8:744 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_word_equalities.p8:747 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne p8l_lbl4a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - bne p8l_lbl4a - ; source: test_word_equalities.p8:749 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:750 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:751 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:753 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:754 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:756 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:757 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:758 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:760 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_84_afterif -+ - ; source: test_word_equalities.p8:761 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_word_equalities.p8:764 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_86_else -+ - ; source: test_word_equalities.p8:765 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_equalities.p8:767 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_word_equalities.p8:769 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:771 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne p8l_lbl5a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - bne p8l_lbl5a - ; source: test_word_equalities.p8:773 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:774 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:775 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:777 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:778 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:780 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:781 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:782 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:784 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_87_afterif -+ - ; source: test_word_equalities.p8:785 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_word_equalities.p8:788 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_89_else -+ - ; source: test_word_equalities.p8:789 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_equalities.p8:791 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_word_equalities.p8:794 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne p8l_lbl6a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - bne p8l_lbl6a - ; source: test_word_equalities.p8:796 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:797 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:798 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:800 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:801 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:803 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:804 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:805 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:807 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_90_afterif -+ - ; source: test_word_equalities.p8:808 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_word_equalities.p8:811 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_92_else -+ - ; source: test_word_equalities.p8:812 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_equalities.p8:814 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_word_equalities.p8:817 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl7a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl7a - ; source: test_word_equalities.p8:819 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:820 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:821 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:823 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:824 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:826 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:827 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:828 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:830 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_93_afterif -+ - ; source: test_word_equalities.p8:831 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_word_equalities.p8:834 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_95_else -+ - ; source: test_word_equalities.p8:835 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_equalities.p8:837 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_word_equalities.p8:840 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne p8l_lbl8a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - bne p8l_lbl8a - ; source: test_word_equalities.p8:842 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:843 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:844 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:846 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:847 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:849 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:850 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:851 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:853 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_96_afterif -+ - ; source: test_word_equalities.p8:854 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_word_equalities.p8:857 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_98_else -+ - ; source: test_word_equalities.p8:858 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_equalities.p8:860 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_word_equalities.p8:862 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:864 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne p8l_lbl9a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - bne p8l_lbl9a - ; source: test_word_equalities.p8:866 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:867 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:868 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:870 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:871 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:873 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:874 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:875 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:877 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_99_afterif -+ - ; source: test_word_equalities.p8:878 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_word_equalities.p8:881 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_101_else -+ - ; source: test_word_equalities.p8:882 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_equalities.p8:884 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_word_equalities.p8:887 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne p8l_lbl10a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - bne p8l_lbl10a - ; source: test_word_equalities.p8:889 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:890 lbl10a: fail_word(69,170) -p8l_lbl10a - lda #<$45 - ldy #>$45 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:891 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:893 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:894 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:896 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:897 lbl10b: fail_word(70,170) -p8l_lbl10b - lda #<$46 - ldy #>$46 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:898 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:900 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_102_afterif -+ - ; source: test_word_equalities.p8:901 fail_word(71,170) - lda #<$47 - ldy #>$47 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_102_afterif - ; source: test_word_equalities.p8:904 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_104_else -+ - ; source: test_word_equalities.p8:905 fail_word(72,170) - lda #<$48 - ldy #>$48 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_equalities.p8:907 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_word_equalities.p8:910 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl11a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl11a - ; source: test_word_equalities.p8:912 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:913 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:914 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:916 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:917 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:919 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:920 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:921 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:923 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_105_afterif -+ - ; source: test_word_equalities.p8:924 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_word_equalities.p8:927 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_107_else -+ - ; source: test_word_equalities.p8:928 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_equalities.p8:930 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_word_equalities.p8:933 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne p8l_lbl12a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - bne p8l_lbl12a - ; source: test_word_equalities.p8:935 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:936 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:937 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:939 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:940 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:942 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:943 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:944 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:946 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_108_afterif -+ - ; source: test_word_equalities.p8:947 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_word_equalities.p8:950 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_110_else -+ - ; source: test_word_equalities.p8:951 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_equalities.p8:953 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_word_equalities.p8:955 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:957 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne p8l_lbl13a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - bne p8l_lbl13a - ; source: test_word_equalities.p8:959 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:960 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:961 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:963 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:964 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:966 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:967 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:968 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:970 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_111_afterif -+ - ; source: test_word_equalities.p8:971 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_word_equalities.p8:974 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_113_else -+ - ; source: test_word_equalities.p8:975 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_equalities.p8:977 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_word_equalities.p8:980 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne p8l_lbl14a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - bne p8l_lbl14a - ; source: test_word_equalities.p8:982 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:983 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:984 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:986 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:987 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:989 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:990 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:991 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:993 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_114_afterif -+ - ; source: test_word_equalities.p8:994 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_word_equalities.p8:997 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_116_else -+ - ; source: test_word_equalities.p8:998 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_equalities.p8:1000 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_word_equalities.p8:1003 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl15a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl15a - ; source: test_word_equalities.p8:1005 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:1006 lbl15a: fail_word(73,30464) -p8l_lbl15a - lda #<$49 - ldy #>$49 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1007 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:1009 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1010 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1012 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:1013 lbl15b: fail_word(74,30464) -p8l_lbl15b - lda #<$4a - ldy #>$4a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1014 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:1016 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_117_afterif -+ - ; source: test_word_equalities.p8:1017 fail_word(75,30464) - lda #<$4b - ldy #>$4b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_117_afterif - ; source: test_word_equalities.p8:1020 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_119_else -+ - ; source: test_word_equalities.p8:1021 fail_word(76,30464) - lda #<$4c - ldy #>$4c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_equalities.p8:1023 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_word_equalities.p8:1026 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne p8l_lbl16a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - bne p8l_lbl16a - ; source: test_word_equalities.p8:1028 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:1029 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1030 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:1032 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1033 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1035 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:1036 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1037 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:1039 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_120_afterif -+ - ; source: test_word_equalities.p8:1040 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_word_equalities.p8:1043 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_122_else -+ - ; source: test_word_equalities.p8:1044 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_equalities.p8:1046 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_word_equalities.p8:1048 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1050 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne p8l_lbl17a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - bne p8l_lbl17a - ; source: test_word_equalities.p8:1052 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:1053 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1054 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:1056 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1057 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1059 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:1060 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1061 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:1063 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_123_afterif -+ - ; source: test_word_equalities.p8:1064 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_word_equalities.p8:1067 if x!=-21829 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<-21829 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>-21829 - beq label_asm_125_else -+ - ; source: test_word_equalities.p8:1068 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_equalities.p8:1070 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_word_equalities.p8:1073 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne p8l_lbl18a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - bne p8l_lbl18a - ; source: test_word_equalities.p8:1075 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:1076 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1077 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:1079 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1080 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1082 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:1083 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1084 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:1086 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_126_afterif -+ - ; source: test_word_equalities.p8:1087 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_word_equalities.p8:1090 if x!=170 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<170 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>170 - beq label_asm_128_else -+ - ; source: test_word_equalities.p8:1091 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_equalities.p8:1093 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_word_equalities.p8:1096 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne p8l_lbl19a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - bne p8l_lbl19a - ; source: test_word_equalities.p8:1098 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:1099 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1100 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:1102 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1103 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1105 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:1106 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1107 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:1109 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_129_afterif -+ - ; source: test_word_equalities.p8:1110 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_word_equalities.p8:1113 if x!=30464 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<30464 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>30464 - beq label_asm_131_else -+ - ; source: test_word_equalities.p8:1114 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_equalities.p8:1116 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_word_equalities.p8:1119 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne p8l_lbl20a - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - bne p8l_lbl20a - ; source: test_word_equalities.p8:1121 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:1122 lbl20a: fail_word(77,32767) -p8l_lbl20a - lda #<$4d - ldy #>$4d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1123 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:1125 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1126 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1128 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:1129 lbl20b: fail_word(78,32767) -p8l_lbl20b - lda #<$4e - ldy #>$4e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1130 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:1132 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_132_afterif -+ - ; source: test_word_equalities.p8:1133 fail_word(79,32767) - lda #<$4f - ldy #>$4f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_132_afterif - ; source: test_word_equalities.p8:1136 if x!=32767 - lda p8b_main.p8s_test_not_number.p8v_x - cmp #<32767 - bne + - lda p8b_main.p8s_test_not_number.p8v_x+1 - cmp #>32767 - beq label_asm_134_else -+ - ; source: test_word_equalities.p8:1137 fail_word(80,32767) - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_equalities.p8:1139 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_word_equalities.p8:1141 verify_success(64) - lda #$40 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:673 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:1143 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_word_equalities.p8:1144 word @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_word_equalities.p8:1145 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:1146 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1147 value=-21829 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1149 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl1a -+ - ; source: test_word_equalities.p8:1151 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:1152 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1153 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:1155 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1156 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1158 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:1159 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1160 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:1162 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_135_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_135_afterif - ; source: test_word_equalities.p8:1163 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_word_equalities.p8:1166 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_137_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_137_else - ; source: test_word_equalities.p8:1167 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_equalities.p8:1169 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_word_equalities.p8:1171 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1173 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl2a -+ - ; source: test_word_equalities.p8:1175 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:1176 lbl2a: fail_word(81,-21829) -p8l_lbl2a - lda #<$51 - ldy #>$51 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1177 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:1179 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1180 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1182 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:1183 lbl2b: fail_word(82,-21829) -p8l_lbl2b - lda #<$52 - ldy #>$52 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1184 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:1186 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_138_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_138_afterif - ; source: test_word_equalities.p8:1187 fail_word(83,-21829) - lda #<$53 - ldy #>$53 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_138_afterif - ; source: test_word_equalities.p8:1190 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_140_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_140_else - ; source: test_word_equalities.p8:1191 fail_word(84,-21829) - lda #<$54 - ldy #>$54 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_equalities.p8:1193 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_word_equalities.p8:1195 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1197 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl3a -+ - ; source: test_word_equalities.p8:1199 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:1200 lbl3a: fail_word(85,-21829) -p8l_lbl3a - lda #<$55 - ldy #>$55 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1201 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:1203 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1204 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1206 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:1207 lbl3b: fail_word(86,-21829) -p8l_lbl3b - lda #<$56 - ldy #>$56 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1208 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:1210 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_141_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_141_afterif - ; source: test_word_equalities.p8:1211 fail_word(87,-21829) - lda #<$57 - ldy #>$57 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_141_afterif - ; source: test_word_equalities.p8:1214 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_143_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_143_else - ; source: test_word_equalities.p8:1215 fail_word(88,-21829) - lda #<$58 - ldy #>$58 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_equalities.p8:1217 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_word_equalities.p8:1219 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1221 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl4a -+ - ; source: test_word_equalities.p8:1223 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:1224 lbl4a: fail_word(89,-21829) -p8l_lbl4a - lda #<$59 - ldy #>$59 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1225 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:1227 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1228 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1230 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:1231 lbl4b: fail_word(90,-21829) -p8l_lbl4b - lda #<$5a - ldy #>$5a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1232 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:1234 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_144_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_144_afterif - ; source: test_word_equalities.p8:1235 fail_word(91,-21829) - lda #<$5b - ldy #>$5b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_144_afterif - ; source: test_word_equalities.p8:1238 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_146_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_146_else - ; source: test_word_equalities.p8:1239 fail_word(92,-21829) - lda #<$5c - ldy #>$5c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_equalities.p8:1241 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_word_equalities.p8:1243 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:1244 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1246 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl5a -+ - ; source: test_word_equalities.p8:1248 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:1249 lbl5a: fail_word(93,0) -p8l_lbl5a - lda #<$5d - ldy #>$5d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1250 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:1252 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1253 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1255 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:1256 lbl5b: fail_word(94,0) -p8l_lbl5b - lda #<$5e - ldy #>$5e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1257 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:1259 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_147_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_147_afterif - ; source: test_word_equalities.p8:1260 fail_word(95,0) - lda #<$5f - ldy #>$5f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_147_afterif - ; source: test_word_equalities.p8:1263 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_149_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_149_else - ; source: test_word_equalities.p8:1264 fail_word(96,0) - lda #<$60 - ldy #>$60 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_equalities.p8:1266 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_word_equalities.p8:1268 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1270 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl6a -+ - ; source: test_word_equalities.p8:1272 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:1273 lbl6a: fail_word(97,0) -p8l_lbl6a - lda #<$61 - ldy #>$61 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1274 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:1276 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1277 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1279 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:1280 lbl6b: fail_word(98,0) -p8l_lbl6b - lda #<$62 - ldy #>$62 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1281 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:1283 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_150_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_150_afterif - ; source: test_word_equalities.p8:1284 fail_word(99,0) - lda #<$63 - ldy #>$63 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_150_afterif - ; source: test_word_equalities.p8:1287 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_152_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_152_else - ; source: test_word_equalities.p8:1288 fail_word(100,0) - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_equalities.p8:1290 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_word_equalities.p8:1292 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1294 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl7a -+ - ; source: test_word_equalities.p8:1296 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:1297 lbl7a: fail_word(101,0) -p8l_lbl7a - lda #<$65 - ldy #>$65 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1298 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:1300 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1301 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1303 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:1304 lbl7b: fail_word(102,0) -p8l_lbl7b - lda #<$66 - ldy #>$66 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1305 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:1307 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_153_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_153_afterif - ; source: test_word_equalities.p8:1308 fail_word(103,0) - lda #<$67 - ldy #>$67 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_153_afterif - ; source: test_word_equalities.p8:1311 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_155_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_155_else - ; source: test_word_equalities.p8:1312 fail_word(104,0) - lda #<$68 - ldy #>$68 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_equalities.p8:1314 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_word_equalities.p8:1316 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1318 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl8a -+ - ; source: test_word_equalities.p8:1320 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:1321 lbl8a: fail_word(105,0) -p8l_lbl8a - lda #<$69 - ldy #>$69 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1322 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:1324 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1325 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1327 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:1328 lbl8b: fail_word(106,0) -p8l_lbl8b - lda #<$6a - ldy #>$6a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1329 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:1331 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_156_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_156_afterif - ; source: test_word_equalities.p8:1332 fail_word(107,0) - lda #<$6b - ldy #>$6b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_156_afterif - ; source: test_word_equalities.p8:1335 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_158_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_158_else - ; source: test_word_equalities.p8:1336 fail_word(108,0) - lda #<$6c - ldy #>$6c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_equalities.p8:1338 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_word_equalities.p8:1340 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1341 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1343 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl9a -+ - ; source: test_word_equalities.p8:1345 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:1346 lbl9a: fail_word(109,170) -p8l_lbl9a - lda #<$6d - ldy #>$6d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1347 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:1349 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1350 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1352 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:1353 lbl9b: fail_word(110,170) -p8l_lbl9b - lda #<$6e - ldy #>$6e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1354 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:1356 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_159_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_159_afterif - ; source: test_word_equalities.p8:1357 fail_word(111,170) - lda #<$6f - ldy #>$6f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_159_afterif - ; source: test_word_equalities.p8:1360 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_161_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_161_else - ; source: test_word_equalities.p8:1361 fail_word(112,170) - lda #<$70 - ldy #>$70 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_equalities.p8:1363 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_word_equalities.p8:1365 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1367 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl10a -+ - ; source: test_word_equalities.p8:1369 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:1370 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1371 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:1373 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1374 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1376 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:1377 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1378 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:1380 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_162_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_162_afterif - ; source: test_word_equalities.p8:1381 success++ - inc p8b_main.p8v_success -label_asm_162_afterif - ; source: test_word_equalities.p8:1384 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_164_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_164_else - ; source: test_word_equalities.p8:1385 success++ - inc p8b_main.p8v_success - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_equalities.p8:1387 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_word_equalities.p8:1389 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1391 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl11a -+ - ; source: test_word_equalities.p8:1393 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:1394 lbl11a: fail_word(113,170) -p8l_lbl11a - lda #<$71 - ldy #>$71 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1395 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:1397 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1398 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1400 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:1401 lbl11b: fail_word(114,170) -p8l_lbl11b - lda #<$72 - ldy #>$72 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1402 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:1404 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_165_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_165_afterif - ; source: test_word_equalities.p8:1405 fail_word(115,170) - lda #<$73 - ldy #>$73 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_165_afterif - ; source: test_word_equalities.p8:1408 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_167_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_167_else - ; source: test_word_equalities.p8:1409 fail_word(116,170) - lda #<$74 - ldy #>$74 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_equalities.p8:1411 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_word_equalities.p8:1413 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1415 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl12a -+ - ; source: test_word_equalities.p8:1417 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:1418 lbl12a: fail_word(117,170) -p8l_lbl12a - lda #<$75 - ldy #>$75 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1419 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:1421 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1422 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1424 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:1425 lbl12b: fail_word(118,170) -p8l_lbl12b - lda #<$76 - ldy #>$76 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1426 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:1428 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_168_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_168_afterif - ; source: test_word_equalities.p8:1429 fail_word(119,170) - lda #<$77 - ldy #>$77 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_168_afterif - ; source: test_word_equalities.p8:1432 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_170_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_170_else - ; source: test_word_equalities.p8:1433 fail_word(120,170) - lda #<$78 - ldy #>$78 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_equalities.p8:1435 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_word_equalities.p8:1437 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1438 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1440 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl13a -+ - ; source: test_word_equalities.p8:1442 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:1443 lbl13a: fail_word(121,30464) -p8l_lbl13a - lda #<$79 - ldy #>$79 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1444 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:1446 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1447 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1449 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:1450 lbl13b: fail_word(122,30464) -p8l_lbl13b - lda #<$7a - ldy #>$7a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1451 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:1453 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_171_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_171_afterif - ; source: test_word_equalities.p8:1454 fail_word(123,30464) - lda #<$7b - ldy #>$7b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_171_afterif - ; source: test_word_equalities.p8:1457 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_173_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_173_else - ; source: test_word_equalities.p8:1458 fail_word(124,30464) - lda #<$7c - ldy #>$7c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_equalities.p8:1460 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_word_equalities.p8:1462 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1464 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl14a -+ - ; source: test_word_equalities.p8:1466 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:1467 lbl14a: fail_word(125,30464) -p8l_lbl14a - lda #<$7d - ldy #>$7d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1468 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:1470 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1471 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1473 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:1474 lbl14b: fail_word(126,30464) -p8l_lbl14b - lda #<$7e - ldy #>$7e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1475 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:1477 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_174_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_174_afterif - ; source: test_word_equalities.p8:1478 fail_word(127,30464) - lda #<$7f - ldy #>$7f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_174_afterif - ; source: test_word_equalities.p8:1481 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_176_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_176_else - ; source: test_word_equalities.p8:1482 fail_word(128,30464) - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_equalities.p8:1484 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_word_equalities.p8:1486 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1488 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl15a -+ - ; source: test_word_equalities.p8:1490 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:1491 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1492 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:1494 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1495 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1497 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:1498 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1499 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:1501 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_177_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_177_afterif - ; source: test_word_equalities.p8:1502 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_word_equalities.p8:1505 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_179_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_179_else - ; source: test_word_equalities.p8:1506 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_equalities.p8:1508 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_word_equalities.p8:1510 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1512 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl16a -+ - ; source: test_word_equalities.p8:1514 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:1515 lbl16a: fail_word(129,30464) -p8l_lbl16a - lda #<$81 - ldy #>$81 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1516 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:1518 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1519 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1521 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:1522 lbl16b: fail_word(130,30464) -p8l_lbl16b - lda #<$82 - ldy #>$82 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1523 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:1525 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_180_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_180_afterif - ; source: test_word_equalities.p8:1526 fail_word(131,30464) - lda #<$83 - ldy #>$83 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_180_afterif - ; source: test_word_equalities.p8:1529 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_182_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_182_else - ; source: test_word_equalities.p8:1530 fail_word(132,30464) - lda #<$84 - ldy #>$84 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_equalities.p8:1532 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_word_equalities.p8:1534 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1535 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1537 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl17a -+ - ; source: test_word_equalities.p8:1539 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:1540 lbl17a: fail_word(133,32767) -p8l_lbl17a - lda #<$85 - ldy #>$85 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1541 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:1543 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1544 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1546 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:1547 lbl17b: fail_word(134,32767) -p8l_lbl17b - lda #<$86 - ldy #>$86 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1548 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:1550 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_183_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_183_afterif - ; source: test_word_equalities.p8:1551 fail_word(135,32767) - lda #<$87 - ldy #>$87 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_183_afterif - ; source: test_word_equalities.p8:1554 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_185_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_185_else - ; source: test_word_equalities.p8:1555 fail_word(136,32767) - lda #<$88 - ldy #>$88 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_equalities.p8:1557 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_word_equalities.p8:1559 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1561 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl18a -+ - ; source: test_word_equalities.p8:1563 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:1564 lbl18a: fail_word(137,32767) -p8l_lbl18a - lda #<$89 - ldy #>$89 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1565 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:1567 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1568 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1570 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:1571 lbl18b: fail_word(138,32767) -p8l_lbl18b - lda #<$8a - ldy #>$8a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1572 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:1574 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_186_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_186_afterif - ; source: test_word_equalities.p8:1575 fail_word(139,32767) - lda #<$8b - ldy #>$8b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_186_afterif - ; source: test_word_equalities.p8:1578 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_188_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_188_else - ; source: test_word_equalities.p8:1579 fail_word(140,32767) - lda #<$8c - ldy #>$8c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_equalities.p8:1581 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_word_equalities.p8:1583 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1585 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl19a -+ - ; source: test_word_equalities.p8:1587 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:1588 lbl19a: fail_word(141,32767) -p8l_lbl19a - lda #<$8d - ldy #>$8d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1589 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:1591 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1592 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1594 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:1595 lbl19b: fail_word(142,32767) -p8l_lbl19b - lda #<$8e - ldy #>$8e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1596 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:1598 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_189_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_189_afterif - ; source: test_word_equalities.p8:1599 fail_word(143,32767) - lda #<$8f - ldy #>$8f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_189_afterif - ; source: test_word_equalities.p8:1602 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_191_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_191_else - ; source: test_word_equalities.p8:1603 fail_word(144,32767) - lda #<$90 - ldy #>$90 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_equalities.p8:1605 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_word_equalities.p8:1607 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1609 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - beq p8l_lbl20a -+ - ; source: test_word_equalities.p8:1611 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:1612 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1613 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:1615 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1616 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne + - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1618 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:1619 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1620 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:1622 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_192_afterif - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_192_afterif - ; source: test_word_equalities.p8:1623 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_word_equalities.p8:1626 if x==value - lda p8b_main.p8s_test_is_var.p8v_x - cmp p8b_main.p8s_test_is_var.p8v_value - bne label_asm_194_else - lda p8b_main.p8s_test_is_var.p8v_x+1 - cmp p8b_main.p8s_test_is_var.p8v_value+1 - bne label_asm_194_else - ; source: test_word_equalities.p8:1627 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_equalities.p8:1629 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_word_equalities.p8:1631 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:1143 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .sint ? -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:1633 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_word_equalities.p8:1634 word @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_word_equalities.p8:1635 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:1636 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1637 value=-21829 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1639 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl1a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl1a - ; source: test_word_equalities.p8:1641 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:1642 lbl1a: fail_word(145,-21829) -p8l_lbl1a - lda #<$91 - ldy #>$91 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1643 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:1645 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1646 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1648 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:1649 lbl1b: fail_word(146,-21829) -p8l_lbl1b - lda #<$92 - ldy #>$92 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1650 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:1652 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_195_afterif -+ - ; source: test_word_equalities.p8:1653 fail_word(147,-21829) - lda #<$93 - ldy #>$93 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_195_afterif - ; source: test_word_equalities.p8:1656 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_197_else -+ - ; source: test_word_equalities.p8:1657 fail_word(148,-21829) - lda #<$94 - ldy #>$94 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_equalities.p8:1659 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_word_equalities.p8:1661 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1663 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl2a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl2a - ; source: test_word_equalities.p8:1665 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:1666 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1667 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:1669 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1670 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1672 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:1673 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1674 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:1676 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_198_afterif -+ - ; source: test_word_equalities.p8:1677 success++ - inc p8b_main.p8v_success -label_asm_198_afterif - ; source: test_word_equalities.p8:1680 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_200_else -+ - ; source: test_word_equalities.p8:1681 success++ - inc p8b_main.p8v_success - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_equalities.p8:1683 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_word_equalities.p8:1685 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1687 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl3a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl3a - ; source: test_word_equalities.p8:1689 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:1690 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1691 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:1693 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1694 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1696 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:1697 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1698 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:1700 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_201_afterif -+ - ; source: test_word_equalities.p8:1701 success++ - inc p8b_main.p8v_success -label_asm_201_afterif - ; source: test_word_equalities.p8:1704 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_203_else -+ - ; source: test_word_equalities.p8:1705 success++ - inc p8b_main.p8v_success - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_equalities.p8:1707 cx16.r0L++ - inc cx16.r0L -label_asm_202_afterif - ; source: test_word_equalities.p8:1709 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1711 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl4a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl4a - ; source: test_word_equalities.p8:1713 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:1714 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1715 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:1717 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1718 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1720 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:1721 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1722 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:1724 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_204_afterif -+ - ; source: test_word_equalities.p8:1725 success++ - inc p8b_main.p8v_success -label_asm_204_afterif - ; source: test_word_equalities.p8:1728 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_206_else -+ - ; source: test_word_equalities.p8:1729 success++ - inc p8b_main.p8v_success - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_equalities.p8:1731 cx16.r0L++ - inc cx16.r0L -label_asm_205_afterif - ; source: test_word_equalities.p8:1733 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:1734 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1736 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl5a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl5a - ; source: test_word_equalities.p8:1738 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:1739 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1740 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:1742 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1743 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1745 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:1746 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1747 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:1749 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_207_afterif -+ - ; source: test_word_equalities.p8:1750 success++ - inc p8b_main.p8v_success -label_asm_207_afterif - ; source: test_word_equalities.p8:1753 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_209_else -+ - ; source: test_word_equalities.p8:1754 success++ - inc p8b_main.p8v_success - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_equalities.p8:1756 cx16.r0L++ - inc cx16.r0L -label_asm_208_afterif - ; source: test_word_equalities.p8:1758 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1760 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl6a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl6a - ; source: test_word_equalities.p8:1762 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:1763 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1764 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:1766 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1767 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1769 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:1770 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1771 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:1773 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_210_afterif -+ - ; source: test_word_equalities.p8:1774 success++ - inc p8b_main.p8v_success -label_asm_210_afterif - ; source: test_word_equalities.p8:1777 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_212_else -+ - ; source: test_word_equalities.p8:1778 success++ - inc p8b_main.p8v_success - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_equalities.p8:1780 cx16.r0L++ - inc cx16.r0L -label_asm_211_afterif - ; source: test_word_equalities.p8:1782 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1784 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl7a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl7a - ; source: test_word_equalities.p8:1786 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:1787 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1788 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:1790 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1791 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1793 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:1794 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1795 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:1797 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_213_afterif -+ - ; source: test_word_equalities.p8:1798 success++ - inc p8b_main.p8v_success -label_asm_213_afterif - ; source: test_word_equalities.p8:1801 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_215_else -+ - ; source: test_word_equalities.p8:1802 success++ - inc p8b_main.p8v_success - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_equalities.p8:1804 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_word_equalities.p8:1806 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1808 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl8a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl8a - ; source: test_word_equalities.p8:1810 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:1811 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1812 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:1814 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1815 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1817 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:1818 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1819 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:1821 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_216_afterif -+ - ; source: test_word_equalities.p8:1822 success++ - inc p8b_main.p8v_success -label_asm_216_afterif - ; source: test_word_equalities.p8:1825 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_218_else -+ - ; source: test_word_equalities.p8:1826 success++ - inc p8b_main.p8v_success - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_equalities.p8:1828 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_word_equalities.p8:1830 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1831 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1833 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl9a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl9a - ; source: test_word_equalities.p8:1835 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:1836 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1837 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:1839 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1840 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1842 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:1843 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1844 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:1846 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_219_afterif -+ - ; source: test_word_equalities.p8:1847 success++ - inc p8b_main.p8v_success -label_asm_219_afterif - ; source: test_word_equalities.p8:1850 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_221_else -+ - ; source: test_word_equalities.p8:1851 success++ - inc p8b_main.p8v_success - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_equalities.p8:1853 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_word_equalities.p8:1855 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1857 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl10a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl10a - ; source: test_word_equalities.p8:1859 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:1860 lbl10a: fail_word(149,170) -p8l_lbl10a - lda #<$95 - ldy #>$95 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1861 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:1863 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1864 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1866 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:1867 lbl10b: fail_word(150,170) -p8l_lbl10b - lda #<$96 - ldy #>$96 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1868 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:1870 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_222_afterif -+ - ; source: test_word_equalities.p8:1871 fail_word(151,170) - lda #<$97 - ldy #>$97 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_222_afterif - ; source: test_word_equalities.p8:1874 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_224_else -+ - ; source: test_word_equalities.p8:1875 fail_word(152,170) - lda #<$98 - ldy #>$98 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_equalities.p8:1877 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_word_equalities.p8:1879 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1881 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl11a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl11a - ; source: test_word_equalities.p8:1883 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:1884 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1885 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:1887 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1888 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1890 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:1891 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1892 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:1894 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_225_afterif -+ - ; source: test_word_equalities.p8:1895 success++ - inc p8b_main.p8v_success -label_asm_225_afterif - ; source: test_word_equalities.p8:1898 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_227_else -+ - ; source: test_word_equalities.p8:1899 success++ - inc p8b_main.p8v_success - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_equalities.p8:1901 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_word_equalities.p8:1903 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1905 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl12a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl12a - ; source: test_word_equalities.p8:1907 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:1908 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1909 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:1911 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1912 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1914 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:1915 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1916 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:1918 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_228_afterif -+ - ; source: test_word_equalities.p8:1919 success++ - inc p8b_main.p8v_success -label_asm_228_afterif - ; source: test_word_equalities.p8:1922 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_230_else -+ - ; source: test_word_equalities.p8:1923 success++ - inc p8b_main.p8v_success - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_equalities.p8:1925 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_word_equalities.p8:1927 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:1928 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1930 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl13a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl13a - ; source: test_word_equalities.p8:1932 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:1933 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1934 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:1936 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1937 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1939 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:1940 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1941 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:1943 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_231_afterif -+ - ; source: test_word_equalities.p8:1944 success++ - inc p8b_main.p8v_success -label_asm_231_afterif - ; source: test_word_equalities.p8:1947 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_233_else -+ - ; source: test_word_equalities.p8:1948 success++ - inc p8b_main.p8v_success - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_equalities.p8:1950 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_word_equalities.p8:1952 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1954 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl14a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl14a - ; source: test_word_equalities.p8:1956 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:1957 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1958 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:1960 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1961 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1963 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:1964 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:1965 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:1967 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_234_afterif -+ - ; source: test_word_equalities.p8:1968 success++ - inc p8b_main.p8v_success -label_asm_234_afterif - ; source: test_word_equalities.p8:1971 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_236_else -+ - ; source: test_word_equalities.p8:1972 success++ - inc p8b_main.p8v_success - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_equalities.p8:1974 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_word_equalities.p8:1976 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:1978 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl15a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl15a - ; source: test_word_equalities.p8:1980 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:1981 lbl15a: fail_word(153,30464) -p8l_lbl15a - lda #<$99 - ldy #>$99 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1982 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:1984 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:1985 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:1987 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:1988 lbl15b: fail_word(154,30464) -p8l_lbl15b - lda #<$9a - ldy #>$9a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:1989 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:1991 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_237_afterif -+ - ; source: test_word_equalities.p8:1992 fail_word(155,30464) - lda #<$9b - ldy #>$9b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_237_afterif - ; source: test_word_equalities.p8:1995 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_239_else -+ - ; source: test_word_equalities.p8:1996 fail_word(156,30464) - lda #<$9c - ldy #>$9c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_equalities.p8:1998 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_word_equalities.p8:2000 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:2002 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl16a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl16a - ; source: test_word_equalities.p8:2004 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:2005 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2006 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:2008 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2009 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2011 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:2012 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2013 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:2015 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_240_afterif -+ - ; source: test_word_equalities.p8:2016 success++ - inc p8b_main.p8v_success -label_asm_240_afterif - ; source: test_word_equalities.p8:2019 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_242_else -+ - ; source: test_word_equalities.p8:2020 success++ - inc p8b_main.p8v_success - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_equalities.p8:2022 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_word_equalities.p8:2024 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2025 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:2027 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl17a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl17a - ; source: test_word_equalities.p8:2029 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:2030 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2031 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:2033 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2034 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2036 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:2037 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2038 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:2040 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_243_afterif -+ - ; source: test_word_equalities.p8:2041 success++ - inc p8b_main.p8v_success -label_asm_243_afterif - ; source: test_word_equalities.p8:2044 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_245_else -+ - ; source: test_word_equalities.p8:2045 success++ - inc p8b_main.p8v_success - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_equalities.p8:2047 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_word_equalities.p8:2049 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:2051 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl18a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl18a - ; source: test_word_equalities.p8:2053 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:2054 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2055 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:2057 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2058 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2060 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:2061 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2062 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:2064 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_246_afterif -+ - ; source: test_word_equalities.p8:2065 success++ - inc p8b_main.p8v_success -label_asm_246_afterif - ; source: test_word_equalities.p8:2068 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_248_else -+ - ; source: test_word_equalities.p8:2069 success++ - inc p8b_main.p8v_success - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_equalities.p8:2071 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_word_equalities.p8:2073 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:2075 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl19a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl19a - ; source: test_word_equalities.p8:2077 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:2078 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2079 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:2081 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2082 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2084 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:2085 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2086 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:2088 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_249_afterif -+ - ; source: test_word_equalities.p8:2089 success++ - inc p8b_main.p8v_success -label_asm_249_afterif - ; source: test_word_equalities.p8:2092 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_251_else -+ - ; source: test_word_equalities.p8:2093 success++ - inc p8b_main.p8v_success - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_equalities.p8:2095 cx16.r0L++ - inc cx16.r0L -label_asm_250_afterif - ; source: test_word_equalities.p8:2097 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_equalities.p8:2099 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne p8l_lbl20a - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - bne p8l_lbl20a - ; source: test_word_equalities.p8:2101 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:2102 lbl20a: fail_word(157,32767) -p8l_lbl20a - lda #<$9d - ldy #>$9d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2103 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:2105 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2106 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2108 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:2109 lbl20b: fail_word(158,32767) -p8l_lbl20b - lda #<$9e - ldy #>$9e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2110 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:2112 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_252_afterif -+ - ; source: test_word_equalities.p8:2113 fail_word(159,32767) - lda #<$9f - ldy #>$9f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_252_afterif - ; source: test_word_equalities.p8:2116 if x!=value - lda p8b_main.p8s_test_not_var.p8v_x - cmp p8b_main.p8s_test_not_var.p8v_value - bne + - lda p8b_main.p8s_test_not_var.p8v_x+1 - cmp p8b_main.p8s_test_not_var.p8v_value+1 - beq label_asm_254_else -+ - ; source: test_word_equalities.p8:2117 fail_word(160,32767) - lda #<$a0 - ldy #>$a0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_equalities.p8:2119 cx16.r0L++ - inc cx16.r0L -label_asm_253_afterif - ; source: test_word_equalities.p8:2121 verify_success(64) - lda #$40 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:1633 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .sint ? -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:2123 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_word_equalities.p8:2124 word @shared x - ; source: test_word_equalities.p8:2127 float @shared f4 = 1.0 - ; source: test_word_equalities.p8:2128 float @shared f5 = 1.0 - ; source: test_word_equalities.p8:2124 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:2125 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_equalities.p8:2126 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_equalities.p8:2127 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_word_equalities.p8:2128 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_word_equalities.p8:2129 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:2130 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2132 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl1a -+ - ; source: test_word_equalities.p8:2134 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:2135 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2136 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:2138 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2139 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2141 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:2142 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2143 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:2145 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_255_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_255_afterif - ; source: test_word_equalities.p8:2146 success++ - inc p8b_main.p8v_success -label_asm_255_afterif - ; source: test_word_equalities.p8:2149 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_257_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_257_else - ; source: test_word_equalities.p8:2150 success++ - inc p8b_main.p8v_success - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_equalities.p8:2152 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_word_equalities.p8:2155 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl2a -+ - ; source: test_word_equalities.p8:2157 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:2158 lbl2a: fail_word(161,-21829) -p8l_lbl2a - lda #<$a1 - ldy #>$a1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2159 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:2161 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2162 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2164 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:2165 lbl2b: fail_word(162,-21829) -p8l_lbl2b - lda #<$a2 - ldy #>$a2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2166 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:2168 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_258_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_258_afterif - ; source: test_word_equalities.p8:2169 fail_word(163,-21829) - lda #<$a3 - ldy #>$a3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_258_afterif - ; source: test_word_equalities.p8:2172 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_260_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_260_else - ; source: test_word_equalities.p8:2173 fail_word(164,-21829) - lda #<$a4 - ldy #>$a4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_equalities.p8:2175 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_word_equalities.p8:2178 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl3a -+ - ; source: test_word_equalities.p8:2180 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:2181 lbl3a: fail_word(165,-21829) -p8l_lbl3a - lda #<$a5 - ldy #>$a5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2182 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:2184 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2185 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2187 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:2188 lbl3b: fail_word(166,-21829) -p8l_lbl3b - lda #<$a6 - ldy #>$a6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2189 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:2191 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_261_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_261_afterif - ; source: test_word_equalities.p8:2192 fail_word(167,-21829) - lda #<$a7 - ldy #>$a7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_261_afterif - ; source: test_word_equalities.p8:2195 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_263_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_263_else - ; source: test_word_equalities.p8:2196 fail_word(168,-21829) - lda #<$a8 - ldy #>$a8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_equalities.p8:2198 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_word_equalities.p8:2201 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl4a -+ - ; source: test_word_equalities.p8:2203 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:2204 lbl4a: fail_word(169,-21829) -p8l_lbl4a - lda #<$a9 - ldy #>$a9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2205 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:2207 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2208 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2210 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:2211 lbl4b: fail_word(170,-21829) -p8l_lbl4b - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2212 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:2214 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_264_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_264_afterif - ; source: test_word_equalities.p8:2215 fail_word(171,-21829) - lda #<$ab - ldy #>$ab - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_264_afterif - ; source: test_word_equalities.p8:2218 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_266_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_266_else - ; source: test_word_equalities.p8:2219 fail_word(172,-21829) - lda #<$ac - ldy #>$ac - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_equalities.p8:2221 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_word_equalities.p8:2223 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:2225 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl5a -+ - ; source: test_word_equalities.p8:2227 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:2228 lbl5a: fail_word(173,0) -p8l_lbl5a - lda #<$ad - ldy #>$ad - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2229 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:2231 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2232 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2234 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:2235 lbl5b: fail_word(174,0) -p8l_lbl5b - lda #<$ae - ldy #>$ae - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2236 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:2238 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_267_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_267_afterif - ; source: test_word_equalities.p8:2239 fail_word(175,0) - lda #<$af - ldy #>$af - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_267_afterif - ; source: test_word_equalities.p8:2242 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_269_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_269_else - ; source: test_word_equalities.p8:2243 fail_word(176,0) - lda #<$b0 - ldy #>$b0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_equalities.p8:2245 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_word_equalities.p8:2248 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl6a -+ - ; source: test_word_equalities.p8:2250 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:2251 lbl6a: fail_word(177,0) -p8l_lbl6a - lda #<$b1 - ldy #>$b1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2252 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:2254 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2255 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2257 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:2258 lbl6b: fail_word(178,0) -p8l_lbl6b - lda #<$b2 - ldy #>$b2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2259 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:2261 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_270_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_270_afterif - ; source: test_word_equalities.p8:2262 fail_word(179,0) - lda #<$b3 - ldy #>$b3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_270_afterif - ; source: test_word_equalities.p8:2265 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_272_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_272_else - ; source: test_word_equalities.p8:2266 fail_word(180,0) - lda #<$b4 - ldy #>$b4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_equalities.p8:2268 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_word_equalities.p8:2271 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl7a -+ - ; source: test_word_equalities.p8:2273 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:2274 lbl7a: fail_word(181,0) -p8l_lbl7a - lda #<$b5 - ldy #>$b5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2275 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:2277 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2278 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2280 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:2281 lbl7b: fail_word(182,0) -p8l_lbl7b - lda #<$b6 - ldy #>$b6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2282 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:2284 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_273_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_273_afterif - ; source: test_word_equalities.p8:2285 fail_word(183,0) - lda #<$b7 - ldy #>$b7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_273_afterif - ; source: test_word_equalities.p8:2288 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_275_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_275_else - ; source: test_word_equalities.p8:2289 fail_word(184,0) - lda #<$b8 - ldy #>$b8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_equalities.p8:2291 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_word_equalities.p8:2294 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl8a -+ - ; source: test_word_equalities.p8:2296 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:2297 lbl8a: fail_word(185,0) -p8l_lbl8a - lda #<$b9 - ldy #>$b9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2298 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:2300 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2301 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2303 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:2304 lbl8b: fail_word(186,0) -p8l_lbl8b - lda #<$ba - ldy #>$ba - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2305 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:2307 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_276_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_276_afterif - ; source: test_word_equalities.p8:2308 fail_word(187,0) - lda #<$bb - ldy #>$bb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_276_afterif - ; source: test_word_equalities.p8:2311 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_278_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_278_else - ; source: test_word_equalities.p8:2312 fail_word(188,0) - lda #<$bc - ldy #>$bc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_equalities.p8:2314 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_word_equalities.p8:2316 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2318 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl9a -+ - ; source: test_word_equalities.p8:2320 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:2321 lbl9a: fail_word(189,170) -p8l_lbl9a - lda #<$bd - ldy #>$bd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2322 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:2324 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2325 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2327 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:2328 lbl9b: fail_word(190,170) -p8l_lbl9b - lda #<$be - ldy #>$be - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2329 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:2331 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_279_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_279_afterif - ; source: test_word_equalities.p8:2332 fail_word(191,170) - lda #<$bf - ldy #>$bf - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_279_afterif - ; source: test_word_equalities.p8:2335 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_281_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_281_else - ; source: test_word_equalities.p8:2336 fail_word(192,170) - lda #<$c0 - ldy #>$c0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_equalities.p8:2338 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_word_equalities.p8:2341 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl10a -+ - ; source: test_word_equalities.p8:2343 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:2344 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2345 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:2347 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2348 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2350 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:2351 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2352 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:2354 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_282_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_282_afterif - ; source: test_word_equalities.p8:2355 success++ - inc p8b_main.p8v_success -label_asm_282_afterif - ; source: test_word_equalities.p8:2358 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_284_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_284_else - ; source: test_word_equalities.p8:2359 success++ - inc p8b_main.p8v_success - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_equalities.p8:2361 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_word_equalities.p8:2364 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl11a -+ - ; source: test_word_equalities.p8:2366 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:2367 lbl11a: fail_word(193,170) -p8l_lbl11a - lda #<$c1 - ldy #>$c1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2368 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:2370 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2371 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2373 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:2374 lbl11b: fail_word(194,170) -p8l_lbl11b - lda #<$c2 - ldy #>$c2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2375 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:2377 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_285_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_285_afterif - ; source: test_word_equalities.p8:2378 fail_word(195,170) - lda #<$c3 - ldy #>$c3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_285_afterif - ; source: test_word_equalities.p8:2381 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_287_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_287_else - ; source: test_word_equalities.p8:2382 fail_word(196,170) - lda #<$c4 - ldy #>$c4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_equalities.p8:2384 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_word_equalities.p8:2387 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl12a -+ - ; source: test_word_equalities.p8:2389 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:2390 lbl12a: fail_word(197,170) -p8l_lbl12a - lda #<$c5 - ldy #>$c5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2391 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:2393 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2394 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2396 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:2397 lbl12b: fail_word(198,170) -p8l_lbl12b - lda #<$c6 - ldy #>$c6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2398 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:2400 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_288_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_288_afterif - ; source: test_word_equalities.p8:2401 fail_word(199,170) - lda #<$c7 - ldy #>$c7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_288_afterif - ; source: test_word_equalities.p8:2404 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_290_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_290_else - ; source: test_word_equalities.p8:2405 fail_word(200,170) - lda #<$c8 - ldy #>$c8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_equalities.p8:2407 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_word_equalities.p8:2409 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2411 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl13a -+ - ; source: test_word_equalities.p8:2413 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:2414 lbl13a: fail_word(201,30464) -p8l_lbl13a - lda #<$c9 - ldy #>$c9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2415 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:2417 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2418 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2420 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:2421 lbl13b: fail_word(202,30464) -p8l_lbl13b - lda #<$ca - ldy #>$ca - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2422 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:2424 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_291_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_291_afterif - ; source: test_word_equalities.p8:2425 fail_word(203,30464) - lda #<$cb - ldy #>$cb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_291_afterif - ; source: test_word_equalities.p8:2428 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_293_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_293_else - ; source: test_word_equalities.p8:2429 fail_word(204,30464) - lda #<$cc - ldy #>$cc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_equalities.p8:2431 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_word_equalities.p8:2434 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl14a -+ - ; source: test_word_equalities.p8:2436 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:2437 lbl14a: fail_word(205,30464) -p8l_lbl14a - lda #<$cd - ldy #>$cd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2438 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:2440 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2441 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2443 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:2444 lbl14b: fail_word(206,30464) -p8l_lbl14b - lda #<$ce - ldy #>$ce - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2445 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:2447 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_294_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_294_afterif - ; source: test_word_equalities.p8:2448 fail_word(207,30464) - lda #<$cf - ldy #>$cf - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_294_afterif - ; source: test_word_equalities.p8:2451 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_296_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_296_else - ; source: test_word_equalities.p8:2452 fail_word(208,30464) - lda #<$d0 - ldy #>$d0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_equalities.p8:2454 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_word_equalities.p8:2457 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl15a -+ - ; source: test_word_equalities.p8:2459 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:2460 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2461 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:2463 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2464 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2466 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:2467 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2468 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:2470 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_297_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_297_afterif - ; source: test_word_equalities.p8:2471 success++ - inc p8b_main.p8v_success -label_asm_297_afterif - ; source: test_word_equalities.p8:2474 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_299_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_299_else - ; source: test_word_equalities.p8:2475 success++ - inc p8b_main.p8v_success - bra label_asm_298_afterif -label_asm_299_else - ; source: test_word_equalities.p8:2477 cx16.r0L++ - inc cx16.r0L -label_asm_298_afterif - ; source: test_word_equalities.p8:2480 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl16a -+ - ; source: test_word_equalities.p8:2482 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:2483 lbl16a: fail_word(209,30464) -p8l_lbl16a - lda #<$d1 - ldy #>$d1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2484 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:2486 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2487 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2489 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:2490 lbl16b: fail_word(210,30464) -p8l_lbl16b - lda #<$d2 - ldy #>$d2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2491 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:2493 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_300_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_300_afterif - ; source: test_word_equalities.p8:2494 fail_word(211,30464) - lda #<$d3 - ldy #>$d3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_300_afterif - ; source: test_word_equalities.p8:2497 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_302_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_302_else - ; source: test_word_equalities.p8:2498 fail_word(212,30464) - lda #<$d4 - ldy #>$d4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_301_afterif -label_asm_302_else - ; source: test_word_equalities.p8:2500 cx16.r0L++ - inc cx16.r0L -label_asm_301_afterif - ; source: test_word_equalities.p8:2502 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2504 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl17a -+ - ; source: test_word_equalities.p8:2506 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:2507 lbl17a: fail_word(213,32767) -p8l_lbl17a - lda #<$d5 - ldy #>$d5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2508 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:2510 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2511 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2513 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:2514 lbl17b: fail_word(214,32767) -p8l_lbl17b - lda #<$d6 - ldy #>$d6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2515 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:2517 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_303_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_303_afterif - ; source: test_word_equalities.p8:2518 fail_word(215,32767) - lda #<$d7 - ldy #>$d7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_303_afterif - ; source: test_word_equalities.p8:2521 if x==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_305_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_305_else - ; source: test_word_equalities.p8:2522 fail_word(216,32767) - lda #<$d8 - ldy #>$d8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_304_afterif -label_asm_305_else - ; source: test_word_equalities.p8:2524 cx16.r0L++ - inc cx16.r0L -label_asm_304_afterif - ; source: test_word_equalities.p8:2527 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl18a -+ - ; source: test_word_equalities.p8:2529 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:2530 lbl18a: fail_word(217,32767) -p8l_lbl18a - lda #<$d9 - ldy #>$d9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2531 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:2533 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2534 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2536 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:2537 lbl18b: fail_word(218,32767) -p8l_lbl18b - lda #<$da - ldy #>$da - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2538 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:2540 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_306_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_306_afterif - ; source: test_word_equalities.p8:2541 fail_word(219,32767) - lda #<$db - ldy #>$db - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_306_afterif - ; source: test_word_equalities.p8:2544 if x==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_308_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_308_else - ; source: test_word_equalities.p8:2545 fail_word(220,32767) - lda #<$dc - ldy #>$dc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_307_afterif -label_asm_308_else - ; source: test_word_equalities.p8:2547 cx16.r0L++ - inc cx16.r0L -label_asm_307_afterif - ; source: test_word_equalities.p8:2550 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl19a -+ - ; source: test_word_equalities.p8:2552 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:2553 lbl19a: fail_word(221,32767) -p8l_lbl19a - lda #<$dd - ldy #>$dd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2554 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:2556 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2557 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2559 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:2560 lbl19b: fail_word(222,32767) -p8l_lbl19b - lda #<$de - ldy #>$de - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2561 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:2563 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_309_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_309_afterif - ; source: test_word_equalities.p8:2564 fail_word(223,32767) - lda #<$df - ldy #>$df - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_309_afterif - ; source: test_word_equalities.p8:2567 if x==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_311_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_311_else - ; source: test_word_equalities.p8:2568 fail_word(224,32767) - lda #<$e0 - ldy #>$e0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_310_afterif -label_asm_311_else - ; source: test_word_equalities.p8:2570 cx16.r0L++ - inc cx16.r0L -label_asm_310_afterif - ; source: test_word_equalities.p8:2573 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - beq p8l_lbl20a -+ - ; source: test_word_equalities.p8:2575 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:2576 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2577 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:2579 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2580 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne + - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2582 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:2583 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2584 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:2586 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_312_afterif - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_312_afterif - ; source: test_word_equalities.p8:2587 success++ - inc p8b_main.p8v_success -label_asm_312_afterif - ; source: test_word_equalities.p8:2590 if x==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_is_expr.p8v_x - bne label_asm_314_else - cpy p8b_main.p8s_test_is_expr.p8v_x+1 - bne label_asm_314_else - ; source: test_word_equalities.p8:2591 success++ - inc p8b_main.p8v_success - bra label_asm_313_afterif -label_asm_314_else - ; source: test_word_equalities.p8:2593 cx16.r0L++ - inc cx16.r0L -label_asm_313_afterif - ; source: test_word_equalities.p8:2595 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:2123 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:2597 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_word_equalities.p8:2598 word @shared x - ; source: test_word_equalities.p8:2601 float @shared f4 = 1.0 - ; source: test_word_equalities.p8:2602 float @shared f5 = 1.0 - ; source: test_word_equalities.p8:2598 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:2599 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_equalities.p8:2600 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_equalities.p8:2601 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_word_equalities.p8:2602 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_word_equalities.p8:2603 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:2604 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2606 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl1a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl1a - ; source: test_word_equalities.p8:2608 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:2609 lbl1a: fail_word(225,-21829) -p8l_lbl1a - lda #<$e1 - ldy #>$e1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2610 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:2612 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2613 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2615 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:2616 lbl1b: fail_word(226,-21829) -p8l_lbl1b - lda #<$e2 - ldy #>$e2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2617 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:2619 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_315_afterif -+ - ; source: test_word_equalities.p8:2620 fail_word(227,-21829) - lda #<$e3 - ldy #>$e3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_315_afterif - ; source: test_word_equalities.p8:2623 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_317_else -+ - ; source: test_word_equalities.p8:2624 fail_word(228,-21829) - lda #<$e4 - ldy #>$e4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_316_afterif -label_asm_317_else - ; source: test_word_equalities.p8:2626 cx16.r0L++ - inc cx16.r0L -label_asm_316_afterif - ; source: test_word_equalities.p8:2629 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl2a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl2a - ; source: test_word_equalities.p8:2631 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:2632 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2633 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:2635 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2636 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2638 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:2639 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2640 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:2642 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_318_afterif -+ - ; source: test_word_equalities.p8:2643 success++ - inc p8b_main.p8v_success -label_asm_318_afterif - ; source: test_word_equalities.p8:2646 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_320_else -+ - ; source: test_word_equalities.p8:2647 success++ - inc p8b_main.p8v_success - bra label_asm_319_afterif -label_asm_320_else - ; source: test_word_equalities.p8:2649 cx16.r0L++ - inc cx16.r0L -label_asm_319_afterif - ; source: test_word_equalities.p8:2652 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl3a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl3a - ; source: test_word_equalities.p8:2654 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:2655 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2656 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:2658 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2659 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2661 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:2662 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2663 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:2665 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_321_afterif -+ - ; source: test_word_equalities.p8:2666 success++ - inc p8b_main.p8v_success -label_asm_321_afterif - ; source: test_word_equalities.p8:2669 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_323_else -+ - ; source: test_word_equalities.p8:2670 success++ - inc p8b_main.p8v_success - bra label_asm_322_afterif -label_asm_323_else - ; source: test_word_equalities.p8:2672 cx16.r0L++ - inc cx16.r0L -label_asm_322_afterif - ; source: test_word_equalities.p8:2675 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl4a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl4a - ; source: test_word_equalities.p8:2677 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:2678 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2679 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:2681 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2682 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2684 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:2685 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2686 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:2688 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_324_afterif -+ - ; source: test_word_equalities.p8:2689 success++ - inc p8b_main.p8v_success -label_asm_324_afterif - ; source: test_word_equalities.p8:2692 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_326_else -+ - ; source: test_word_equalities.p8:2693 success++ - inc p8b_main.p8v_success - bra label_asm_325_afterif -label_asm_326_else - ; source: test_word_equalities.p8:2695 cx16.r0L++ - inc cx16.r0L -label_asm_325_afterif - ; source: test_word_equalities.p8:2697 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:2699 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl5a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl5a - ; source: test_word_equalities.p8:2701 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:2702 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2703 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:2705 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2706 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2708 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:2709 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2710 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:2712 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_327_afterif -+ - ; source: test_word_equalities.p8:2713 success++ - inc p8b_main.p8v_success -label_asm_327_afterif - ; source: test_word_equalities.p8:2716 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_329_else -+ - ; source: test_word_equalities.p8:2717 success++ - inc p8b_main.p8v_success - bra label_asm_328_afterif -label_asm_329_else - ; source: test_word_equalities.p8:2719 cx16.r0L++ - inc cx16.r0L -label_asm_328_afterif - ; source: test_word_equalities.p8:2722 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl6a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl6a - ; source: test_word_equalities.p8:2724 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:2725 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2726 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:2728 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2729 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2731 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:2732 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2733 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:2735 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_330_afterif -+ - ; source: test_word_equalities.p8:2736 success++ - inc p8b_main.p8v_success -label_asm_330_afterif - ; source: test_word_equalities.p8:2739 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_332_else -+ - ; source: test_word_equalities.p8:2740 success++ - inc p8b_main.p8v_success - bra label_asm_331_afterif -label_asm_332_else - ; source: test_word_equalities.p8:2742 cx16.r0L++ - inc cx16.r0L -label_asm_331_afterif - ; source: test_word_equalities.p8:2745 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl7a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl7a - ; source: test_word_equalities.p8:2747 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:2748 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2749 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:2751 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2752 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2754 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:2755 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2756 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:2758 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_333_afterif -+ - ; source: test_word_equalities.p8:2759 success++ - inc p8b_main.p8v_success -label_asm_333_afterif - ; source: test_word_equalities.p8:2762 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_335_else -+ - ; source: test_word_equalities.p8:2763 success++ - inc p8b_main.p8v_success - bra label_asm_334_afterif -label_asm_335_else - ; source: test_word_equalities.p8:2765 cx16.r0L++ - inc cx16.r0L -label_asm_334_afterif - ; source: test_word_equalities.p8:2768 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl8a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl8a - ; source: test_word_equalities.p8:2770 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:2771 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2772 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:2774 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2775 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2777 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:2778 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2779 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:2781 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_336_afterif -+ - ; source: test_word_equalities.p8:2782 success++ - inc p8b_main.p8v_success -label_asm_336_afterif - ; source: test_word_equalities.p8:2785 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_338_else -+ - ; source: test_word_equalities.p8:2786 success++ - inc p8b_main.p8v_success - bra label_asm_337_afterif -label_asm_338_else - ; source: test_word_equalities.p8:2788 cx16.r0L++ - inc cx16.r0L -label_asm_337_afterif - ; source: test_word_equalities.p8:2790 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2792 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl9a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl9a - ; source: test_word_equalities.p8:2794 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:2795 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2796 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:2798 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2799 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2801 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:2802 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2803 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:2805 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_339_afterif -+ - ; source: test_word_equalities.p8:2806 success++ - inc p8b_main.p8v_success -label_asm_339_afterif - ; source: test_word_equalities.p8:2809 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_341_else -+ - ; source: test_word_equalities.p8:2810 success++ - inc p8b_main.p8v_success - bra label_asm_340_afterif -label_asm_341_else - ; source: test_word_equalities.p8:2812 cx16.r0L++ - inc cx16.r0L -label_asm_340_afterif - ; source: test_word_equalities.p8:2815 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl10a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl10a - ; source: test_word_equalities.p8:2817 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:2818 lbl10a: fail_word(229,170) -p8l_lbl10a - lda #<$e5 - ldy #>$e5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2819 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:2821 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2822 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2824 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:2825 lbl10b: fail_word(230,170) -p8l_lbl10b - lda #<$e6 - ldy #>$e6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2826 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:2828 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_342_afterif -+ - ; source: test_word_equalities.p8:2829 fail_word(231,170) - lda #<$e7 - ldy #>$e7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_342_afterif - ; source: test_word_equalities.p8:2832 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_344_else -+ - ; source: test_word_equalities.p8:2833 fail_word(232,170) - lda #<$e8 - ldy #>$e8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_343_afterif -label_asm_344_else - ; source: test_word_equalities.p8:2835 cx16.r0L++ - inc cx16.r0L -label_asm_343_afterif - ; source: test_word_equalities.p8:2838 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl11a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl11a - ; source: test_word_equalities.p8:2840 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:2841 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2842 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:2844 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2845 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2847 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:2848 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2849 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:2851 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_345_afterif -+ - ; source: test_word_equalities.p8:2852 success++ - inc p8b_main.p8v_success -label_asm_345_afterif - ; source: test_word_equalities.p8:2855 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_347_else -+ - ; source: test_word_equalities.p8:2856 success++ - inc p8b_main.p8v_success - bra label_asm_346_afterif -label_asm_347_else - ; source: test_word_equalities.p8:2858 cx16.r0L++ - inc cx16.r0L -label_asm_346_afterif - ; source: test_word_equalities.p8:2861 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl12a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl12a - ; source: test_word_equalities.p8:2863 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:2864 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2865 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:2867 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2868 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2870 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:2871 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2872 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:2874 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_348_afterif -+ - ; source: test_word_equalities.p8:2875 success++ - inc p8b_main.p8v_success -label_asm_348_afterif - ; source: test_word_equalities.p8:2878 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_350_else -+ - ; source: test_word_equalities.p8:2879 success++ - inc p8b_main.p8v_success - bra label_asm_349_afterif -label_asm_350_else - ; source: test_word_equalities.p8:2881 cx16.r0L++ - inc cx16.r0L -label_asm_349_afterif - ; source: test_word_equalities.p8:2883 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2885 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl13a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl13a - ; source: test_word_equalities.p8:2887 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:2888 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2889 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:2891 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2892 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2894 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:2895 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2896 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:2898 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_351_afterif -+ - ; source: test_word_equalities.p8:2899 success++ - inc p8b_main.p8v_success -label_asm_351_afterif - ; source: test_word_equalities.p8:2902 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_353_else -+ - ; source: test_word_equalities.p8:2903 success++ - inc p8b_main.p8v_success - bra label_asm_352_afterif -label_asm_353_else - ; source: test_word_equalities.p8:2905 cx16.r0L++ - inc cx16.r0L -label_asm_352_afterif - ; source: test_word_equalities.p8:2908 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl14a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl14a - ; source: test_word_equalities.p8:2910 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:2911 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2912 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:2914 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2915 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2917 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:2918 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2919 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:2921 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_354_afterif -+ - ; source: test_word_equalities.p8:2922 success++ - inc p8b_main.p8v_success -label_asm_354_afterif - ; source: test_word_equalities.p8:2925 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_356_else -+ - ; source: test_word_equalities.p8:2926 success++ - inc p8b_main.p8v_success - bra label_asm_355_afterif -label_asm_356_else - ; source: test_word_equalities.p8:2928 cx16.r0L++ - inc cx16.r0L -label_asm_355_afterif - ; source: test_word_equalities.p8:2931 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl15a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl15a - ; source: test_word_equalities.p8:2933 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:2934 lbl15a: fail_word(233,30464) -p8l_lbl15a - lda #<$e9 - ldy #>$e9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2935 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:2937 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2938 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2940 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:2941 lbl15b: fail_word(234,30464) -p8l_lbl15b - lda #<$ea - ldy #>$ea - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:2942 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:2944 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_357_afterif -+ - ; source: test_word_equalities.p8:2945 fail_word(235,30464) - lda #<$eb - ldy #>$eb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_357_afterif - ; source: test_word_equalities.p8:2948 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_359_else -+ - ; source: test_word_equalities.p8:2949 fail_word(236,30464) - lda #<$ec - ldy #>$ec - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_358_afterif -label_asm_359_else - ; source: test_word_equalities.p8:2951 cx16.r0L++ - inc cx16.r0L -label_asm_358_afterif - ; source: test_word_equalities.p8:2954 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl16a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl16a - ; source: test_word_equalities.p8:2956 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:2957 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2958 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:2960 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2961 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2963 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:2964 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2965 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:2967 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_360_afterif -+ - ; source: test_word_equalities.p8:2968 success++ - inc p8b_main.p8v_success -label_asm_360_afterif - ; source: test_word_equalities.p8:2971 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_362_else -+ - ; source: test_word_equalities.p8:2972 success++ - inc p8b_main.p8v_success - bra label_asm_361_afterif -label_asm_362_else - ; source: test_word_equalities.p8:2974 cx16.r0L++ - inc cx16.r0L -label_asm_361_afterif - ; source: test_word_equalities.p8:2976 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:2978 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl17a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl17a - ; source: test_word_equalities.p8:2980 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:2981 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2982 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:2984 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:2985 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:2987 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:2988 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:2989 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:2991 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_363_afterif -+ - ; source: test_word_equalities.p8:2992 success++ - inc p8b_main.p8v_success -label_asm_363_afterif - ; source: test_word_equalities.p8:2995 if x!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_365_else -+ - ; source: test_word_equalities.p8:2996 success++ - inc p8b_main.p8v_success - bra label_asm_364_afterif -label_asm_365_else - ; source: test_word_equalities.p8:2998 cx16.r0L++ - inc cx16.r0L -label_asm_364_afterif - ; source: test_word_equalities.p8:3001 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl18a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl18a - ; source: test_word_equalities.p8:3003 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:3004 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3005 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:3007 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3008 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3010 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:3011 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3012 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:3014 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_366_afterif -+ - ; source: test_word_equalities.p8:3015 success++ - inc p8b_main.p8v_success -label_asm_366_afterif - ; source: test_word_equalities.p8:3018 if x!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_368_else -+ - ; source: test_word_equalities.p8:3019 success++ - inc p8b_main.p8v_success - bra label_asm_367_afterif -label_asm_368_else - ; source: test_word_equalities.p8:3021 cx16.r0L++ - inc cx16.r0L -label_asm_367_afterif - ; source: test_word_equalities.p8:3024 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl19a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl19a - ; source: test_word_equalities.p8:3026 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:3027 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3028 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:3030 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3031 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3033 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:3034 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3035 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:3037 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_369_afterif -+ - ; source: test_word_equalities.p8:3038 success++ - inc p8b_main.p8v_success -label_asm_369_afterif - ; source: test_word_equalities.p8:3041 if x!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_371_else -+ - ; source: test_word_equalities.p8:3042 success++ - inc p8b_main.p8v_success - bra label_asm_370_afterif -label_asm_371_else - ; source: test_word_equalities.p8:3044 cx16.r0L++ - inc cx16.r0L -label_asm_370_afterif - ; source: test_word_equalities.p8:3047 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne p8l_lbl20a - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - bne p8l_lbl20a - ; source: test_word_equalities.p8:3049 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:3050 lbl20a: fail_word(237,32767) -p8l_lbl20a - lda #<$ed - ldy #>$ed - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3051 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:3053 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3054 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3056 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:3057 lbl20b: fail_word(238,32767) -p8l_lbl20b - lda #<$ee - ldy #>$ee - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3058 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:3060 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_372_afterif -+ - ; source: test_word_equalities.p8:3061 fail_word(239,32767) - lda #<$ef - ldy #>$ef - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_372_afterif - ; source: test_word_equalities.p8:3064 if x!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8b_main.p8s_test_not_expr.p8v_x - bne + - cpy p8b_main.p8s_test_not_expr.p8v_x+1 - beq label_asm_374_else -+ - ; source: test_word_equalities.p8:3065 fail_word(240,32767) - lda #<$f0 - ldy #>$f0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_373_afterif -label_asm_374_else - ; source: test_word_equalities.p8:3067 cx16.r0L++ - inc cx16.r0L -label_asm_373_afterif - ; source: test_word_equalities.p8:3069 verify_success(64) - lda #$40 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:2597 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_equalities.p8:3071 sub test_is_array() { - -p8s_test_is_array .proc -; statements - ; source: test_word_equalities.p8:3072 word @shared x - ; source: test_word_equalities.p8:3073 word[] values = [0, 0] - ; source: test_word_equalities.p8:3074 word[] sources = [0, 0] - ; source: test_word_equalities.p8:3072 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:3075 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:3076 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:3077 sources[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_sources,y - lda #>-$5545 - sta p8v_sources+1,y - ; source: test_word_equalities.p8:3078 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3080 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl1a -+ - ; source: test_word_equalities.p8:3082 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:3083 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3084 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:3086 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3087 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3089 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:3090 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3091 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:3093 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_375_afterif - cpy p8v_values+2+1 - bne label_asm_375_afterif - ; source: test_word_equalities.p8:3094 success++ - inc p8b_main.p8v_success -label_asm_375_afterif - ; source: test_word_equalities.p8:3097 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_377_else - cpy p8v_values+2+1 - bne label_asm_377_else - ; source: test_word_equalities.p8:3098 success++ - inc p8b_main.p8v_success - bra label_asm_376_afterif -label_asm_377_else - ; source: test_word_equalities.p8:3100 cx16.r0L++ - inc cx16.r0L -label_asm_376_afterif - ; source: test_word_equalities.p8:3103 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl1c -+ - ; source: test_word_equalities.p8:3105 goto skip1c - bra p8l_skip1c - ; source: test_word_equalities.p8:3106 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3107 skip1c: -p8l_skip1c - ; source: test_word_equalities.p8:3109 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3110 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3112 goto skip1d - bra p8l_skip1d - ; source: test_word_equalities.p8:3113 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3114 skip1d: -p8l_skip1d - ; source: test_word_equalities.p8:3116 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_378_afterif - cpy p8v_sources+2+1 - bne label_asm_378_afterif - ; source: test_word_equalities.p8:3117 success++ - inc p8b_main.p8v_success -label_asm_378_afterif - ; source: test_word_equalities.p8:3120 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_380_else - cpy p8v_sources+2+1 - bne label_asm_380_else - ; source: test_word_equalities.p8:3121 success++ - inc p8b_main.p8v_success - bra label_asm_379_afterif -label_asm_380_else - ; source: test_word_equalities.p8:3123 cx16.r0L++ - inc cx16.r0L -label_asm_379_afterif - ; source: test_word_equalities.p8:3125 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:3127 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl2a -+ - ; source: test_word_equalities.p8:3129 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:3130 lbl2a: fail_word(241,-21829) -p8l_lbl2a - lda #<$f1 - ldy #>$f1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3131 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:3133 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3134 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3136 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:3137 lbl2b: fail_word(242,-21829) -p8l_lbl2b - lda #<$f2 - ldy #>$f2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3138 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:3140 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_381_afterif - cpy p8v_values+2+1 - bne label_asm_381_afterif - ; source: test_word_equalities.p8:3141 fail_word(243,-21829) - lda #<$f3 - ldy #>$f3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_381_afterif - ; source: test_word_equalities.p8:3144 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_383_else - cpy p8v_values+2+1 - bne label_asm_383_else - ; source: test_word_equalities.p8:3145 fail_word(244,-21829) - lda #<$f4 - ldy #>$f4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_382_afterif -label_asm_383_else - ; source: test_word_equalities.p8:3147 cx16.r0L++ - inc cx16.r0L -label_asm_382_afterif - ; source: test_word_equalities.p8:3150 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl2c -+ - ; source: test_word_equalities.p8:3152 goto skip2c - bra p8l_skip2c - ; source: test_word_equalities.p8:3153 lbl2c: fail_word(245,-21829) -p8l_lbl2c - lda #<$f5 - ldy #>$f5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3154 skip2c: -p8l_skip2c - ; source: test_word_equalities.p8:3156 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3157 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3159 goto skip2d - bra p8l_skip2d - ; source: test_word_equalities.p8:3160 lbl2d: fail_word(246,-21829) -p8l_lbl2d - lda #<$f6 - ldy #>$f6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3161 skip2d: -p8l_skip2d - ; source: test_word_equalities.p8:3163 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_384_afterif - cpy p8v_sources+2+1 - bne label_asm_384_afterif - ; source: test_word_equalities.p8:3164 fail_word(247,-21829) - lda #<$f7 - ldy #>$f7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_384_afterif - ; source: test_word_equalities.p8:3167 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_386_else - cpy p8v_sources+2+1 - bne label_asm_386_else - ; source: test_word_equalities.p8:3168 fail_word(248,-21829) - lda #<$f8 - ldy #>$f8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_385_afterif -label_asm_386_else - ; source: test_word_equalities.p8:3170 cx16.r0L++ - inc cx16.r0L -label_asm_385_afterif - ; source: test_word_equalities.p8:3172 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3174 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl3a -+ - ; source: test_word_equalities.p8:3176 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:3177 lbl3a: fail_word(249,-21829) -p8l_lbl3a - lda #<$f9 - ldy #>$f9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3178 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:3180 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3181 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3183 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:3184 lbl3b: fail_word(250,-21829) -p8l_lbl3b - lda #<$fa - ldy #>$fa - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3185 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:3187 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_387_afterif - cpy p8v_values+2+1 - bne label_asm_387_afterif - ; source: test_word_equalities.p8:3188 fail_word(251,-21829) - lda #<$fb - ldy #>$fb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_387_afterif - ; source: test_word_equalities.p8:3191 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_389_else - cpy p8v_values+2+1 - bne label_asm_389_else - ; source: test_word_equalities.p8:3192 fail_word(252,-21829) - lda #<$fc - ldy #>$fc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_388_afterif -label_asm_389_else - ; source: test_word_equalities.p8:3194 cx16.r0L++ - inc cx16.r0L -label_asm_388_afterif - ; source: test_word_equalities.p8:3197 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl3c -+ - ; source: test_word_equalities.p8:3199 goto skip3c - bra p8l_skip3c - ; source: test_word_equalities.p8:3200 lbl3c: fail_word(253,-21829) -p8l_lbl3c - lda #<$fd - ldy #>$fd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3201 skip3c: -p8l_skip3c - ; source: test_word_equalities.p8:3203 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3204 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3206 goto skip3d - bra p8l_skip3d - ; source: test_word_equalities.p8:3207 lbl3d: fail_word(254,-21829) -p8l_lbl3d - lda #<$fe - ldy #>$fe - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3208 skip3d: -p8l_skip3d - ; source: test_word_equalities.p8:3210 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_390_afterif - cpy p8v_sources+2+1 - bne label_asm_390_afterif - ; source: test_word_equalities.p8:3211 fail_word(255,-21829) - lda #<$ff - ldy #>$ff - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_390_afterif - ; source: test_word_equalities.p8:3214 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_392_else - cpy p8v_sources+2+1 - bne label_asm_392_else - ; source: test_word_equalities.p8:3215 fail_word(256,-21829) - lda #<$0100 - ldy #>$0100 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_391_afterif -label_asm_392_else - ; source: test_word_equalities.p8:3217 cx16.r0L++ - inc cx16.r0L -label_asm_391_afterif - ; source: test_word_equalities.p8:3219 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:3221 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl4a -+ - ; source: test_word_equalities.p8:3223 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:3224 lbl4a: fail_word(257,-21829) -p8l_lbl4a - lda #1 - sta p8b_main.p8s_fail_word.p8v_idx - sta p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3225 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:3227 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3228 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3230 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:3231 lbl4b: fail_word(258,-21829) -p8l_lbl4b - lda #<$0102 - ldy #>$0102 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3232 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:3234 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_393_afterif - cpy p8v_values+2+1 - bne label_asm_393_afterif - ; source: test_word_equalities.p8:3235 fail_word(259,-21829) - lda #<$0103 - ldy #>$0103 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_393_afterif - ; source: test_word_equalities.p8:3238 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_395_else - cpy p8v_values+2+1 - bne label_asm_395_else - ; source: test_word_equalities.p8:3239 fail_word(260,-21829) - lda #<$0104 - ldy #>$0104 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_394_afterif -label_asm_395_else - ; source: test_word_equalities.p8:3241 cx16.r0L++ - inc cx16.r0L -label_asm_394_afterif - ; source: test_word_equalities.p8:3244 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl4c -+ - ; source: test_word_equalities.p8:3246 goto skip4c - bra p8l_skip4c - ; source: test_word_equalities.p8:3247 lbl4c: fail_word(261,-21829) -p8l_lbl4c - lda #<$0105 - ldy #>$0105 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3248 skip4c: -p8l_skip4c - ; source: test_word_equalities.p8:3250 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3251 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3253 goto skip4d - bra p8l_skip4d - ; source: test_word_equalities.p8:3254 lbl4d: fail_word(262,-21829) -p8l_lbl4d - lda #<$0106 - ldy #>$0106 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3255 skip4d: -p8l_skip4d - ; source: test_word_equalities.p8:3257 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_396_afterif - cpy p8v_sources+2+1 - bne label_asm_396_afterif - ; source: test_word_equalities.p8:3258 fail_word(263,-21829) - lda #<$0107 - ldy #>$0107 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_396_afterif - ; source: test_word_equalities.p8:3261 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_398_else - cpy p8v_sources+2+1 - bne label_asm_398_else - ; source: test_word_equalities.p8:3262 fail_word(264,-21829) - lda #<$0108 - ldy #>$0108 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_397_afterif -label_asm_398_else - ; source: test_word_equalities.p8:3264 cx16.r0L++ - inc cx16.r0L -label_asm_397_afterif - ; source: test_word_equalities.p8:3266 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:3267 sources[1]=0 - ldy #2 - lda #0 - sta p8v_sources,y - sta p8v_sources+1,y - ; source: test_word_equalities.p8:3268 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3270 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl5a -+ - ; source: test_word_equalities.p8:3272 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:3273 lbl5a: fail_word(265,0) -p8l_lbl5a - lda #<$0109 - ldy #>$0109 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3274 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:3276 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3277 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3279 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:3280 lbl5b: fail_word(266,0) -p8l_lbl5b - lda #<$010a - ldy #>$010a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3281 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:3283 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_399_afterif - cpy p8v_values+2+1 - bne label_asm_399_afterif - ; source: test_word_equalities.p8:3284 fail_word(267,0) - lda #<$010b - ldy #>$010b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_399_afterif - ; source: test_word_equalities.p8:3287 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_401_else - cpy p8v_values+2+1 - bne label_asm_401_else - ; source: test_word_equalities.p8:3288 fail_word(268,0) - lda #<$010c - ldy #>$010c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_400_afterif -label_asm_401_else - ; source: test_word_equalities.p8:3290 cx16.r0L++ - inc cx16.r0L -label_asm_400_afterif - ; source: test_word_equalities.p8:3293 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl5c -+ - ; source: test_word_equalities.p8:3295 goto skip5c - bra p8l_skip5c - ; source: test_word_equalities.p8:3296 lbl5c: fail_word(269,0) -p8l_lbl5c - lda #<$010d - ldy #>$010d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3297 skip5c: -p8l_skip5c - ; source: test_word_equalities.p8:3299 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3300 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3302 goto skip5d - bra p8l_skip5d - ; source: test_word_equalities.p8:3303 lbl5d: fail_word(270,0) -p8l_lbl5d - lda #<$010e - ldy #>$010e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3304 skip5d: -p8l_skip5d - ; source: test_word_equalities.p8:3306 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_402_afterif - cpy p8v_sources+2+1 - bne label_asm_402_afterif - ; source: test_word_equalities.p8:3307 fail_word(271,0) - lda #<$010f - ldy #>$010f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_402_afterif - ; source: test_word_equalities.p8:3310 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_404_else - cpy p8v_sources+2+1 - bne label_asm_404_else - ; source: test_word_equalities.p8:3311 fail_word(272,0) - lda #<$0110 - ldy #>$0110 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_403_afterif -label_asm_404_else - ; source: test_word_equalities.p8:3313 cx16.r0L++ - inc cx16.r0L -label_asm_403_afterif - ; source: test_word_equalities.p8:3315 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:3317 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl6a -+ - ; source: test_word_equalities.p8:3319 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:3320 lbl6a: fail_word(273,0) -p8l_lbl6a - lda #<$0111 - ldy #>$0111 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3321 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:3323 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3324 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3326 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:3327 lbl6b: fail_word(274,0) -p8l_lbl6b - lda #<$0112 - ldy #>$0112 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3328 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:3330 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_405_afterif - cpy p8v_values+2+1 - bne label_asm_405_afterif - ; source: test_word_equalities.p8:3331 fail_word(275,0) - lda #<$0113 - ldy #>$0113 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_405_afterif - ; source: test_word_equalities.p8:3334 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_407_else - cpy p8v_values+2+1 - bne label_asm_407_else - ; source: test_word_equalities.p8:3335 fail_word(276,0) - lda #<$0114 - ldy #>$0114 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_406_afterif -label_asm_407_else - ; source: test_word_equalities.p8:3337 cx16.r0L++ - inc cx16.r0L -label_asm_406_afterif - ; source: test_word_equalities.p8:3340 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl6c -+ - ; source: test_word_equalities.p8:3342 goto skip6c - bra p8l_skip6c - ; source: test_word_equalities.p8:3343 lbl6c: fail_word(277,0) -p8l_lbl6c - lda #<$0115 - ldy #>$0115 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3344 skip6c: -p8l_skip6c - ; source: test_word_equalities.p8:3346 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3347 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3349 goto skip6d - bra p8l_skip6d - ; source: test_word_equalities.p8:3350 lbl6d: fail_word(278,0) -p8l_lbl6d - lda #<$0116 - ldy #>$0116 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3351 skip6d: -p8l_skip6d - ; source: test_word_equalities.p8:3353 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_408_afterif - cpy p8v_sources+2+1 - bne label_asm_408_afterif - ; source: test_word_equalities.p8:3354 fail_word(279,0) - lda #<$0117 - ldy #>$0117 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_408_afterif - ; source: test_word_equalities.p8:3357 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_410_else - cpy p8v_sources+2+1 - bne label_asm_410_else - ; source: test_word_equalities.p8:3358 fail_word(280,0) - lda #<$0118 - ldy #>$0118 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_409_afterif -label_asm_410_else - ; source: test_word_equalities.p8:3360 cx16.r0L++ - inc cx16.r0L -label_asm_409_afterif - ; source: test_word_equalities.p8:3362 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3364 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl7a -+ - ; source: test_word_equalities.p8:3366 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:3367 lbl7a: fail_word(281,0) -p8l_lbl7a - lda #<$0119 - ldy #>$0119 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3368 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:3370 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3371 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3373 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:3374 lbl7b: fail_word(282,0) -p8l_lbl7b - lda #<$011a - ldy #>$011a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3375 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:3377 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_411_afterif - cpy p8v_values+2+1 - bne label_asm_411_afterif - ; source: test_word_equalities.p8:3378 fail_word(283,0) - lda #<$011b - ldy #>$011b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_411_afterif - ; source: test_word_equalities.p8:3381 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_413_else - cpy p8v_values+2+1 - bne label_asm_413_else - ; source: test_word_equalities.p8:3382 fail_word(284,0) - lda #<$011c - ldy #>$011c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_412_afterif -label_asm_413_else - ; source: test_word_equalities.p8:3384 cx16.r0L++ - inc cx16.r0L -label_asm_412_afterif - ; source: test_word_equalities.p8:3387 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl7c -+ - ; source: test_word_equalities.p8:3389 goto skip7c - bra p8l_skip7c - ; source: test_word_equalities.p8:3390 lbl7c: fail_word(285,0) -p8l_lbl7c - lda #<$011d - ldy #>$011d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3391 skip7c: -p8l_skip7c - ; source: test_word_equalities.p8:3393 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3394 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3396 goto skip7d - bra p8l_skip7d - ; source: test_word_equalities.p8:3397 lbl7d: fail_word(286,0) -p8l_lbl7d - lda #<$011e - ldy #>$011e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3398 skip7d: -p8l_skip7d - ; source: test_word_equalities.p8:3400 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_414_afterif - cpy p8v_sources+2+1 - bne label_asm_414_afterif - ; source: test_word_equalities.p8:3401 fail_word(287,0) - lda #<$011f - ldy #>$011f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_414_afterif - ; source: test_word_equalities.p8:3404 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_416_else - cpy p8v_sources+2+1 - bne label_asm_416_else - ; source: test_word_equalities.p8:3405 fail_word(288,0) - lda #<$0120 - ldy #>$0120 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_415_afterif -label_asm_416_else - ; source: test_word_equalities.p8:3407 cx16.r0L++ - inc cx16.r0L -label_asm_415_afterif - ; source: test_word_equalities.p8:3409 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:3411 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl8a -+ - ; source: test_word_equalities.p8:3413 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:3414 lbl8a: fail_word(289,0) -p8l_lbl8a - lda #<$0121 - ldy #>$0121 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3415 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:3417 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3418 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3420 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:3421 lbl8b: fail_word(290,0) -p8l_lbl8b - lda #<$0122 - ldy #>$0122 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3422 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:3424 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_417_afterif - cpy p8v_values+2+1 - bne label_asm_417_afterif - ; source: test_word_equalities.p8:3425 fail_word(291,0) - lda #<$0123 - ldy #>$0123 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_417_afterif - ; source: test_word_equalities.p8:3428 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_419_else - cpy p8v_values+2+1 - bne label_asm_419_else - ; source: test_word_equalities.p8:3429 fail_word(292,0) - lda #<$0124 - ldy #>$0124 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_418_afterif -label_asm_419_else - ; source: test_word_equalities.p8:3431 cx16.r0L++ - inc cx16.r0L -label_asm_418_afterif - ; source: test_word_equalities.p8:3434 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl8c -+ - ; source: test_word_equalities.p8:3436 goto skip8c - bra p8l_skip8c - ; source: test_word_equalities.p8:3437 lbl8c: fail_word(293,0) -p8l_lbl8c - lda #<$0125 - ldy #>$0125 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3438 skip8c: -p8l_skip8c - ; source: test_word_equalities.p8:3440 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3441 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3443 goto skip8d - bra p8l_skip8d - ; source: test_word_equalities.p8:3444 lbl8d: fail_word(294,0) -p8l_lbl8d - lda #<$0126 - ldy #>$0126 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3445 skip8d: -p8l_skip8d - ; source: test_word_equalities.p8:3447 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_420_afterif - cpy p8v_sources+2+1 - bne label_asm_420_afterif - ; source: test_word_equalities.p8:3448 fail_word(295,0) - lda #<$0127 - ldy #>$0127 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_420_afterif - ; source: test_word_equalities.p8:3451 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_422_else - cpy p8v_sources+2+1 - bne label_asm_422_else - ; source: test_word_equalities.p8:3452 fail_word(296,0) - lda #<$0128 - ldy #>$0128 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_421_afterif -label_asm_422_else - ; source: test_word_equalities.p8:3454 cx16.r0L++ - inc cx16.r0L -label_asm_421_afterif - ; source: test_word_equalities.p8:3456 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:3457 sources[1]=170 - ldy #2 - lda #<$aa - sta p8v_sources,y - lda #>$aa - sta p8v_sources+1,y - ; source: test_word_equalities.p8:3458 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3460 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl9a -+ - ; source: test_word_equalities.p8:3462 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:3463 lbl9a: fail_word(297,170) -p8l_lbl9a - lda #<$0129 - ldy #>$0129 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3464 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:3466 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3467 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3469 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:3470 lbl9b: fail_word(298,170) -p8l_lbl9b - lda #<$012a - ldy #>$012a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3471 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:3473 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_423_afterif - cpy p8v_values+2+1 - bne label_asm_423_afterif - ; source: test_word_equalities.p8:3474 fail_word(299,170) - lda #<$012b - ldy #>$012b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_423_afterif - ; source: test_word_equalities.p8:3477 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_425_else - cpy p8v_values+2+1 - bne label_asm_425_else - ; source: test_word_equalities.p8:3478 fail_word(300,170) - lda #<$012c - ldy #>$012c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_424_afterif -label_asm_425_else - ; source: test_word_equalities.p8:3480 cx16.r0L++ - inc cx16.r0L -label_asm_424_afterif - ; source: test_word_equalities.p8:3483 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl9c -+ - ; source: test_word_equalities.p8:3485 goto skip9c - bra p8l_skip9c - ; source: test_word_equalities.p8:3486 lbl9c: fail_word(301,170) -p8l_lbl9c - lda #<$012d - ldy #>$012d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3487 skip9c: -p8l_skip9c - ; source: test_word_equalities.p8:3489 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3490 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3492 goto skip9d - bra p8l_skip9d - ; source: test_word_equalities.p8:3493 lbl9d: fail_word(302,170) -p8l_lbl9d - lda #<$012e - ldy #>$012e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3494 skip9d: -p8l_skip9d - ; source: test_word_equalities.p8:3496 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_426_afterif - cpy p8v_sources+2+1 - bne label_asm_426_afterif - ; source: test_word_equalities.p8:3497 fail_word(303,170) - lda #<$012f - ldy #>$012f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_426_afterif - ; source: test_word_equalities.p8:3500 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_428_else - cpy p8v_sources+2+1 - bne label_asm_428_else - ; source: test_word_equalities.p8:3501 fail_word(304,170) - lda #<$0130 - ldy #>$0130 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_427_afterif -label_asm_428_else - ; source: test_word_equalities.p8:3503 cx16.r0L++ - inc cx16.r0L -label_asm_427_afterif - ; source: test_word_equalities.p8:3505 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:3507 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl10a -+ - ; source: test_word_equalities.p8:3509 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:3510 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3511 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:3513 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3514 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3516 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:3517 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3518 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:3520 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_429_afterif - cpy p8v_values+2+1 - bne label_asm_429_afterif - ; source: test_word_equalities.p8:3521 success++ - inc p8b_main.p8v_success -label_asm_429_afterif - ; source: test_word_equalities.p8:3524 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_431_else - cpy p8v_values+2+1 - bne label_asm_431_else - ; source: test_word_equalities.p8:3525 success++ - inc p8b_main.p8v_success - bra label_asm_430_afterif -label_asm_431_else - ; source: test_word_equalities.p8:3527 cx16.r0L++ - inc cx16.r0L -label_asm_430_afterif - ; source: test_word_equalities.p8:3530 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl10c -+ - ; source: test_word_equalities.p8:3532 goto skip10c - bra p8l_skip10c - ; source: test_word_equalities.p8:3533 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3534 skip10c: -p8l_skip10c - ; source: test_word_equalities.p8:3536 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3537 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3539 goto skip10d - bra p8l_skip10d - ; source: test_word_equalities.p8:3540 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3541 skip10d: -p8l_skip10d - ; source: test_word_equalities.p8:3543 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_432_afterif - cpy p8v_sources+2+1 - bne label_asm_432_afterif - ; source: test_word_equalities.p8:3544 success++ - inc p8b_main.p8v_success -label_asm_432_afterif - ; source: test_word_equalities.p8:3547 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_434_else - cpy p8v_sources+2+1 - bne label_asm_434_else - ; source: test_word_equalities.p8:3548 success++ - inc p8b_main.p8v_success - bra label_asm_433_afterif -label_asm_434_else - ; source: test_word_equalities.p8:3550 cx16.r0L++ - inc cx16.r0L -label_asm_433_afterif - ; source: test_word_equalities.p8:3552 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3554 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl11a -+ - ; source: test_word_equalities.p8:3556 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:3557 lbl11a: fail_word(305,170) -p8l_lbl11a - lda #<$0131 - ldy #>$0131 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3558 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:3560 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3561 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3563 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:3564 lbl11b: fail_word(306,170) -p8l_lbl11b - lda #<$0132 - ldy #>$0132 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3565 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:3567 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_435_afterif - cpy p8v_values+2+1 - bne label_asm_435_afterif - ; source: test_word_equalities.p8:3568 fail_word(307,170) - lda #<$0133 - ldy #>$0133 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_435_afterif - ; source: test_word_equalities.p8:3571 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_437_else - cpy p8v_values+2+1 - bne label_asm_437_else - ; source: test_word_equalities.p8:3572 fail_word(308,170) - lda #<$0134 - ldy #>$0134 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_436_afterif -label_asm_437_else - ; source: test_word_equalities.p8:3574 cx16.r0L++ - inc cx16.r0L -label_asm_436_afterif - ; source: test_word_equalities.p8:3577 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl11c -+ - ; source: test_word_equalities.p8:3579 goto skip11c - bra p8l_skip11c - ; source: test_word_equalities.p8:3580 lbl11c: fail_word(309,170) -p8l_lbl11c - lda #<$0135 - ldy #>$0135 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3581 skip11c: -p8l_skip11c - ; source: test_word_equalities.p8:3583 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3584 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3586 goto skip11d - bra p8l_skip11d - ; source: test_word_equalities.p8:3587 lbl11d: fail_word(310,170) -p8l_lbl11d - lda #<$0136 - ldy #>$0136 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3588 skip11d: -p8l_skip11d - ; source: test_word_equalities.p8:3590 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_438_afterif - cpy p8v_sources+2+1 - bne label_asm_438_afterif - ; source: test_word_equalities.p8:3591 fail_word(311,170) - lda #<$0137 - ldy #>$0137 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_438_afterif - ; source: test_word_equalities.p8:3594 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_440_else - cpy p8v_sources+2+1 - bne label_asm_440_else - ; source: test_word_equalities.p8:3595 fail_word(312,170) - lda #<$0138 - ldy #>$0138 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_439_afterif -label_asm_440_else - ; source: test_word_equalities.p8:3597 cx16.r0L++ - inc cx16.r0L -label_asm_439_afterif - ; source: test_word_equalities.p8:3599 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:3601 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl12a -+ - ; source: test_word_equalities.p8:3603 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:3604 lbl12a: fail_word(313,170) -p8l_lbl12a - lda #<$0139 - ldy #>$0139 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3605 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:3607 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3608 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3610 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:3611 lbl12b: fail_word(314,170) -p8l_lbl12b - lda #<$013a - ldy #>$013a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3612 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:3614 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_441_afterif - cpy p8v_values+2+1 - bne label_asm_441_afterif - ; source: test_word_equalities.p8:3615 fail_word(315,170) - lda #<$013b - ldy #>$013b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_441_afterif - ; source: test_word_equalities.p8:3618 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_443_else - cpy p8v_values+2+1 - bne label_asm_443_else - ; source: test_word_equalities.p8:3619 fail_word(316,170) - lda #<$013c - ldy #>$013c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_442_afterif -label_asm_443_else - ; source: test_word_equalities.p8:3621 cx16.r0L++ - inc cx16.r0L -label_asm_442_afterif - ; source: test_word_equalities.p8:3624 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl12c -+ - ; source: test_word_equalities.p8:3626 goto skip12c - bra p8l_skip12c - ; source: test_word_equalities.p8:3627 lbl12c: fail_word(317,170) -p8l_lbl12c - lda #<$013d - ldy #>$013d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3628 skip12c: -p8l_skip12c - ; source: test_word_equalities.p8:3630 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3631 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3633 goto skip12d - bra p8l_skip12d - ; source: test_word_equalities.p8:3634 lbl12d: fail_word(318,170) -p8l_lbl12d - lda #<$013e - ldy #>$013e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3635 skip12d: -p8l_skip12d - ; source: test_word_equalities.p8:3637 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_444_afterif - cpy p8v_sources+2+1 - bne label_asm_444_afterif - ; source: test_word_equalities.p8:3638 fail_word(319,170) - lda #<$013f - ldy #>$013f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_444_afterif - ; source: test_word_equalities.p8:3641 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_446_else - cpy p8v_sources+2+1 - bne label_asm_446_else - ; source: test_word_equalities.p8:3642 fail_word(320,170) - lda #<$0140 - ldy #>$0140 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_445_afterif -label_asm_446_else - ; source: test_word_equalities.p8:3644 cx16.r0L++ - inc cx16.r0L -label_asm_445_afterif - ; source: test_word_equalities.p8:3646 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:3647 sources[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_sources,y - lda #>$7700 - sta p8v_sources+1,y - ; source: test_word_equalities.p8:3648 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3650 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl13a -+ - ; source: test_word_equalities.p8:3652 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:3653 lbl13a: fail_word(321,30464) -p8l_lbl13a - lda #<$0141 - ldy #>$0141 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3654 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:3656 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3657 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3659 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:3660 lbl13b: fail_word(322,30464) -p8l_lbl13b - lda #<$0142 - ldy #>$0142 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3661 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:3663 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_447_afterif - cpy p8v_values+2+1 - bne label_asm_447_afterif - ; source: test_word_equalities.p8:3664 fail_word(323,30464) - lda #<$0143 - ldy #>$0143 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_447_afterif - ; source: test_word_equalities.p8:3667 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_449_else - cpy p8v_values+2+1 - bne label_asm_449_else - ; source: test_word_equalities.p8:3668 fail_word(324,30464) - lda #<$0144 - ldy #>$0144 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_448_afterif -label_asm_449_else - ; source: test_word_equalities.p8:3670 cx16.r0L++ - inc cx16.r0L -label_asm_448_afterif - ; source: test_word_equalities.p8:3673 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl13c -+ - ; source: test_word_equalities.p8:3675 goto skip13c - bra p8l_skip13c - ; source: test_word_equalities.p8:3676 lbl13c: fail_word(325,30464) -p8l_lbl13c - lda #<$0145 - ldy #>$0145 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3677 skip13c: -p8l_skip13c - ; source: test_word_equalities.p8:3679 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3680 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3682 goto skip13d - bra p8l_skip13d - ; source: test_word_equalities.p8:3683 lbl13d: fail_word(326,30464) -p8l_lbl13d - lda #<$0146 - ldy #>$0146 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3684 skip13d: -p8l_skip13d - ; source: test_word_equalities.p8:3686 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_450_afterif - cpy p8v_sources+2+1 - bne label_asm_450_afterif - ; source: test_word_equalities.p8:3687 fail_word(327,30464) - lda #<$0147 - ldy #>$0147 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_450_afterif - ; source: test_word_equalities.p8:3690 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_452_else - cpy p8v_sources+2+1 - bne label_asm_452_else - ; source: test_word_equalities.p8:3691 fail_word(328,30464) - lda #<$0148 - ldy #>$0148 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_451_afterif -label_asm_452_else - ; source: test_word_equalities.p8:3693 cx16.r0L++ - inc cx16.r0L -label_asm_451_afterif - ; source: test_word_equalities.p8:3695 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:3697 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl14a -+ - ; source: test_word_equalities.p8:3699 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:3700 lbl14a: fail_word(329,30464) -p8l_lbl14a - lda #<$0149 - ldy #>$0149 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3701 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:3703 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3704 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3706 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:3707 lbl14b: fail_word(330,30464) -p8l_lbl14b - lda #<$014a - ldy #>$014a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3708 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:3710 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_453_afterif - cpy p8v_values+2+1 - bne label_asm_453_afterif - ; source: test_word_equalities.p8:3711 fail_word(331,30464) - lda #<$014b - ldy #>$014b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_453_afterif - ; source: test_word_equalities.p8:3714 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_455_else - cpy p8v_values+2+1 - bne label_asm_455_else - ; source: test_word_equalities.p8:3715 fail_word(332,30464) - lda #<$014c - ldy #>$014c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_454_afterif -label_asm_455_else - ; source: test_word_equalities.p8:3717 cx16.r0L++ - inc cx16.r0L -label_asm_454_afterif - ; source: test_word_equalities.p8:3720 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl14c -+ - ; source: test_word_equalities.p8:3722 goto skip14c - bra p8l_skip14c - ; source: test_word_equalities.p8:3723 lbl14c: fail_word(333,30464) -p8l_lbl14c - lda #<$014d - ldy #>$014d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3724 skip14c: -p8l_skip14c - ; source: test_word_equalities.p8:3726 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3727 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3729 goto skip14d - bra p8l_skip14d - ; source: test_word_equalities.p8:3730 lbl14d: fail_word(334,30464) -p8l_lbl14d - lda #<$014e - ldy #>$014e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3731 skip14d: -p8l_skip14d - ; source: test_word_equalities.p8:3733 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_456_afterif - cpy p8v_sources+2+1 - bne label_asm_456_afterif - ; source: test_word_equalities.p8:3734 fail_word(335,30464) - lda #<$014f - ldy #>$014f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_456_afterif - ; source: test_word_equalities.p8:3737 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_458_else - cpy p8v_sources+2+1 - bne label_asm_458_else - ; source: test_word_equalities.p8:3738 fail_word(336,30464) - lda #<$0150 - ldy #>$0150 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_457_afterif -label_asm_458_else - ; source: test_word_equalities.p8:3740 cx16.r0L++ - inc cx16.r0L -label_asm_457_afterif - ; source: test_word_equalities.p8:3742 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3744 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl15a -+ - ; source: test_word_equalities.p8:3746 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:3747 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3748 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:3750 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3751 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3753 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:3754 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3755 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:3757 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_459_afterif - cpy p8v_values+2+1 - bne label_asm_459_afterif - ; source: test_word_equalities.p8:3758 success++ - inc p8b_main.p8v_success -label_asm_459_afterif - ; source: test_word_equalities.p8:3761 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_461_else - cpy p8v_values+2+1 - bne label_asm_461_else - ; source: test_word_equalities.p8:3762 success++ - inc p8b_main.p8v_success - bra label_asm_460_afterif -label_asm_461_else - ; source: test_word_equalities.p8:3764 cx16.r0L++ - inc cx16.r0L -label_asm_460_afterif - ; source: test_word_equalities.p8:3767 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl15c -+ - ; source: test_word_equalities.p8:3769 goto skip15c - bra p8l_skip15c - ; source: test_word_equalities.p8:3770 lbl15c: success++ -p8l_lbl15c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3771 skip15c: -p8l_skip15c - ; source: test_word_equalities.p8:3773 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3774 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3776 goto skip15d - bra p8l_skip15d - ; source: test_word_equalities.p8:3777 lbl15d: success++ -p8l_lbl15d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3778 skip15d: -p8l_skip15d - ; source: test_word_equalities.p8:3780 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_462_afterif - cpy p8v_sources+2+1 - bne label_asm_462_afterif - ; source: test_word_equalities.p8:3781 success++ - inc p8b_main.p8v_success -label_asm_462_afterif - ; source: test_word_equalities.p8:3784 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_464_else - cpy p8v_sources+2+1 - bne label_asm_464_else - ; source: test_word_equalities.p8:3785 success++ - inc p8b_main.p8v_success - bra label_asm_463_afterif -label_asm_464_else - ; source: test_word_equalities.p8:3787 cx16.r0L++ - inc cx16.r0L -label_asm_463_afterif - ; source: test_word_equalities.p8:3789 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:3791 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl16a -+ - ; source: test_word_equalities.p8:3793 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:3794 lbl16a: fail_word(337,30464) -p8l_lbl16a - lda #<$0151 - ldy #>$0151 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3795 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:3797 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3798 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3800 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:3801 lbl16b: fail_word(338,30464) -p8l_lbl16b - lda #<$0152 - ldy #>$0152 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3802 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:3804 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_465_afterif - cpy p8v_values+2+1 - bne label_asm_465_afterif - ; source: test_word_equalities.p8:3805 fail_word(339,30464) - lda #<$0153 - ldy #>$0153 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_465_afterif - ; source: test_word_equalities.p8:3808 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_467_else - cpy p8v_values+2+1 - bne label_asm_467_else - ; source: test_word_equalities.p8:3809 fail_word(340,30464) - lda #<$0154 - ldy #>$0154 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_466_afterif -label_asm_467_else - ; source: test_word_equalities.p8:3811 cx16.r0L++ - inc cx16.r0L -label_asm_466_afterif - ; source: test_word_equalities.p8:3814 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl16c -+ - ; source: test_word_equalities.p8:3816 goto skip16c - bra p8l_skip16c - ; source: test_word_equalities.p8:3817 lbl16c: fail_word(341,30464) -p8l_lbl16c - lda #<$0155 - ldy #>$0155 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3818 skip16c: -p8l_skip16c - ; source: test_word_equalities.p8:3820 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3821 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3823 goto skip16d - bra p8l_skip16d - ; source: test_word_equalities.p8:3824 lbl16d: fail_word(342,30464) -p8l_lbl16d - lda #<$0156 - ldy #>$0156 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3825 skip16d: -p8l_skip16d - ; source: test_word_equalities.p8:3827 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_468_afterif - cpy p8v_sources+2+1 - bne label_asm_468_afterif - ; source: test_word_equalities.p8:3828 fail_word(343,30464) - lda #<$0157 - ldy #>$0157 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_468_afterif - ; source: test_word_equalities.p8:3831 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_470_else - cpy p8v_sources+2+1 - bne label_asm_470_else - ; source: test_word_equalities.p8:3832 fail_word(344,30464) - lda #<$0158 - ldy #>$0158 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_469_afterif -label_asm_470_else - ; source: test_word_equalities.p8:3834 cx16.r0L++ - inc cx16.r0L -label_asm_469_afterif - ; source: test_word_equalities.p8:3836 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:3837 sources[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_sources,y - lda #>$7fff - sta p8v_sources+1,y - ; source: test_word_equalities.p8:3838 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3840 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl17a -+ - ; source: test_word_equalities.p8:3842 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:3843 lbl17a: fail_word(345,32767) -p8l_lbl17a - lda #<$0159 - ldy #>$0159 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3844 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:3846 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3847 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3849 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:3850 lbl17b: fail_word(346,32767) -p8l_lbl17b - lda #<$015a - ldy #>$015a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3851 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:3853 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_471_afterif - cpy p8v_values+2+1 - bne label_asm_471_afterif - ; source: test_word_equalities.p8:3854 fail_word(347,32767) - lda #<$015b - ldy #>$015b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_471_afterif - ; source: test_word_equalities.p8:3857 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_473_else - cpy p8v_values+2+1 - bne label_asm_473_else - ; source: test_word_equalities.p8:3858 fail_word(348,32767) - lda #<$015c - ldy #>$015c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_472_afterif -label_asm_473_else - ; source: test_word_equalities.p8:3860 cx16.r0L++ - inc cx16.r0L -label_asm_472_afterif - ; source: test_word_equalities.p8:3863 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl17c -+ - ; source: test_word_equalities.p8:3865 goto skip17c - bra p8l_skip17c - ; source: test_word_equalities.p8:3866 lbl17c: fail_word(349,32767) -p8l_lbl17c - lda #<$015d - ldy #>$015d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3867 skip17c: -p8l_skip17c - ; source: test_word_equalities.p8:3869 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3870 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3872 goto skip17d - bra p8l_skip17d - ; source: test_word_equalities.p8:3873 lbl17d: fail_word(350,32767) -p8l_lbl17d - lda #<$015e - ldy #>$015e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3874 skip17d: -p8l_skip17d - ; source: test_word_equalities.p8:3876 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_474_afterif - cpy p8v_sources+2+1 - bne label_asm_474_afterif - ; source: test_word_equalities.p8:3877 fail_word(351,32767) - lda #<$015f - ldy #>$015f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_474_afterif - ; source: test_word_equalities.p8:3880 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_476_else - cpy p8v_sources+2+1 - bne label_asm_476_else - ; source: test_word_equalities.p8:3881 fail_word(352,32767) - lda #<$0160 - ldy #>$0160 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_475_afterif -label_asm_476_else - ; source: test_word_equalities.p8:3883 cx16.r0L++ - inc cx16.r0L -label_asm_475_afterif - ; source: test_word_equalities.p8:3885 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:3887 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl18a -+ - ; source: test_word_equalities.p8:3889 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:3890 lbl18a: fail_word(353,32767) -p8l_lbl18a - lda #<$0161 - ldy #>$0161 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3891 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:3893 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3894 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3896 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:3897 lbl18b: fail_word(354,32767) -p8l_lbl18b - lda #<$0162 - ldy #>$0162 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3898 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:3900 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_477_afterif - cpy p8v_values+2+1 - bne label_asm_477_afterif - ; source: test_word_equalities.p8:3901 fail_word(355,32767) - lda #<$0163 - ldy #>$0163 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_477_afterif - ; source: test_word_equalities.p8:3904 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_479_else - cpy p8v_values+2+1 - bne label_asm_479_else - ; source: test_word_equalities.p8:3905 fail_word(356,32767) - lda #<$0164 - ldy #>$0164 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_478_afterif -label_asm_479_else - ; source: test_word_equalities.p8:3907 cx16.r0L++ - inc cx16.r0L -label_asm_478_afterif - ; source: test_word_equalities.p8:3910 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl18c -+ - ; source: test_word_equalities.p8:3912 goto skip18c - bra p8l_skip18c - ; source: test_word_equalities.p8:3913 lbl18c: fail_word(357,32767) -p8l_lbl18c - lda #<$0165 - ldy #>$0165 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3914 skip18c: -p8l_skip18c - ; source: test_word_equalities.p8:3916 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3917 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3919 goto skip18d - bra p8l_skip18d - ; source: test_word_equalities.p8:3920 lbl18d: fail_word(358,32767) -p8l_lbl18d - lda #<$0166 - ldy #>$0166 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3921 skip18d: -p8l_skip18d - ; source: test_word_equalities.p8:3923 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_480_afterif - cpy p8v_sources+2+1 - bne label_asm_480_afterif - ; source: test_word_equalities.p8:3924 fail_word(359,32767) - lda #<$0167 - ldy #>$0167 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_480_afterif - ; source: test_word_equalities.p8:3927 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_482_else - cpy p8v_sources+2+1 - bne label_asm_482_else - ; source: test_word_equalities.p8:3928 fail_word(360,32767) - lda #<$0168 - ldy #>$0168 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_481_afterif -label_asm_482_else - ; source: test_word_equalities.p8:3930 cx16.r0L++ - inc cx16.r0L -label_asm_481_afterif - ; source: test_word_equalities.p8:3932 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:3934 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl19a -+ - ; source: test_word_equalities.p8:3936 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:3937 lbl19a: fail_word(361,32767) -p8l_lbl19a - lda #<$0169 - ldy #>$0169 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3938 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:3940 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3941 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3943 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:3944 lbl19b: fail_word(362,32767) -p8l_lbl19b - lda #<$016a - ldy #>$016a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3945 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:3947 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_483_afterif - cpy p8v_values+2+1 - bne label_asm_483_afterif - ; source: test_word_equalities.p8:3948 fail_word(363,32767) - lda #<$016b - ldy #>$016b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_483_afterif - ; source: test_word_equalities.p8:3951 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_485_else - cpy p8v_values+2+1 - bne label_asm_485_else - ; source: test_word_equalities.p8:3952 fail_word(364,32767) - lda #<$016c - ldy #>$016c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_484_afterif -label_asm_485_else - ; source: test_word_equalities.p8:3954 cx16.r0L++ - inc cx16.r0L -label_asm_484_afterif - ; source: test_word_equalities.p8:3957 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl19c -+ - ; source: test_word_equalities.p8:3959 goto skip19c - bra p8l_skip19c - ; source: test_word_equalities.p8:3960 lbl19c: fail_word(365,32767) -p8l_lbl19c - lda #<$016d - ldy #>$016d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3961 skip19c: -p8l_skip19c - ; source: test_word_equalities.p8:3963 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3964 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3966 goto skip19d - bra p8l_skip19d - ; source: test_word_equalities.p8:3967 lbl19d: fail_word(366,32767) -p8l_lbl19d - lda #<$016e - ldy #>$016e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:3968 skip19d: -p8l_skip19d - ; source: test_word_equalities.p8:3970 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_486_afterif - cpy p8v_sources+2+1 - bne label_asm_486_afterif - ; source: test_word_equalities.p8:3971 fail_word(367,32767) - lda #<$016f - ldy #>$016f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_486_afterif - ; source: test_word_equalities.p8:3974 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_488_else - cpy p8v_sources+2+1 - bne label_asm_488_else - ; source: test_word_equalities.p8:3975 fail_word(368,32767) - lda #<$0170 - ldy #>$0170 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_487_afterif -label_asm_488_else - ; source: test_word_equalities.p8:3977 cx16.r0L++ - inc cx16.r0L -label_asm_487_afterif - ; source: test_word_equalities.p8:3979 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:3981 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq p8l_lbl20a -+ - ; source: test_word_equalities.p8:3983 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:3984 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3985 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:3987 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:3988 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:3990 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:3991 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:3992 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:3994 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_489_afterif - cpy p8v_values+2+1 - bne label_asm_489_afterif - ; source: test_word_equalities.p8:3995 success++ - inc p8b_main.p8v_success -label_asm_489_afterif - ; source: test_word_equalities.p8:3998 if x==values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne label_asm_491_else - cpy p8v_values+2+1 - bne label_asm_491_else - ; source: test_word_equalities.p8:3999 success++ - inc p8b_main.p8v_success - bra label_asm_490_afterif -label_asm_491_else - ; source: test_word_equalities.p8:4001 cx16.r0L++ - inc cx16.r0L -label_asm_490_afterif - ; source: test_word_equalities.p8:4004 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq p8l_lbl20c -+ - ; source: test_word_equalities.p8:4006 goto skip20c - bra p8l_skip20c - ; source: test_word_equalities.p8:4007 lbl20c: success++ -p8l_lbl20c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4008 skip20c: -p8l_skip20c - ; source: test_word_equalities.p8:4010 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4011 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4013 goto skip20d - bra p8l_skip20d - ; source: test_word_equalities.p8:4014 lbl20d: success++ -p8l_lbl20d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4015 skip20d: -p8l_skip20d - ; source: test_word_equalities.p8:4017 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_492_afterif - cpy p8v_sources+2+1 - bne label_asm_492_afterif - ; source: test_word_equalities.p8:4018 success++ - inc p8b_main.p8v_success -label_asm_492_afterif - ; source: test_word_equalities.p8:4021 if sources[1]==values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne label_asm_494_else - cpy p8v_sources+2+1 - bne label_asm_494_else - ; source: test_word_equalities.p8:4022 success++ - inc p8b_main.p8v_success - bra label_asm_493_afterif -label_asm_494_else - ; source: test_word_equalities.p8:4024 cx16.r0L++ - inc cx16.r0L -label_asm_493_afterif - ; source: test_word_equalities.p8:4026 verify_success(32) - lda #$20 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:3071 sub test_is_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -p8v_sources .sint $0000, $0000 -p8v_values .sint $0000, $0000 - .pend - ; source: test_word_equalities.p8:4028 sub test_not_array() { - -p8s_test_not_array .proc -; statements - ; source: test_word_equalities.p8:4029 word @shared x - ; source: test_word_equalities.p8:4030 word[] values = [0, 0] - ; source: test_word_equalities.p8:4031 word[] sources = [0, 0] - ; source: test_word_equalities.p8:4029 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:4032 success = 0 - stz p8b_main.p8v_success - ; source: test_word_equalities.p8:4033 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:4034 sources[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_sources,y - lda #>-$5545 - sta p8v_sources+1,y - ; source: test_word_equalities.p8:4035 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4037 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl1a - cpy p8v_values+2+1 - bne p8l_lbl1a - ; source: test_word_equalities.p8:4039 goto skip1a - bra p8l_skip1a - ; source: test_word_equalities.p8:4040 lbl1a: fail_word(369,-21829) -p8l_lbl1a - lda #<$0171 - ldy #>$0171 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4041 skip1a: -p8l_skip1a - ; source: test_word_equalities.p8:4043 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4044 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4046 goto skip1b - bra p8l_skip1b - ; source: test_word_equalities.p8:4047 lbl1b: fail_word(370,-21829) -p8l_lbl1b - lda #<$0172 - ldy #>$0172 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4048 skip1b: -p8l_skip1b - ; source: test_word_equalities.p8:4050 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_495_afterif -+ - ; source: test_word_equalities.p8:4051 fail_word(371,-21829) - lda #<$0173 - ldy #>$0173 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_495_afterif - ; source: test_word_equalities.p8:4054 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_497_else -+ - ; source: test_word_equalities.p8:4055 fail_word(372,-21829) - lda #<$0174 - ldy #>$0174 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_496_afterif -label_asm_497_else - ; source: test_word_equalities.p8:4057 cx16.r0L++ - inc cx16.r0L -label_asm_496_afterif - ; source: test_word_equalities.p8:4060 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl1c - cpy p8v_sources+2+1 - bne p8l_lbl1c - ; source: test_word_equalities.p8:4062 goto skip1c - bra p8l_skip1c - ; source: test_word_equalities.p8:4063 lbl1c: fail_word(373,-21829) -p8l_lbl1c - lda #<$0175 - ldy #>$0175 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4064 skip1c: -p8l_skip1c - ; source: test_word_equalities.p8:4066 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4067 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4069 goto skip1d - bra p8l_skip1d - ; source: test_word_equalities.p8:4070 lbl1d: fail_word(374,-21829) -p8l_lbl1d - lda #<$0176 - ldy #>$0176 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4071 skip1d: -p8l_skip1d - ; source: test_word_equalities.p8:4073 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_498_afterif -+ - ; source: test_word_equalities.p8:4074 fail_word(375,-21829) - lda #<$0177 - ldy #>$0177 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_498_afterif - ; source: test_word_equalities.p8:4077 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_500_else -+ - ; source: test_word_equalities.p8:4078 fail_word(376,-21829) - lda #<$0178 - ldy #>$0178 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_499_afterif -label_asm_500_else - ; source: test_word_equalities.p8:4080 cx16.r0L++ - inc cx16.r0L -label_asm_499_afterif - ; source: test_word_equalities.p8:4082 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:4084 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl2a - cpy p8v_values+2+1 - bne p8l_lbl2a - ; source: test_word_equalities.p8:4086 goto skip2a - bra p8l_skip2a - ; source: test_word_equalities.p8:4087 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4088 skip2a: -p8l_skip2a - ; source: test_word_equalities.p8:4090 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4091 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4093 goto skip2b - bra p8l_skip2b - ; source: test_word_equalities.p8:4094 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4095 skip2b: -p8l_skip2b - ; source: test_word_equalities.p8:4097 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_501_afterif -+ - ; source: test_word_equalities.p8:4098 success++ - inc p8b_main.p8v_success -label_asm_501_afterif - ; source: test_word_equalities.p8:4101 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_503_else -+ - ; source: test_word_equalities.p8:4102 success++ - inc p8b_main.p8v_success - bra label_asm_502_afterif -label_asm_503_else - ; source: test_word_equalities.p8:4104 cx16.r0L++ - inc cx16.r0L -label_asm_502_afterif - ; source: test_word_equalities.p8:4107 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl2c - cpy p8v_sources+2+1 - bne p8l_lbl2c - ; source: test_word_equalities.p8:4109 goto skip2c - bra p8l_skip2c - ; source: test_word_equalities.p8:4110 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4111 skip2c: -p8l_skip2c - ; source: test_word_equalities.p8:4113 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4114 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4116 goto skip2d - bra p8l_skip2d - ; source: test_word_equalities.p8:4117 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4118 skip2d: -p8l_skip2d - ; source: test_word_equalities.p8:4120 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_504_afterif -+ - ; source: test_word_equalities.p8:4121 success++ - inc p8b_main.p8v_success -label_asm_504_afterif - ; source: test_word_equalities.p8:4124 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_506_else -+ - ; source: test_word_equalities.p8:4125 success++ - inc p8b_main.p8v_success - bra label_asm_505_afterif -label_asm_506_else - ; source: test_word_equalities.p8:4127 cx16.r0L++ - inc cx16.r0L -label_asm_505_afterif - ; source: test_word_equalities.p8:4129 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4131 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl3a - cpy p8v_values+2+1 - bne p8l_lbl3a - ; source: test_word_equalities.p8:4133 goto skip3a - bra p8l_skip3a - ; source: test_word_equalities.p8:4134 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4135 skip3a: -p8l_skip3a - ; source: test_word_equalities.p8:4137 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4138 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4140 goto skip3b - bra p8l_skip3b - ; source: test_word_equalities.p8:4141 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4142 skip3b: -p8l_skip3b - ; source: test_word_equalities.p8:4144 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_507_afterif -+ - ; source: test_word_equalities.p8:4145 success++ - inc p8b_main.p8v_success -label_asm_507_afterif - ; source: test_word_equalities.p8:4148 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_509_else -+ - ; source: test_word_equalities.p8:4149 success++ - inc p8b_main.p8v_success - bra label_asm_508_afterif -label_asm_509_else - ; source: test_word_equalities.p8:4151 cx16.r0L++ - inc cx16.r0L -label_asm_508_afterif - ; source: test_word_equalities.p8:4154 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl3c - cpy p8v_sources+2+1 - bne p8l_lbl3c - ; source: test_word_equalities.p8:4156 goto skip3c - bra p8l_skip3c - ; source: test_word_equalities.p8:4157 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4158 skip3c: -p8l_skip3c - ; source: test_word_equalities.p8:4160 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4161 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4163 goto skip3d - bra p8l_skip3d - ; source: test_word_equalities.p8:4164 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4165 skip3d: -p8l_skip3d - ; source: test_word_equalities.p8:4167 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_510_afterif -+ - ; source: test_word_equalities.p8:4168 success++ - inc p8b_main.p8v_success -label_asm_510_afterif - ; source: test_word_equalities.p8:4171 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_512_else -+ - ; source: test_word_equalities.p8:4172 success++ - inc p8b_main.p8v_success - bra label_asm_511_afterif -label_asm_512_else - ; source: test_word_equalities.p8:4174 cx16.r0L++ - inc cx16.r0L -label_asm_511_afterif - ; source: test_word_equalities.p8:4176 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:4178 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl4a - cpy p8v_values+2+1 - bne p8l_lbl4a - ; source: test_word_equalities.p8:4180 goto skip4a - bra p8l_skip4a - ; source: test_word_equalities.p8:4181 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4182 skip4a: -p8l_skip4a - ; source: test_word_equalities.p8:4184 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4185 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4187 goto skip4b - bra p8l_skip4b - ; source: test_word_equalities.p8:4188 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4189 skip4b: -p8l_skip4b - ; source: test_word_equalities.p8:4191 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_513_afterif -+ - ; source: test_word_equalities.p8:4192 success++ - inc p8b_main.p8v_success -label_asm_513_afterif - ; source: test_word_equalities.p8:4195 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_515_else -+ - ; source: test_word_equalities.p8:4196 success++ - inc p8b_main.p8v_success - bra label_asm_514_afterif -label_asm_515_else - ; source: test_word_equalities.p8:4198 cx16.r0L++ - inc cx16.r0L -label_asm_514_afterif - ; source: test_word_equalities.p8:4201 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl4c - cpy p8v_sources+2+1 - bne p8l_lbl4c - ; source: test_word_equalities.p8:4203 goto skip4c - bra p8l_skip4c - ; source: test_word_equalities.p8:4204 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4205 skip4c: -p8l_skip4c - ; source: test_word_equalities.p8:4207 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4208 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4210 goto skip4d - bra p8l_skip4d - ; source: test_word_equalities.p8:4211 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4212 skip4d: -p8l_skip4d - ; source: test_word_equalities.p8:4214 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_516_afterif -+ - ; source: test_word_equalities.p8:4215 success++ - inc p8b_main.p8v_success -label_asm_516_afterif - ; source: test_word_equalities.p8:4218 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_518_else -+ - ; source: test_word_equalities.p8:4219 success++ - inc p8b_main.p8v_success - bra label_asm_517_afterif -label_asm_518_else - ; source: test_word_equalities.p8:4221 cx16.r0L++ - inc cx16.r0L -label_asm_517_afterif - ; source: test_word_equalities.p8:4223 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_equalities.p8:4224 sources[1]=0 - ldy #2 - lda #0 - sta p8v_sources,y - sta p8v_sources+1,y - ; source: test_word_equalities.p8:4225 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4227 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl5a - cpy p8v_values+2+1 - bne p8l_lbl5a - ; source: test_word_equalities.p8:4229 goto skip5a - bra p8l_skip5a - ; source: test_word_equalities.p8:4230 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4231 skip5a: -p8l_skip5a - ; source: test_word_equalities.p8:4233 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4234 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4236 goto skip5b - bra p8l_skip5b - ; source: test_word_equalities.p8:4237 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4238 skip5b: -p8l_skip5b - ; source: test_word_equalities.p8:4240 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_519_afterif -+ - ; source: test_word_equalities.p8:4241 success++ - inc p8b_main.p8v_success -label_asm_519_afterif - ; source: test_word_equalities.p8:4244 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_521_else -+ - ; source: test_word_equalities.p8:4245 success++ - inc p8b_main.p8v_success - bra label_asm_520_afterif -label_asm_521_else - ; source: test_word_equalities.p8:4247 cx16.r0L++ - inc cx16.r0L -label_asm_520_afterif - ; source: test_word_equalities.p8:4250 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl5c - cpy p8v_sources+2+1 - bne p8l_lbl5c - ; source: test_word_equalities.p8:4252 goto skip5c - bra p8l_skip5c - ; source: test_word_equalities.p8:4253 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4254 skip5c: -p8l_skip5c - ; source: test_word_equalities.p8:4256 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4257 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4259 goto skip5d - bra p8l_skip5d - ; source: test_word_equalities.p8:4260 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4261 skip5d: -p8l_skip5d - ; source: test_word_equalities.p8:4263 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_522_afterif -+ - ; source: test_word_equalities.p8:4264 success++ - inc p8b_main.p8v_success -label_asm_522_afterif - ; source: test_word_equalities.p8:4267 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_524_else -+ - ; source: test_word_equalities.p8:4268 success++ - inc p8b_main.p8v_success - bra label_asm_523_afterif -label_asm_524_else - ; source: test_word_equalities.p8:4270 cx16.r0L++ - inc cx16.r0L -label_asm_523_afterif - ; source: test_word_equalities.p8:4272 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:4274 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl6a - cpy p8v_values+2+1 - bne p8l_lbl6a - ; source: test_word_equalities.p8:4276 goto skip6a - bra p8l_skip6a - ; source: test_word_equalities.p8:4277 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4278 skip6a: -p8l_skip6a - ; source: test_word_equalities.p8:4280 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4281 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4283 goto skip6b - bra p8l_skip6b - ; source: test_word_equalities.p8:4284 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4285 skip6b: -p8l_skip6b - ; source: test_word_equalities.p8:4287 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_525_afterif -+ - ; source: test_word_equalities.p8:4288 success++ - inc p8b_main.p8v_success -label_asm_525_afterif - ; source: test_word_equalities.p8:4291 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_527_else -+ - ; source: test_word_equalities.p8:4292 success++ - inc p8b_main.p8v_success - bra label_asm_526_afterif -label_asm_527_else - ; source: test_word_equalities.p8:4294 cx16.r0L++ - inc cx16.r0L -label_asm_526_afterif - ; source: test_word_equalities.p8:4297 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl6c - cpy p8v_sources+2+1 - bne p8l_lbl6c - ; source: test_word_equalities.p8:4299 goto skip6c - bra p8l_skip6c - ; source: test_word_equalities.p8:4300 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4301 skip6c: -p8l_skip6c - ; source: test_word_equalities.p8:4303 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4304 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4306 goto skip6d - bra p8l_skip6d - ; source: test_word_equalities.p8:4307 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4308 skip6d: -p8l_skip6d - ; source: test_word_equalities.p8:4310 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_528_afterif -+ - ; source: test_word_equalities.p8:4311 success++ - inc p8b_main.p8v_success -label_asm_528_afterif - ; source: test_word_equalities.p8:4314 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_530_else -+ - ; source: test_word_equalities.p8:4315 success++ - inc p8b_main.p8v_success - bra label_asm_529_afterif -label_asm_530_else - ; source: test_word_equalities.p8:4317 cx16.r0L++ - inc cx16.r0L -label_asm_529_afterif - ; source: test_word_equalities.p8:4319 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4321 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl7a - cpy p8v_values+2+1 - bne p8l_lbl7a - ; source: test_word_equalities.p8:4323 goto skip7a - bra p8l_skip7a - ; source: test_word_equalities.p8:4324 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4325 skip7a: -p8l_skip7a - ; source: test_word_equalities.p8:4327 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4328 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4330 goto skip7b - bra p8l_skip7b - ; source: test_word_equalities.p8:4331 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4332 skip7b: -p8l_skip7b - ; source: test_word_equalities.p8:4334 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_531_afterif -+ - ; source: test_word_equalities.p8:4335 success++ - inc p8b_main.p8v_success -label_asm_531_afterif - ; source: test_word_equalities.p8:4338 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_533_else -+ - ; source: test_word_equalities.p8:4339 success++ - inc p8b_main.p8v_success - bra label_asm_532_afterif -label_asm_533_else - ; source: test_word_equalities.p8:4341 cx16.r0L++ - inc cx16.r0L -label_asm_532_afterif - ; source: test_word_equalities.p8:4344 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl7c - cpy p8v_sources+2+1 - bne p8l_lbl7c - ; source: test_word_equalities.p8:4346 goto skip7c - bra p8l_skip7c - ; source: test_word_equalities.p8:4347 lbl7c: success++ -p8l_lbl7c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4348 skip7c: -p8l_skip7c - ; source: test_word_equalities.p8:4350 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4351 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4353 goto skip7d - bra p8l_skip7d - ; source: test_word_equalities.p8:4354 lbl7d: success++ -p8l_lbl7d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4355 skip7d: -p8l_skip7d - ; source: test_word_equalities.p8:4357 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_534_afterif -+ - ; source: test_word_equalities.p8:4358 success++ - inc p8b_main.p8v_success -label_asm_534_afterif - ; source: test_word_equalities.p8:4361 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_536_else -+ - ; source: test_word_equalities.p8:4362 success++ - inc p8b_main.p8v_success - bra label_asm_535_afterif -label_asm_536_else - ; source: test_word_equalities.p8:4364 cx16.r0L++ - inc cx16.r0L -label_asm_535_afterif - ; source: test_word_equalities.p8:4366 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:4368 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl8a - cpy p8v_values+2+1 - bne p8l_lbl8a - ; source: test_word_equalities.p8:4370 goto skip8a - bra p8l_skip8a - ; source: test_word_equalities.p8:4371 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4372 skip8a: -p8l_skip8a - ; source: test_word_equalities.p8:4374 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4375 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4377 goto skip8b - bra p8l_skip8b - ; source: test_word_equalities.p8:4378 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4379 skip8b: -p8l_skip8b - ; source: test_word_equalities.p8:4381 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_537_afterif -+ - ; source: test_word_equalities.p8:4382 success++ - inc p8b_main.p8v_success -label_asm_537_afterif - ; source: test_word_equalities.p8:4385 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_539_else -+ - ; source: test_word_equalities.p8:4386 success++ - inc p8b_main.p8v_success - bra label_asm_538_afterif -label_asm_539_else - ; source: test_word_equalities.p8:4388 cx16.r0L++ - inc cx16.r0L -label_asm_538_afterif - ; source: test_word_equalities.p8:4391 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl8c - cpy p8v_sources+2+1 - bne p8l_lbl8c - ; source: test_word_equalities.p8:4393 goto skip8c - bra p8l_skip8c - ; source: test_word_equalities.p8:4394 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4395 skip8c: -p8l_skip8c - ; source: test_word_equalities.p8:4397 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4398 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4400 goto skip8d - bra p8l_skip8d - ; source: test_word_equalities.p8:4401 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4402 skip8d: -p8l_skip8d - ; source: test_word_equalities.p8:4404 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_540_afterif -+ - ; source: test_word_equalities.p8:4405 success++ - inc p8b_main.p8v_success -label_asm_540_afterif - ; source: test_word_equalities.p8:4408 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_542_else -+ - ; source: test_word_equalities.p8:4409 success++ - inc p8b_main.p8v_success - bra label_asm_541_afterif -label_asm_542_else - ; source: test_word_equalities.p8:4411 cx16.r0L++ - inc cx16.r0L -label_asm_541_afterif - ; source: test_word_equalities.p8:4413 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:4414 sources[1]=170 - ldy #2 - lda #<$aa - sta p8v_sources,y - lda #>$aa - sta p8v_sources+1,y - ; source: test_word_equalities.p8:4415 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4417 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl9a - cpy p8v_values+2+1 - bne p8l_lbl9a - ; source: test_word_equalities.p8:4419 goto skip9a - bra p8l_skip9a - ; source: test_word_equalities.p8:4420 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4421 skip9a: -p8l_skip9a - ; source: test_word_equalities.p8:4423 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4424 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4426 goto skip9b - bra p8l_skip9b - ; source: test_word_equalities.p8:4427 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4428 skip9b: -p8l_skip9b - ; source: test_word_equalities.p8:4430 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_543_afterif -+ - ; source: test_word_equalities.p8:4431 success++ - inc p8b_main.p8v_success -label_asm_543_afterif - ; source: test_word_equalities.p8:4434 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_545_else -+ - ; source: test_word_equalities.p8:4435 success++ - inc p8b_main.p8v_success - bra label_asm_544_afterif -label_asm_545_else - ; source: test_word_equalities.p8:4437 cx16.r0L++ - inc cx16.r0L -label_asm_544_afterif - ; source: test_word_equalities.p8:4440 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl9c - cpy p8v_sources+2+1 - bne p8l_lbl9c - ; source: test_word_equalities.p8:4442 goto skip9c - bra p8l_skip9c - ; source: test_word_equalities.p8:4443 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4444 skip9c: -p8l_skip9c - ; source: test_word_equalities.p8:4446 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4447 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4449 goto skip9d - bra p8l_skip9d - ; source: test_word_equalities.p8:4450 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4451 skip9d: -p8l_skip9d - ; source: test_word_equalities.p8:4453 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_546_afterif -+ - ; source: test_word_equalities.p8:4454 success++ - inc p8b_main.p8v_success -label_asm_546_afterif - ; source: test_word_equalities.p8:4457 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_548_else -+ - ; source: test_word_equalities.p8:4458 success++ - inc p8b_main.p8v_success - bra label_asm_547_afterif -label_asm_548_else - ; source: test_word_equalities.p8:4460 cx16.r0L++ - inc cx16.r0L -label_asm_547_afterif - ; source: test_word_equalities.p8:4462 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:4464 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl10a - cpy p8v_values+2+1 - bne p8l_lbl10a - ; source: test_word_equalities.p8:4466 goto skip10a - bra p8l_skip10a - ; source: test_word_equalities.p8:4467 lbl10a: fail_word(377,170) -p8l_lbl10a - lda #<$0179 - ldy #>$0179 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4468 skip10a: -p8l_skip10a - ; source: test_word_equalities.p8:4470 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4471 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4473 goto skip10b - bra p8l_skip10b - ; source: test_word_equalities.p8:4474 lbl10b: fail_word(378,170) -p8l_lbl10b - lda #<$017a - ldy #>$017a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4475 skip10b: -p8l_skip10b - ; source: test_word_equalities.p8:4477 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_549_afterif -+ - ; source: test_word_equalities.p8:4478 fail_word(379,170) - lda #<$017b - ldy #>$017b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_549_afterif - ; source: test_word_equalities.p8:4481 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_551_else -+ - ; source: test_word_equalities.p8:4482 fail_word(380,170) - lda #<$017c - ldy #>$017c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_550_afterif -label_asm_551_else - ; source: test_word_equalities.p8:4484 cx16.r0L++ - inc cx16.r0L -label_asm_550_afterif - ; source: test_word_equalities.p8:4487 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl10c - cpy p8v_sources+2+1 - bne p8l_lbl10c - ; source: test_word_equalities.p8:4489 goto skip10c - bra p8l_skip10c - ; source: test_word_equalities.p8:4490 lbl10c: fail_word(381,170) -p8l_lbl10c - lda #<$017d - ldy #>$017d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4491 skip10c: -p8l_skip10c - ; source: test_word_equalities.p8:4493 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4494 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4496 goto skip10d - bra p8l_skip10d - ; source: test_word_equalities.p8:4497 lbl10d: fail_word(382,170) -p8l_lbl10d - lda #<$017e - ldy #>$017e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4498 skip10d: -p8l_skip10d - ; source: test_word_equalities.p8:4500 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_552_afterif -+ - ; source: test_word_equalities.p8:4501 fail_word(383,170) - lda #<$017f - ldy #>$017f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_552_afterif - ; source: test_word_equalities.p8:4504 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_554_else -+ - ; source: test_word_equalities.p8:4505 fail_word(384,170) - lda #<$0180 - ldy #>$0180 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_553_afterif -label_asm_554_else - ; source: test_word_equalities.p8:4507 cx16.r0L++ - inc cx16.r0L -label_asm_553_afterif - ; source: test_word_equalities.p8:4509 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4511 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl11a - cpy p8v_values+2+1 - bne p8l_lbl11a - ; source: test_word_equalities.p8:4513 goto skip11a - bra p8l_skip11a - ; source: test_word_equalities.p8:4514 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4515 skip11a: -p8l_skip11a - ; source: test_word_equalities.p8:4517 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4518 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4520 goto skip11b - bra p8l_skip11b - ; source: test_word_equalities.p8:4521 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4522 skip11b: -p8l_skip11b - ; source: test_word_equalities.p8:4524 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_555_afterif -+ - ; source: test_word_equalities.p8:4525 success++ - inc p8b_main.p8v_success -label_asm_555_afterif - ; source: test_word_equalities.p8:4528 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_557_else -+ - ; source: test_word_equalities.p8:4529 success++ - inc p8b_main.p8v_success - bra label_asm_556_afterif -label_asm_557_else - ; source: test_word_equalities.p8:4531 cx16.r0L++ - inc cx16.r0L -label_asm_556_afterif - ; source: test_word_equalities.p8:4534 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl11c - cpy p8v_sources+2+1 - bne p8l_lbl11c - ; source: test_word_equalities.p8:4536 goto skip11c - bra p8l_skip11c - ; source: test_word_equalities.p8:4537 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4538 skip11c: -p8l_skip11c - ; source: test_word_equalities.p8:4540 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4541 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4543 goto skip11d - bra p8l_skip11d - ; source: test_word_equalities.p8:4544 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4545 skip11d: -p8l_skip11d - ; source: test_word_equalities.p8:4547 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_558_afterif -+ - ; source: test_word_equalities.p8:4548 success++ - inc p8b_main.p8v_success -label_asm_558_afterif - ; source: test_word_equalities.p8:4551 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_560_else -+ - ; source: test_word_equalities.p8:4552 success++ - inc p8b_main.p8v_success - bra label_asm_559_afterif -label_asm_560_else - ; source: test_word_equalities.p8:4554 cx16.r0L++ - inc cx16.r0L -label_asm_559_afterif - ; source: test_word_equalities.p8:4556 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:4558 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl12a - cpy p8v_values+2+1 - bne p8l_lbl12a - ; source: test_word_equalities.p8:4560 goto skip12a - bra p8l_skip12a - ; source: test_word_equalities.p8:4561 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4562 skip12a: -p8l_skip12a - ; source: test_word_equalities.p8:4564 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4565 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4567 goto skip12b - bra p8l_skip12b - ; source: test_word_equalities.p8:4568 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4569 skip12b: -p8l_skip12b - ; source: test_word_equalities.p8:4571 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_561_afterif -+ - ; source: test_word_equalities.p8:4572 success++ - inc p8b_main.p8v_success -label_asm_561_afterif - ; source: test_word_equalities.p8:4575 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_563_else -+ - ; source: test_word_equalities.p8:4576 success++ - inc p8b_main.p8v_success - bra label_asm_562_afterif -label_asm_563_else - ; source: test_word_equalities.p8:4578 cx16.r0L++ - inc cx16.r0L -label_asm_562_afterif - ; source: test_word_equalities.p8:4581 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl12c - cpy p8v_sources+2+1 - bne p8l_lbl12c - ; source: test_word_equalities.p8:4583 goto skip12c - bra p8l_skip12c - ; source: test_word_equalities.p8:4584 lbl12c: success++ -p8l_lbl12c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4585 skip12c: -p8l_skip12c - ; source: test_word_equalities.p8:4587 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4588 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4590 goto skip12d - bra p8l_skip12d - ; source: test_word_equalities.p8:4591 lbl12d: success++ -p8l_lbl12d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4592 skip12d: -p8l_skip12d - ; source: test_word_equalities.p8:4594 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_564_afterif -+ - ; source: test_word_equalities.p8:4595 success++ - inc p8b_main.p8v_success -label_asm_564_afterif - ; source: test_word_equalities.p8:4598 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_566_else -+ - ; source: test_word_equalities.p8:4599 success++ - inc p8b_main.p8v_success - bra label_asm_565_afterif -label_asm_566_else - ; source: test_word_equalities.p8:4601 cx16.r0L++ - inc cx16.r0L -label_asm_565_afterif - ; source: test_word_equalities.p8:4603 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:4604 sources[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_sources,y - lda #>$7700 - sta p8v_sources+1,y - ; source: test_word_equalities.p8:4605 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4607 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl13a - cpy p8v_values+2+1 - bne p8l_lbl13a - ; source: test_word_equalities.p8:4609 goto skip13a - bra p8l_skip13a - ; source: test_word_equalities.p8:4610 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4611 skip13a: -p8l_skip13a - ; source: test_word_equalities.p8:4613 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4614 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4616 goto skip13b - bra p8l_skip13b - ; source: test_word_equalities.p8:4617 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4618 skip13b: -p8l_skip13b - ; source: test_word_equalities.p8:4620 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_567_afterif -+ - ; source: test_word_equalities.p8:4621 success++ - inc p8b_main.p8v_success -label_asm_567_afterif - ; source: test_word_equalities.p8:4624 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_569_else -+ - ; source: test_word_equalities.p8:4625 success++ - inc p8b_main.p8v_success - bra label_asm_568_afterif -label_asm_569_else - ; source: test_word_equalities.p8:4627 cx16.r0L++ - inc cx16.r0L -label_asm_568_afterif - ; source: test_word_equalities.p8:4630 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl13c - cpy p8v_sources+2+1 - bne p8l_lbl13c - ; source: test_word_equalities.p8:4632 goto skip13c - bra p8l_skip13c - ; source: test_word_equalities.p8:4633 lbl13c: success++ -p8l_lbl13c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4634 skip13c: -p8l_skip13c - ; source: test_word_equalities.p8:4636 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4637 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4639 goto skip13d - bra p8l_skip13d - ; source: test_word_equalities.p8:4640 lbl13d: success++ -p8l_lbl13d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4641 skip13d: -p8l_skip13d - ; source: test_word_equalities.p8:4643 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_570_afterif -+ - ; source: test_word_equalities.p8:4644 success++ - inc p8b_main.p8v_success -label_asm_570_afterif - ; source: test_word_equalities.p8:4647 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_572_else -+ - ; source: test_word_equalities.p8:4648 success++ - inc p8b_main.p8v_success - bra label_asm_571_afterif -label_asm_572_else - ; source: test_word_equalities.p8:4650 cx16.r0L++ - inc cx16.r0L -label_asm_571_afterif - ; source: test_word_equalities.p8:4652 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:4654 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl14a - cpy p8v_values+2+1 - bne p8l_lbl14a - ; source: test_word_equalities.p8:4656 goto skip14a - bra p8l_skip14a - ; source: test_word_equalities.p8:4657 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4658 skip14a: -p8l_skip14a - ; source: test_word_equalities.p8:4660 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4661 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4663 goto skip14b - bra p8l_skip14b - ; source: test_word_equalities.p8:4664 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4665 skip14b: -p8l_skip14b - ; source: test_word_equalities.p8:4667 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_573_afterif -+ - ; source: test_word_equalities.p8:4668 success++ - inc p8b_main.p8v_success -label_asm_573_afterif - ; source: test_word_equalities.p8:4671 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_575_else -+ - ; source: test_word_equalities.p8:4672 success++ - inc p8b_main.p8v_success - bra label_asm_574_afterif -label_asm_575_else - ; source: test_word_equalities.p8:4674 cx16.r0L++ - inc cx16.r0L -label_asm_574_afterif - ; source: test_word_equalities.p8:4677 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl14c - cpy p8v_sources+2+1 - bne p8l_lbl14c - ; source: test_word_equalities.p8:4679 goto skip14c - bra p8l_skip14c - ; source: test_word_equalities.p8:4680 lbl14c: success++ -p8l_lbl14c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4681 skip14c: -p8l_skip14c - ; source: test_word_equalities.p8:4683 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4684 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4686 goto skip14d - bra p8l_skip14d - ; source: test_word_equalities.p8:4687 lbl14d: success++ -p8l_lbl14d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4688 skip14d: -p8l_skip14d - ; source: test_word_equalities.p8:4690 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_576_afterif -+ - ; source: test_word_equalities.p8:4691 success++ - inc p8b_main.p8v_success -label_asm_576_afterif - ; source: test_word_equalities.p8:4694 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_578_else -+ - ; source: test_word_equalities.p8:4695 success++ - inc p8b_main.p8v_success - bra label_asm_577_afterif -label_asm_578_else - ; source: test_word_equalities.p8:4697 cx16.r0L++ - inc cx16.r0L -label_asm_577_afterif - ; source: test_word_equalities.p8:4699 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4701 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl15a - cpy p8v_values+2+1 - bne p8l_lbl15a - ; source: test_word_equalities.p8:4703 goto skip15a - bra p8l_skip15a - ; source: test_word_equalities.p8:4704 lbl15a: fail_word(385,30464) -p8l_lbl15a - lda #<$0181 - ldy #>$0181 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4705 skip15a: -p8l_skip15a - ; source: test_word_equalities.p8:4707 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4708 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4710 goto skip15b - bra p8l_skip15b - ; source: test_word_equalities.p8:4711 lbl15b: fail_word(386,30464) -p8l_lbl15b - lda #<$0182 - ldy #>$0182 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4712 skip15b: -p8l_skip15b - ; source: test_word_equalities.p8:4714 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_579_afterif -+ - ; source: test_word_equalities.p8:4715 fail_word(387,30464) - lda #<$0183 - ldy #>$0183 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_579_afterif - ; source: test_word_equalities.p8:4718 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_581_else -+ - ; source: test_word_equalities.p8:4719 fail_word(388,30464) - lda #<$0184 - ldy #>$0184 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_580_afterif -label_asm_581_else - ; source: test_word_equalities.p8:4721 cx16.r0L++ - inc cx16.r0L -label_asm_580_afterif - ; source: test_word_equalities.p8:4724 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl15c - cpy p8v_sources+2+1 - bne p8l_lbl15c - ; source: test_word_equalities.p8:4726 goto skip15c - bra p8l_skip15c - ; source: test_word_equalities.p8:4727 lbl15c: fail_word(389,30464) -p8l_lbl15c - lda #<$0185 - ldy #>$0185 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4728 skip15c: -p8l_skip15c - ; source: test_word_equalities.p8:4730 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4731 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4733 goto skip15d - bra p8l_skip15d - ; source: test_word_equalities.p8:4734 lbl15d: fail_word(390,30464) -p8l_lbl15d - lda #<$0186 - ldy #>$0186 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4735 skip15d: -p8l_skip15d - ; source: test_word_equalities.p8:4737 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_582_afterif -+ - ; source: test_word_equalities.p8:4738 fail_word(391,30464) - lda #<$0187 - ldy #>$0187 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_582_afterif - ; source: test_word_equalities.p8:4741 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_584_else -+ - ; source: test_word_equalities.p8:4742 fail_word(392,30464) - lda #<$0188 - ldy #>$0188 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_583_afterif -label_asm_584_else - ; source: test_word_equalities.p8:4744 cx16.r0L++ - inc cx16.r0L -label_asm_583_afterif - ; source: test_word_equalities.p8:4746 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:4748 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl16a - cpy p8v_values+2+1 - bne p8l_lbl16a - ; source: test_word_equalities.p8:4750 goto skip16a - bra p8l_skip16a - ; source: test_word_equalities.p8:4751 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4752 skip16a: -p8l_skip16a - ; source: test_word_equalities.p8:4754 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4755 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4757 goto skip16b - bra p8l_skip16b - ; source: test_word_equalities.p8:4758 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4759 skip16b: -p8l_skip16b - ; source: test_word_equalities.p8:4761 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_585_afterif -+ - ; source: test_word_equalities.p8:4762 success++ - inc p8b_main.p8v_success -label_asm_585_afterif - ; source: test_word_equalities.p8:4765 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_587_else -+ - ; source: test_word_equalities.p8:4766 success++ - inc p8b_main.p8v_success - bra label_asm_586_afterif -label_asm_587_else - ; source: test_word_equalities.p8:4768 cx16.r0L++ - inc cx16.r0L -label_asm_586_afterif - ; source: test_word_equalities.p8:4771 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl16c - cpy p8v_sources+2+1 - bne p8l_lbl16c - ; source: test_word_equalities.p8:4773 goto skip16c - bra p8l_skip16c - ; source: test_word_equalities.p8:4774 lbl16c: success++ -p8l_lbl16c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4775 skip16c: -p8l_skip16c - ; source: test_word_equalities.p8:4777 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4778 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4780 goto skip16d - bra p8l_skip16d - ; source: test_word_equalities.p8:4781 lbl16d: success++ -p8l_lbl16d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4782 skip16d: -p8l_skip16d - ; source: test_word_equalities.p8:4784 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_588_afterif -+ - ; source: test_word_equalities.p8:4785 success++ - inc p8b_main.p8v_success -label_asm_588_afterif - ; source: test_word_equalities.p8:4788 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_590_else -+ - ; source: test_word_equalities.p8:4789 success++ - inc p8b_main.p8v_success - bra label_asm_589_afterif -label_asm_590_else - ; source: test_word_equalities.p8:4791 cx16.r0L++ - inc cx16.r0L -label_asm_589_afterif - ; source: test_word_equalities.p8:4793 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_equalities.p8:4794 sources[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_sources,y - lda #>$7fff - sta p8v_sources+1,y - ; source: test_word_equalities.p8:4795 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4797 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl17a - cpy p8v_values+2+1 - bne p8l_lbl17a - ; source: test_word_equalities.p8:4799 goto skip17a - bra p8l_skip17a - ; source: test_word_equalities.p8:4800 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4801 skip17a: -p8l_skip17a - ; source: test_word_equalities.p8:4803 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4804 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4806 goto skip17b - bra p8l_skip17b - ; source: test_word_equalities.p8:4807 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4808 skip17b: -p8l_skip17b - ; source: test_word_equalities.p8:4810 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_591_afterif -+ - ; source: test_word_equalities.p8:4811 success++ - inc p8b_main.p8v_success -label_asm_591_afterif - ; source: test_word_equalities.p8:4814 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_593_else -+ - ; source: test_word_equalities.p8:4815 success++ - inc p8b_main.p8v_success - bra label_asm_592_afterif -label_asm_593_else - ; source: test_word_equalities.p8:4817 cx16.r0L++ - inc cx16.r0L -label_asm_592_afterif - ; source: test_word_equalities.p8:4820 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl17c - cpy p8v_sources+2+1 - bne p8l_lbl17c - ; source: test_word_equalities.p8:4822 goto skip17c - bra p8l_skip17c - ; source: test_word_equalities.p8:4823 lbl17c: success++ -p8l_lbl17c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4824 skip17c: -p8l_skip17c - ; source: test_word_equalities.p8:4826 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4827 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4829 goto skip17d - bra p8l_skip17d - ; source: test_word_equalities.p8:4830 lbl17d: success++ -p8l_lbl17d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4831 skip17d: -p8l_skip17d - ; source: test_word_equalities.p8:4833 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_594_afterif -+ - ; source: test_word_equalities.p8:4834 success++ - inc p8b_main.p8v_success -label_asm_594_afterif - ; source: test_word_equalities.p8:4837 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_596_else -+ - ; source: test_word_equalities.p8:4838 success++ - inc p8b_main.p8v_success - bra label_asm_595_afterif -label_asm_596_else - ; source: test_word_equalities.p8:4840 cx16.r0L++ - inc cx16.r0L -label_asm_595_afterif - ; source: test_word_equalities.p8:4842 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_equalities.p8:4844 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl18a - cpy p8v_values+2+1 - bne p8l_lbl18a - ; source: test_word_equalities.p8:4846 goto skip18a - bra p8l_skip18a - ; source: test_word_equalities.p8:4847 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4848 skip18a: -p8l_skip18a - ; source: test_word_equalities.p8:4850 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4851 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4853 goto skip18b - bra p8l_skip18b - ; source: test_word_equalities.p8:4854 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4855 skip18b: -p8l_skip18b - ; source: test_word_equalities.p8:4857 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_597_afterif -+ - ; source: test_word_equalities.p8:4858 success++ - inc p8b_main.p8v_success -label_asm_597_afterif - ; source: test_word_equalities.p8:4861 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_599_else -+ - ; source: test_word_equalities.p8:4862 success++ - inc p8b_main.p8v_success - bra label_asm_598_afterif -label_asm_599_else - ; source: test_word_equalities.p8:4864 cx16.r0L++ - inc cx16.r0L -label_asm_598_afterif - ; source: test_word_equalities.p8:4867 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl18c - cpy p8v_sources+2+1 - bne p8l_lbl18c - ; source: test_word_equalities.p8:4869 goto skip18c - bra p8l_skip18c - ; source: test_word_equalities.p8:4870 lbl18c: success++ -p8l_lbl18c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4871 skip18c: -p8l_skip18c - ; source: test_word_equalities.p8:4873 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4874 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4876 goto skip18d - bra p8l_skip18d - ; source: test_word_equalities.p8:4877 lbl18d: success++ -p8l_lbl18d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4878 skip18d: -p8l_skip18d - ; source: test_word_equalities.p8:4880 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_600_afterif -+ - ; source: test_word_equalities.p8:4881 success++ - inc p8b_main.p8v_success -label_asm_600_afterif - ; source: test_word_equalities.p8:4884 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_602_else -+ - ; source: test_word_equalities.p8:4885 success++ - inc p8b_main.p8v_success - bra label_asm_601_afterif -label_asm_602_else - ; source: test_word_equalities.p8:4887 cx16.r0L++ - inc cx16.r0L -label_asm_601_afterif - ; source: test_word_equalities.p8:4889 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_equalities.p8:4891 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl19a - cpy p8v_values+2+1 - bne p8l_lbl19a - ; source: test_word_equalities.p8:4893 goto skip19a - bra p8l_skip19a - ; source: test_word_equalities.p8:4894 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4895 skip19a: -p8l_skip19a - ; source: test_word_equalities.p8:4897 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4898 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4900 goto skip19b - bra p8l_skip19b - ; source: test_word_equalities.p8:4901 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4902 skip19b: -p8l_skip19b - ; source: test_word_equalities.p8:4904 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_603_afterif -+ - ; source: test_word_equalities.p8:4905 success++ - inc p8b_main.p8v_success -label_asm_603_afterif - ; source: test_word_equalities.p8:4908 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_605_else -+ - ; source: test_word_equalities.p8:4909 success++ - inc p8b_main.p8v_success - bra label_asm_604_afterif -label_asm_605_else - ; source: test_word_equalities.p8:4911 cx16.r0L++ - inc cx16.r0L -label_asm_604_afterif - ; source: test_word_equalities.p8:4914 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl19c - cpy p8v_sources+2+1 - bne p8l_lbl19c - ; source: test_word_equalities.p8:4916 goto skip19c - bra p8l_skip19c - ; source: test_word_equalities.p8:4917 lbl19c: success++ -p8l_lbl19c - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4918 skip19c: -p8l_skip19c - ; source: test_word_equalities.p8:4920 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4921 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4923 goto skip19d - bra p8l_skip19d - ; source: test_word_equalities.p8:4924 lbl19d: success++ -p8l_lbl19d - inc p8b_main.p8v_success - ; source: test_word_equalities.p8:4925 skip19d: -p8l_skip19d - ; source: test_word_equalities.p8:4927 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_606_afterif -+ - ; source: test_word_equalities.p8:4928 success++ - inc p8b_main.p8v_success -label_asm_606_afterif - ; source: test_word_equalities.p8:4931 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_608_else -+ - ; source: test_word_equalities.p8:4932 success++ - inc p8b_main.p8v_success - bra label_asm_607_afterif -label_asm_608_else - ; source: test_word_equalities.p8:4934 cx16.r0L++ - inc cx16.r0L -label_asm_607_afterif - ; source: test_word_equalities.p8:4936 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_equalities.p8:4938 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne p8l_lbl20a - cpy p8v_values+2+1 - bne p8l_lbl20a - ; source: test_word_equalities.p8:4940 goto skip20a - bra p8l_skip20a - ; source: test_word_equalities.p8:4941 lbl20a: fail_word(393,32767) -p8l_lbl20a - lda #<$0189 - ldy #>$0189 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4942 skip20a: -p8l_skip20a - ; source: test_word_equalities.p8:4944 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4945 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4947 goto skip20b - bra p8l_skip20b - ; source: test_word_equalities.p8:4948 lbl20b: fail_word(394,32767) -p8l_lbl20b - lda #<$018a - ldy #>$018a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4949 skip20b: -p8l_skip20b - ; source: test_word_equalities.p8:4951 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_609_afterif -+ - ; source: test_word_equalities.p8:4952 fail_word(395,32767) - lda #<$018b - ldy #>$018b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_609_afterif - ; source: test_word_equalities.p8:4955 if x!=values[1] - ldy p8v_x+1 - lda p8v_x - cmp p8v_values+2 - bne + - cpy p8v_values+2+1 - beq label_asm_611_else -+ - ; source: test_word_equalities.p8:4956 fail_word(396,32767) - lda #<$018c - ldy #>$018c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_610_afterif -label_asm_611_else - ; source: test_word_equalities.p8:4958 cx16.r0L++ - inc cx16.r0L -label_asm_610_afterif - ; source: test_word_equalities.p8:4961 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne p8l_lbl20c - cpy p8v_sources+2+1 - bne p8l_lbl20c - ; source: test_word_equalities.p8:4963 goto skip20c - bra p8l_skip20c - ; source: test_word_equalities.p8:4964 lbl20c: fail_word(397,32767) -p8l_lbl20c - lda #<$018d - ldy #>$018d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4965 skip20c: -p8l_skip20c - ; source: test_word_equalities.p8:4967 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_equalities.p8:4968 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_equalities.p8:4970 goto skip20d - bra p8l_skip20d - ; source: test_word_equalities.p8:4971 lbl20d: fail_word(398,32767) -p8l_lbl20d - lda #<$018e - ldy #>$018e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_equalities.p8:4972 skip20d: -p8l_skip20d - ; source: test_word_equalities.p8:4974 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_612_afterif -+ - ; source: test_word_equalities.p8:4975 fail_word(399,32767) - lda #<$018f - ldy #>$018f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_612_afterif - ; source: test_word_equalities.p8:4978 if sources[1]!=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_sources+2 - bne + - cpy p8v_sources+2+1 - beq label_asm_614_else -+ - ; source: test_word_equalities.p8:4979 fail_word(400,32767) - lda #<$0190 - ldy #>$0190 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_613_afterif -label_asm_614_else - ; source: test_word_equalities.p8:4981 cx16.r0L++ - inc cx16.r0L -label_asm_613_afterif - ; source: test_word_equalities.p8:4983 verify_success(128) - lda #$80 - jmp p8b_main.p8s_verify_success - ; source: test_word_equalities.p8:4028 sub test_not_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -p8v_sources .sint $0000, $0000 -p8v_values .sint $0000, $0000 - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $44, $41, $54, $41, $54, $59, $50, $45 - .byte $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[]: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[]: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 - - ; source: test_word_equalities.p8:14 txt.print("\n(in)equality tests for datatype: ") - ; source: test_word_equalities.p8:18 txt.print("==0: ") - ; source: test_word_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_word_equalities.p8:22 txt.print("\n==number: ") - ; source: test_word_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_word_equalities.p8:26 txt.print("\n==var: ") - ; source: test_word_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_word_equalities.p8:30 txt.print("\n==array[]: ") - ; source: test_word_equalities.p8:32 txt.print("\n!=array[]: ") - ; source: test_word_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_word_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_word_equalities.p8:45 txt.print(" **failed** ") - ; source: test_word_equalities.p8:47 txt.print(" success, expected ") - ; source: test_word_equalities.p8:53 txt.print(" **fail#") - ; source: test_word_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_equalities.p8 b/compiler/test/comparisons/test_word_equalities.p8 deleted file mode 100644 index cb8fa13de..000000000 --- a/compiler/test/comparisons/test_word_equalities.p8 +++ /dev/null @@ -1,4987 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[]: ") - test_is_array() - txt.print("\n!=array[]: ") - test_not_array() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx, byte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_b(v1) - txt.print(" **") - } - - sub fail_ubyte(uword idx, ubyte v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_ub(v1) - txt.print(" **") - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - sub fail_float(uword idx, float v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - floats.print(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - word @shared x - success = 0 - - x=0 - ; direct jump - if x==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x==0 - success++ - - ; with else - if x==0 - success++ - else - cx16.r0L++ - - x = -9999 - ; direct jump - if x==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x==0 - success-- - - ; with else - if x==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - word @shared x - success = 0 - - x=-9999 - ; direct jump - if x!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if x!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if x!=0 - success++ - - ; with else - if x!=0 - success++ - else - cx16.r0L++ - - x = 0 - ; direct jump - if x!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if x!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if x!=0 - success-- - - ; with else - if x!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - word @shared x - success = 0 - x=-21829 - ; direct jump - if x==-21829 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==-21829 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==-21829 - success++ - - ; with else - if x==-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x==170 - goto lbl2a - goto skip2a -lbl2a: fail_word(1,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==170 - goto cx16.r3 - goto skip2b -lbl2b: fail_word(2,-21829) -skip2b: - ; no else - if x==170 - fail_word(3,-21829) - - ; with else - if x==170 - fail_word(4,-21829) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl3a - goto skip3a -lbl3a: fail_word(5,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==30464 - goto cx16.r3 - goto skip3b -lbl3b: fail_word(6,-21829) -skip3b: - ; no else - if x==30464 - fail_word(7,-21829) - - ; with else - if x==30464 - fail_word(8,-21829) - else - cx16.r0L++ - - ; direct jump - if x==32767 - goto lbl4a - goto skip4a -lbl4a: fail_word(9,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==32767 - goto cx16.r3 - goto skip4b -lbl4b: fail_word(10,-21829) -skip4b: - ; no else - if x==32767 - fail_word(11,-21829) - - ; with else - if x==32767 - fail_word(12,-21829) - else - cx16.r0L++ - - x=0 - ; direct jump - if x==-21829 - goto lbl5a - goto skip5a -lbl5a: fail_word(13,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==-21829 - goto cx16.r3 - goto skip5b -lbl5b: fail_word(14,0) -skip5b: - ; no else - if x==-21829 - fail_word(15,0) - - ; with else - if x==-21829 - fail_word(16,0) - else - cx16.r0L++ - - ; direct jump - if x==170 - goto lbl6a - goto skip6a -lbl6a: fail_word(17,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==170 - goto cx16.r3 - goto skip6b -lbl6b: fail_word(18,0) -skip6b: - ; no else - if x==170 - fail_word(19,0) - - ; with else - if x==170 - fail_word(20,0) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl7a - goto skip7a -lbl7a: fail_word(21,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==30464 - goto cx16.r3 - goto skip7b -lbl7b: fail_word(22,0) -skip7b: - ; no else - if x==30464 - fail_word(23,0) - - ; with else - if x==30464 - fail_word(24,0) - else - cx16.r0L++ - - ; direct jump - if x==32767 - goto lbl8a - goto skip8a -lbl8a: fail_word(25,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==32767 - goto cx16.r3 - goto skip8b -lbl8b: fail_word(26,0) -skip8b: - ; no else - if x==32767 - fail_word(27,0) - - ; with else - if x==32767 - fail_word(28,0) - else - cx16.r0L++ - - x=170 - ; direct jump - if x==-21829 - goto lbl9a - goto skip9a -lbl9a: fail_word(29,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==-21829 - goto cx16.r3 - goto skip9b -lbl9b: fail_word(30,170) -skip9b: - ; no else - if x==-21829 - fail_word(31,170) - - ; with else - if x==-21829 - fail_word(32,170) - else - cx16.r0L++ - - ; direct jump - if x==170 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==170 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x==170 - success++ - - ; with else - if x==170 - success++ - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl11a - goto skip11a -lbl11a: fail_word(33,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==30464 - goto cx16.r3 - goto skip11b -lbl11b: fail_word(34,170) -skip11b: - ; no else - if x==30464 - fail_word(35,170) - - ; with else - if x==30464 - fail_word(36,170) - else - cx16.r0L++ - - ; direct jump - if x==32767 - goto lbl12a - goto skip12a -lbl12a: fail_word(37,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==32767 - goto cx16.r3 - goto skip12b -lbl12b: fail_word(38,170) -skip12b: - ; no else - if x==32767 - fail_word(39,170) - - ; with else - if x==32767 - fail_word(40,170) - else - cx16.r0L++ - - x=30464 - ; direct jump - if x==-21829 - goto lbl13a - goto skip13a -lbl13a: fail_word(41,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x==-21829 - goto cx16.r3 - goto skip13b -lbl13b: fail_word(42,30464) -skip13b: - ; no else - if x==-21829 - fail_word(43,30464) - - ; with else - if x==-21829 - fail_word(44,30464) - else - cx16.r0L++ - - ; direct jump - if x==170 - goto lbl14a - goto skip14a -lbl14a: fail_word(45,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x==170 - goto cx16.r3 - goto skip14b -lbl14b: fail_word(46,30464) -skip14b: - ; no else - if x==170 - fail_word(47,30464) - - ; with else - if x==170 - fail_word(48,30464) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x==30464 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x==30464 - success++ - - ; with else - if x==30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x==32767 - goto lbl16a - goto skip16a -lbl16a: fail_word(49,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x==32767 - goto cx16.r3 - goto skip16b -lbl16b: fail_word(50,30464) -skip16b: - ; no else - if x==32767 - fail_word(51,30464) - - ; with else - if x==32767 - fail_word(52,30464) - else - cx16.r0L++ - - x=32767 - ; direct jump - if x==-21829 - goto lbl17a - goto skip17a -lbl17a: fail_word(53,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x==-21829 - goto cx16.r3 - goto skip17b -lbl17b: fail_word(54,32767) -skip17b: - ; no else - if x==-21829 - fail_word(55,32767) - - ; with else - if x==-21829 - fail_word(56,32767) - else - cx16.r0L++ - - ; direct jump - if x==170 - goto lbl18a - goto skip18a -lbl18a: fail_word(57,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x==170 - goto cx16.r3 - goto skip18b -lbl18b: fail_word(58,32767) -skip18b: - ; no else - if x==170 - fail_word(59,32767) - - ; with else - if x==170 - fail_word(60,32767) - else - cx16.r0L++ - - ; direct jump - if x==30464 - goto lbl19a - goto skip19a -lbl19a: fail_word(61,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x==30464 - goto cx16.r3 - goto skip19b -lbl19b: fail_word(62,32767) -skip19b: - ; no else - if x==30464 - fail_word(63,32767) - - ; with else - if x==30464 - fail_word(64,32767) - else - cx16.r0L++ - - ; direct jump - if x==32767 - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x==32767 - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x==32767 - success++ - - ; with else - if x==32767 - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_number() { - word @shared x - success = 0 - x=-21829 - ; direct jump - if x!=-21829 - goto lbl1a - goto skip1a -lbl1a: fail_word(65,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=-21829 - goto cx16.r3 - goto skip1b -lbl1b: fail_word(66,-21829) -skip1b: - ; no else - if x!=-21829 - fail_word(67,-21829) - - ; with else - if x!=-21829 - fail_word(68,-21829) - else - cx16.r0L++ - - ; direct jump - if x!=170 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=170 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=170 - success++ - - ; with else - if x!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=30464 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=32767 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=32767 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=32767 - success++ - - ; with else - if x!=32767 - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x!=-21829 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=-21829 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=-21829 - success++ - - ; with else - if x!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=170 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=170 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=170 - success++ - - ; with else - if x!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=30464 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=32767 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=32767 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x!=32767 - success++ - - ; with else - if x!=32767 - success++ - else - cx16.r0L++ - - x=170 - ; direct jump - if x!=-21829 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=-21829 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=-21829 - success++ - - ; with else - if x!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=170 - goto lbl10a - goto skip10a -lbl10a: fail_word(69,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=170 - goto cx16.r3 - goto skip10b -lbl10b: fail_word(70,170) -skip10b: - ; no else - if x!=170 - fail_word(71,170) - - ; with else - if x!=170 - fail_word(72,170) - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=30464 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=32767 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=32767 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x!=32767 - success++ - - ; with else - if x!=32767 - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x!=-21829 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x!=-21829 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x!=-21829 - success++ - - ; with else - if x!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=170 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x!=170 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x!=170 - success++ - - ; with else - if x!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl15a - goto skip15a -lbl15a: fail_word(73,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x!=30464 - goto cx16.r3 - goto skip15b -lbl15b: fail_word(74,30464) -skip15b: - ; no else - if x!=30464 - fail_word(75,30464) - - ; with else - if x!=30464 - fail_word(76,30464) - else - cx16.r0L++ - - ; direct jump - if x!=32767 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x!=32767 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x!=32767 - success++ - - ; with else - if x!=32767 - success++ - else - cx16.r0L++ - - x=32767 - ; direct jump - if x!=-21829 - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x!=-21829 - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x!=-21829 - success++ - - ; with else - if x!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=170 - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x!=170 - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x!=170 - success++ - - ; with else - if x!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=30464 - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x!=30464 - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x!=30464 - success++ - - ; with else - if x!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x!=32767 - goto lbl20a - goto skip20a -lbl20a: fail_word(77,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x!=32767 - goto cx16.r3 - goto skip20b -lbl20b: fail_word(78,32767) -skip20b: - ; no else - if x!=32767 - fail_word(79,32767) - - ; with else - if x!=32767 - fail_word(80,32767) - else - cx16.r0L++ - - verify_success(64) -} - sub test_is_var() { - word @shared x, value - success = 0 - x=-21829 - value=-21829 - ; direct jump - if x==value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x==value - goto lbl2a - goto skip2a -lbl2a: fail_word(81,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==value - goto cx16.r3 - goto skip2b -lbl2b: fail_word(82,-21829) -skip2b: - ; no else - if x==value - fail_word(83,-21829) - - ; with else - if x==value - fail_word(84,-21829) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl3a - goto skip3a -lbl3a: fail_word(85,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==value - goto cx16.r3 - goto skip3b -lbl3b: fail_word(86,-21829) -skip3b: - ; no else - if x==value - fail_word(87,-21829) - - ; with else - if x==value - fail_word(88,-21829) - else - cx16.r0L++ - - value=32767 - ; direct jump - if x==value - goto lbl4a - goto skip4a -lbl4a: fail_word(89,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==value - goto cx16.r3 - goto skip4b -lbl4b: fail_word(90,-21829) -skip4b: - ; no else - if x==value - fail_word(91,-21829) - - ; with else - if x==value - fail_word(92,-21829) - else - cx16.r0L++ - - x=0 - value=-21829 - ; direct jump - if x==value - goto lbl5a - goto skip5a -lbl5a: fail_word(93,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==value - goto cx16.r3 - goto skip5b -lbl5b: fail_word(94,0) -skip5b: - ; no else - if x==value - fail_word(95,0) - - ; with else - if x==value - fail_word(96,0) - else - cx16.r0L++ - - value=170 - ; direct jump - if x==value - goto lbl6a - goto skip6a -lbl6a: fail_word(97,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==value - goto cx16.r3 - goto skip6b -lbl6b: fail_word(98,0) -skip6b: - ; no else - if x==value - fail_word(99,0) - - ; with else - if x==value - fail_word(100,0) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl7a - goto skip7a -lbl7a: fail_word(101,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==value - goto cx16.r3 - goto skip7b -lbl7b: fail_word(102,0) -skip7b: - ; no else - if x==value - fail_word(103,0) - - ; with else - if x==value - fail_word(104,0) - else - cx16.r0L++ - - value=32767 - ; direct jump - if x==value - goto lbl8a - goto skip8a -lbl8a: fail_word(105,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==value - goto cx16.r3 - goto skip8b -lbl8b: fail_word(106,0) -skip8b: - ; no else - if x==value - fail_word(107,0) - - ; with else - if x==value - fail_word(108,0) - else - cx16.r0L++ - - x=170 - value=-21829 - ; direct jump - if x==value - goto lbl9a - goto skip9a -lbl9a: fail_word(109,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==value - goto cx16.r3 - goto skip9b -lbl9b: fail_word(110,170) -skip9b: - ; no else - if x==value - fail_word(111,170) - - ; with else - if x==value - fail_word(112,170) - else - cx16.r0L++ - - value=170 - ; direct jump - if x==value - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==value - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl11a - goto skip11a -lbl11a: fail_word(113,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==value - goto cx16.r3 - goto skip11b -lbl11b: fail_word(114,170) -skip11b: - ; no else - if x==value - fail_word(115,170) - - ; with else - if x==value - fail_word(116,170) - else - cx16.r0L++ - - value=32767 - ; direct jump - if x==value - goto lbl12a - goto skip12a -lbl12a: fail_word(117,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==value - goto cx16.r3 - goto skip12b -lbl12b: fail_word(118,170) -skip12b: - ; no else - if x==value - fail_word(119,170) - - ; with else - if x==value - fail_word(120,170) - else - cx16.r0L++ - - x=30464 - value=-21829 - ; direct jump - if x==value - goto lbl13a - goto skip13a -lbl13a: fail_word(121,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x==value - goto cx16.r3 - goto skip13b -lbl13b: fail_word(122,30464) -skip13b: - ; no else - if x==value - fail_word(123,30464) - - ; with else - if x==value - fail_word(124,30464) - else - cx16.r0L++ - - value=170 - ; direct jump - if x==value - goto lbl14a - goto skip14a -lbl14a: fail_word(125,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x==value - goto cx16.r3 - goto skip14b -lbl14b: fail_word(126,30464) -skip14b: - ; no else - if x==value - fail_word(127,30464) - - ; with else - if x==value - fail_word(128,30464) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x==value - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x==value - goto lbl16a - goto skip16a -lbl16a: fail_word(129,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x==value - goto cx16.r3 - goto skip16b -lbl16b: fail_word(130,30464) -skip16b: - ; no else - if x==value - fail_word(131,30464) - - ; with else - if x==value - fail_word(132,30464) - else - cx16.r0L++ - - x=32767 - value=-21829 - ; direct jump - if x==value - goto lbl17a - goto skip17a -lbl17a: fail_word(133,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x==value - goto cx16.r3 - goto skip17b -lbl17b: fail_word(134,32767) -skip17b: - ; no else - if x==value - fail_word(135,32767) - - ; with else - if x==value - fail_word(136,32767) - else - cx16.r0L++ - - value=170 - ; direct jump - if x==value - goto lbl18a - goto skip18a -lbl18a: fail_word(137,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x==value - goto cx16.r3 - goto skip18b -lbl18b: fail_word(138,32767) -skip18b: - ; no else - if x==value - fail_word(139,32767) - - ; with else - if x==value - fail_word(140,32767) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x==value - goto lbl19a - goto skip19a -lbl19a: fail_word(141,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x==value - goto cx16.r3 - goto skip19b -lbl19b: fail_word(142,32767) -skip19b: - ; no else - if x==value - fail_word(143,32767) - - ; with else - if x==value - fail_word(144,32767) - else - cx16.r0L++ - - value=32767 - ; direct jump - if x==value - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x==value - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x==value - success++ - - ; with else - if x==value - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_var() { - word @shared x, value - success = 0 - x=-21829 - value=-21829 - ; direct jump - if x!=value - goto lbl1a - goto skip1a -lbl1a: fail_word(145,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=value - goto cx16.r3 - goto skip1b -lbl1b: fail_word(146,-21829) -skip1b: - ; no else - if x!=value - fail_word(147,-21829) - - ; with else - if x!=value - fail_word(148,-21829) - else - cx16.r0L++ - - value=170 - ; direct jump - if x!=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x!=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=0 - value=-21829 - ; direct jump - if x!=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x!=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x!=value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=170 - value=-21829 - ; direct jump - if x!=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x!=value - goto lbl10a - goto skip10a -lbl10a: fail_word(149,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=value - goto cx16.r3 - goto skip10b -lbl10b: fail_word(150,170) -skip10b: - ; no else - if x!=value - fail_word(151,170) - - ; with else - if x!=value - fail_word(152,170) - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=value - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x!=value - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=value - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=30464 - value=-21829 - ; direct jump - if x!=value - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x!=value - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x!=value - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x!=value - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl15a - goto skip15a -lbl15a: fail_word(153,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x!=value - goto cx16.r3 - goto skip15b -lbl15b: fail_word(154,30464) -skip15b: - ; no else - if x!=value - fail_word(155,30464) - - ; with else - if x!=value - fail_word(156,30464) - else - cx16.r0L++ - - value=32767 - ; direct jump - if x!=value - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x!=value - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - x=32767 - value=-21829 - ; direct jump - if x!=value - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x!=value - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x!=value - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x!=value - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x!=value - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x!=value - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x!=value - success++ - - ; with else - if x!=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x!=value - goto lbl20a - goto skip20a -lbl20a: fail_word(157,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x!=value - goto cx16.r3 - goto skip20b -lbl20b: fail_word(158,32767) -skip20b: - ; no else - if x!=value - fail_word(159,32767) - - ; with else - if x!=value - fail_word(160,32767) - else - cx16.r0L++ - - verify_success(64) -} - sub test_is_expr() { - word @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-21829 - ; direct jump - if x==cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x==cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+170-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: fail_word(161,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: fail_word(162,-21829) -skip2b: - ; no else - if x==cx16.r4s+170-cx16.r5s - fail_word(163,-21829) - - ; with else - if x==cx16.r4s+170-cx16.r5s - fail_word(164,-21829) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+30464-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: fail_word(165,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: fail_word(166,-21829) -skip3b: - ; no else - if x==cx16.r4s+30464-cx16.r5s - fail_word(167,-21829) - - ; with else - if x==cx16.r4s+30464-cx16.r5s - fail_word(168,-21829) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+32767-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: fail_word(169,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: fail_word(170,-21829) -skip4b: - ; no else - if x==cx16.r4s+32767-cx16.r5s - fail_word(171,-21829) - - ; with else - if x==cx16.r4s+32767-cx16.r5s - fail_word(172,-21829) - else - cx16.r0L++ - - x=0 - ; direct jump - if x==cx16.r4s+-21829-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: fail_word(173,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: fail_word(174,0) -skip5b: - ; no else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(175,0) - - ; with else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(176,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+170-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: fail_word(177,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: fail_word(178,0) -skip6b: - ; no else - if x==cx16.r4s+170-cx16.r5s - fail_word(179,0) - - ; with else - if x==cx16.r4s+170-cx16.r5s - fail_word(180,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+30464-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: fail_word(181,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: fail_word(182,0) -skip7b: - ; no else - if x==cx16.r4s+30464-cx16.r5s - fail_word(183,0) - - ; with else - if x==cx16.r4s+30464-cx16.r5s - fail_word(184,0) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+32767-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: fail_word(185,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: fail_word(186,0) -skip8b: - ; no else - if x==cx16.r4s+32767-cx16.r5s - fail_word(187,0) - - ; with else - if x==cx16.r4s+32767-cx16.r5s - fail_word(188,0) - else - cx16.r0L++ - - x=170 - ; direct jump - if x==cx16.r4s+-21829-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: fail_word(189,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: fail_word(190,170) -skip9b: - ; no else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(191,170) - - ; with else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(192,170) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+170-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x==cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x==cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+30464-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: fail_word(193,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: fail_word(194,170) -skip11b: - ; no else - if x==cx16.r4s+30464-cx16.r5s - fail_word(195,170) - - ; with else - if x==cx16.r4s+30464-cx16.r5s - fail_word(196,170) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+32767-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: fail_word(197,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: fail_word(198,170) -skip12b: - ; no else - if x==cx16.r4s+32767-cx16.r5s - fail_word(199,170) - - ; with else - if x==cx16.r4s+32767-cx16.r5s - fail_word(200,170) - else - cx16.r0L++ - - x=30464 - ; direct jump - if x==cx16.r4s+-21829-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: fail_word(201,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: fail_word(202,30464) -skip13b: - ; no else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(203,30464) - - ; with else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(204,30464) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+170-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: fail_word(205,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: fail_word(206,30464) -skip14b: - ; no else - if x==cx16.r4s+170-cx16.r5s - fail_word(207,30464) - - ; with else - if x==cx16.r4s+170-cx16.r5s - fail_word(208,30464) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+30464-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x==cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x==cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+32767-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: fail_word(209,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: fail_word(210,30464) -skip16b: - ; no else - if x==cx16.r4s+32767-cx16.r5s - fail_word(211,30464) - - ; with else - if x==cx16.r4s+32767-cx16.r5s - fail_word(212,30464) - else - cx16.r0L++ - - x=32767 - ; direct jump - if x==cx16.r4s+-21829-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: fail_word(213,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: fail_word(214,32767) -skip17b: - ; no else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(215,32767) - - ; with else - if x==cx16.r4s+-21829-cx16.r5s - fail_word(216,32767) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+170-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: fail_word(217,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: fail_word(218,32767) -skip18b: - ; no else - if x==cx16.r4s+170-cx16.r5s - fail_word(219,32767) - - ; with else - if x==cx16.r4s+170-cx16.r5s - fail_word(220,32767) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+30464-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: fail_word(221,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: fail_word(222,32767) -skip19b: - ; no else - if x==cx16.r4s+30464-cx16.r5s - fail_word(223,32767) - - ; with else - if x==cx16.r4s+30464-cx16.r5s - fail_word(224,32767) - else - cx16.r0L++ - - ; direct jump - if x==cx16.r4s+32767-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x==cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x==cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_expr() { - word @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-21829 - ; direct jump - if x!=cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: fail_word(225,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: fail_word(226,-21829) -skip1b: - ; no else - if x!=cx16.r4s+-21829-cx16.r5s - fail_word(227,-21829) - - ; with else - if x!=cx16.r4s+-21829-cx16.r5s - fail_word(228,-21829) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+170-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+30464-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+32767-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x!=cx16.r4s+-21829-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+170-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+30464-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+32767-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=170 - ; direct jump - if x!=cx16.r4s+-21829-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+170-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: fail_word(229,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: fail_word(230,170) -skip10b: - ; no else - if x!=cx16.r4s+170-cx16.r5s - fail_word(231,170) - - ; with else - if x!=cx16.r4s+170-cx16.r5s - fail_word(232,170) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+30464-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+32767-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x!=cx16.r4s+-21829-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+170-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+30464-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: fail_word(233,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: fail_word(234,30464) -skip15b: - ; no else - if x!=cx16.r4s+30464-cx16.r5s - fail_word(235,30464) - - ; with else - if x!=cx16.r4s+30464-cx16.r5s - fail_word(236,30464) - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+32767-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=32767 - ; direct jump - if x!=cx16.r4s+-21829-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+170-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+30464-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x!=cx16.r4s+32767-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: fail_word(237,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: fail_word(238,32767) -skip20b: - ; no else - if x!=cx16.r4s+32767-cx16.r5s - fail_word(239,32767) - - ; with else - if x!=cx16.r4s+32767-cx16.r5s - fail_word(240,32767) - else - cx16.r0L++ - - verify_success(64) -} - sub test_is_array() { - word @shared x - word[] values = [0, 0] - word[] sources = [0, 0] - success = 0 - x=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if x==values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x==values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(241,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(242,-21829) -skip2b: - ; no else - if x==values[1] - fail_word(243,-21829) - - ; with else - if x==values[1] - fail_word(244,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: fail_word(245,-21829) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_word(246,-21829) -skip2d: - ; no else - if sources[1]==values[1] - fail_word(247,-21829) - - ; with else - if sources[1]==values[1] - fail_word(248,-21829) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(249,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(250,-21829) -skip3b: - ; no else - if x==values[1] - fail_word(251,-21829) - - ; with else - if x==values[1] - fail_word(252,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl3c - goto skip3c -lbl3c: fail_word(253,-21829) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]==values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_word(254,-21829) -skip3d: - ; no else - if sources[1]==values[1] - fail_word(255,-21829) - - ; with else - if sources[1]==values[1] - fail_word(256,-21829) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x==values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(257,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x==values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(258,-21829) -skip4b: - ; no else - if x==values[1] - fail_word(259,-21829) - - ; with else - if x==values[1] - fail_word(260,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl4c - goto skip4c -lbl4c: fail_word(261,-21829) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]==values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_word(262,-21829) -skip4d: - ; no else - if sources[1]==values[1] - fail_word(263,-21829) - - ; with else - if sources[1]==values[1] - fail_word(264,-21829) - else - cx16.r0L++ - - x=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if x==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(265,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(266,0) -skip5b: - ; no else - if x==values[1] - fail_word(267,0) - - ; with else - if x==values[1] - fail_word(268,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl5c - goto skip5c -lbl5c: fail_word(269,0) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]==values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_word(270,0) -skip5d: - ; no else - if sources[1]==values[1] - fail_word(271,0) - - ; with else - if sources[1]==values[1] - fail_word(272,0) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x==values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(273,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x==values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(274,0) -skip6b: - ; no else - if x==values[1] - fail_word(275,0) - - ; with else - if x==values[1] - fail_word(276,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl6c - goto skip6c -lbl6c: fail_word(277,0) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]==values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_word(278,0) -skip6d: - ; no else - if sources[1]==values[1] - fail_word(279,0) - - ; with else - if sources[1]==values[1] - fail_word(280,0) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(281,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x==values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(282,0) -skip7b: - ; no else - if x==values[1] - fail_word(283,0) - - ; with else - if x==values[1] - fail_word(284,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl7c - goto skip7c -lbl7c: fail_word(285,0) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]==values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_word(286,0) -skip7d: - ; no else - if sources[1]==values[1] - fail_word(287,0) - - ; with else - if sources[1]==values[1] - fail_word(288,0) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x==values[1] - goto lbl8a - goto skip8a -lbl8a: fail_word(289,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x==values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_word(290,0) -skip8b: - ; no else - if x==values[1] - fail_word(291,0) - - ; with else - if x==values[1] - fail_word(292,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl8c - goto skip8c -lbl8c: fail_word(293,0) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]==values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_word(294,0) -skip8d: - ; no else - if sources[1]==values[1] - fail_word(295,0) - - ; with else - if sources[1]==values[1] - fail_word(296,0) - else - cx16.r0L++ - - x=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if x==values[1] - goto lbl9a - goto skip9a -lbl9a: fail_word(297,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x==values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_word(298,170) -skip9b: - ; no else - if x==values[1] - fail_word(299,170) - - ; with else - if x==values[1] - fail_word(300,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl9c - goto skip9c -lbl9c: fail_word(301,170) -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]==values[1] - goto cx16.r3 - goto skip9d -lbl9d: fail_word(302,170) -skip9d: - ; no else - if sources[1]==values[1] - fail_word(303,170) - - ; with else - if sources[1]==values[1] - fail_word(304,170) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x==values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x==values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]==values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(305,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x==values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(306,170) -skip11b: - ; no else - if x==values[1] - fail_word(307,170) - - ; with else - if x==values[1] - fail_word(308,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl11c - goto skip11c -lbl11c: fail_word(309,170) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]==values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_word(310,170) -skip11d: - ; no else - if sources[1]==values[1] - fail_word(311,170) - - ; with else - if sources[1]==values[1] - fail_word(312,170) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x==values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(313,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x==values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(314,170) -skip12b: - ; no else - if x==values[1] - fail_word(315,170) - - ; with else - if x==values[1] - fail_word(316,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl12c - goto skip12c -lbl12c: fail_word(317,170) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]==values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_word(318,170) -skip12d: - ; no else - if sources[1]==values[1] - fail_word(319,170) - - ; with else - if sources[1]==values[1] - fail_word(320,170) - else - cx16.r0L++ - - x=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if x==values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(321,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x==values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(322,30464) -skip13b: - ; no else - if x==values[1] - fail_word(323,30464) - - ; with else - if x==values[1] - fail_word(324,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl13c - goto skip13c -lbl13c: fail_word(325,30464) -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]==values[1] - goto cx16.r3 - goto skip13d -lbl13d: fail_word(326,30464) -skip13d: - ; no else - if sources[1]==values[1] - fail_word(327,30464) - - ; with else - if sources[1]==values[1] - fail_word(328,30464) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x==values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(329,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x==values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(330,30464) -skip14b: - ; no else - if x==values[1] - fail_word(331,30464) - - ; with else - if x==values[1] - fail_word(332,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl14c - goto skip14c -lbl14c: fail_word(333,30464) -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]==values[1] - goto cx16.r3 - goto skip14d -lbl14d: fail_word(334,30464) -skip14d: - ; no else - if sources[1]==values[1] - fail_word(335,30464) - - ; with else - if sources[1]==values[1] - fail_word(336,30464) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x==values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl15c - goto skip15c -lbl15c: success++ -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]==values[1] - goto cx16.r3 - goto skip15d -lbl15d: success++ -skip15d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x==values[1] - goto lbl16a - goto skip16a -lbl16a: fail_word(337,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x==values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_word(338,30464) -skip16b: - ; no else - if x==values[1] - fail_word(339,30464) - - ; with else - if x==values[1] - fail_word(340,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl16c - goto skip16c -lbl16c: fail_word(341,30464) -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]==values[1] - goto cx16.r3 - goto skip16d -lbl16d: fail_word(342,30464) -skip16d: - ; no else - if sources[1]==values[1] - fail_word(343,30464) - - ; with else - if sources[1]==values[1] - fail_word(344,30464) - else - cx16.r0L++ - - x=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if x==values[1] - goto lbl17a - goto skip17a -lbl17a: fail_word(345,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x==values[1] - goto cx16.r3 - goto skip17b -lbl17b: fail_word(346,32767) -skip17b: - ; no else - if x==values[1] - fail_word(347,32767) - - ; with else - if x==values[1] - fail_word(348,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl17c - goto skip17c -lbl17c: fail_word(349,32767) -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]==values[1] - goto cx16.r3 - goto skip17d -lbl17d: fail_word(350,32767) -skip17d: - ; no else - if sources[1]==values[1] - fail_word(351,32767) - - ; with else - if sources[1]==values[1] - fail_word(352,32767) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x==values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(353,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x==values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(354,32767) -skip18b: - ; no else - if x==values[1] - fail_word(355,32767) - - ; with else - if x==values[1] - fail_word(356,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl18c - goto skip18c -lbl18c: fail_word(357,32767) -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]==values[1] - goto cx16.r3 - goto skip18d -lbl18d: fail_word(358,32767) -skip18d: - ; no else - if sources[1]==values[1] - fail_word(359,32767) - - ; with else - if sources[1]==values[1] - fail_word(360,32767) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x==values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(361,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x==values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(362,32767) -skip19b: - ; no else - if x==values[1] - fail_word(363,32767) - - ; with else - if x==values[1] - fail_word(364,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl19c - goto skip19c -lbl19c: fail_word(365,32767) -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]==values[1] - goto cx16.r3 - goto skip19d -lbl19d: fail_word(366,32767) -skip19d: - ; no else - if sources[1]==values[1] - fail_word(367,32767) - - ; with else - if sources[1]==values[1] - fail_word(368,32767) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x==values[1] - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x==values[1] - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x==values[1] - success++ - - ; with else - if x==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl20c - goto skip20c -lbl20c: success++ -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]==values[1] - goto cx16.r3 - goto skip20d -lbl20d: success++ -skip20d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(32) -} - sub test_not_array() { - word @shared x - word[] values = [0, 0] - word[] sources = [0, 0] - success = 0 - x=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if x!=values[1] - goto lbl1a - goto skip1a -lbl1a: fail_word(369,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_word(370,-21829) -skip1b: - ; no else - if x!=values[1] - fail_word(371,-21829) - - ; with else - if x!=values[1] - fail_word(372,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: fail_word(373,-21829) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_word(374,-21829) -skip1d: - ; no else - if sources[1]!=values[1] - fail_word(375,-21829) - - ; with else - if sources[1]!=values[1] - fail_word(376,-21829) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]!=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x!=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]!=values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if x!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]!=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x!=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]!=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x!=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl7c - goto skip7c -lbl7c: success++ -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]!=values[1] - goto cx16.r3 - goto skip7d -lbl7d: success++ -skip7d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x!=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x!=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]!=values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if x!=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x!=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]!=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x!=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(377,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x!=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(378,170) -skip10b: - ; no else - if x!=values[1] - fail_word(379,170) - - ; with else - if x!=values[1] - fail_word(380,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl10c - goto skip10c -lbl10c: fail_word(381,170) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]!=values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_word(382,170) -skip10d: - ; no else - if sources[1]!=values[1] - fail_word(383,170) - - ; with else - if sources[1]!=values[1] - fail_word(384,170) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x!=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]!=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x!=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x!=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl12c - goto skip12c -lbl12c: success++ -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]!=values[1] - goto cx16.r3 - goto skip12d -lbl12d: success++ -skip12d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if x!=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x!=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl13c - goto skip13c -lbl13c: success++ -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]!=values[1] - goto cx16.r3 - goto skip13d -lbl13d: success++ -skip13d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x!=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x!=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl14c - goto skip14c -lbl14c: success++ -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]!=values[1] - goto cx16.r3 - goto skip14d -lbl14d: success++ -skip14d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_word(385,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x!=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_word(386,30464) -skip15b: - ; no else - if x!=values[1] - fail_word(387,30464) - - ; with else - if x!=values[1] - fail_word(388,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl15c - goto skip15c -lbl15c: fail_word(389,30464) -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]!=values[1] - goto cx16.r3 - goto skip15d -lbl15d: fail_word(390,30464) -skip15d: - ; no else - if sources[1]!=values[1] - fail_word(391,30464) - - ; with else - if sources[1]!=values[1] - fail_word(392,30464) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x!=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x!=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl16c - goto skip16c -lbl16c: success++ -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]!=values[1] - goto cx16.r3 - goto skip16d -lbl16d: success++ -skip16d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - x=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if x!=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x!=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl17c - goto skip17c -lbl17c: success++ -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]!=values[1] - goto cx16.r3 - goto skip17d -lbl17d: success++ -skip17d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x!=values[1] - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x!=values[1] - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl18c - goto skip18c -lbl18c: success++ -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]!=values[1] - goto cx16.r3 - goto skip18d -lbl18d: success++ -skip18d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x!=values[1] - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x!=values[1] - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x!=values[1] - success++ - - ; with else - if x!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl19c - goto skip19c -lbl19c: success++ -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]!=values[1] - goto cx16.r3 - goto skip19d -lbl19d: success++ -skip19d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x!=values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(393,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x!=values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(394,32767) -skip20b: - ; no else - if x!=values[1] - fail_word(395,32767) - - ; with else - if x!=values[1] - fail_word(396,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl20c - goto skip20c -lbl20c: fail_word(397,32767) -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]!=values[1] - goto cx16.r3 - goto skip20d -lbl20d: fail_word(398,32767) -skip20d: - ; no else - if sources[1]!=values[1] - fail_word(399,32767) - - ; with else - if sources[1]!=values[1] - fail_word(400,32767) - else - cx16.r0L++ - - verify_success(128) -} - -} - diff --git a/compiler/test/comparisons/test_word_gt.asm b/compiler/test/comparisons/test_word_gt.asm deleted file mode 100644 index d63db7818..000000000 --- a/compiler/test/comparisons/test_word_gt.asm +++ /dev/null @@ -1,24133 +0,0 @@ -; w65c02 assembly code for 'test_word_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:47 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_gt.p8:9 ubyte success = 0 - ; source: test_word_gt.p8:10 str datatype = "word" - ; source: test_word_gt.p8:11 uword @shared comparison - ; source: test_word_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_gt.p8:14 txt.print("\ngreater-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #number: ") - ldy #>prog8_interned_strings.string_2 - lda #var: ") - ldy #>prog8_interned_strings.string_3 - lda #array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:76 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_word_gt.p8:79 lbl1a: fail_word(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:80 skip1a: -p8l_skip1a - ; source: test_word_gt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:83 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_word_gt.p8:86 lbl1b: fail_word(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:87 skip1b: -p8l_skip1b - ; source: test_word_gt.p8:89 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_gt.p8:90 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_3_afterif - ; source: test_word_gt.p8:93 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_gt.p8:94 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_gt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_word_gt.p8:99 if x>-1 - lda p8v_x+1 - bpl p8l_lbl2a - ; source: test_word_gt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_word_gt.p8:102 lbl2a: fail_word(5) -p8l_lbl2a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:103 skip2a: -p8l_skip2a - ; source: test_word_gt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:106 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_word_gt.p8:109 lbl2b: fail_word(6) -p8l_lbl2b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:110 skip2b: -p8l_skip2b - ; source: test_word_gt.p8:112 if x>-1 - lda p8v_x+1 - bmi label_asm_6_afterif - ; source: test_word_gt.p8:113 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_6_afterif - ; source: test_word_gt.p8:116 if x>-1 - lda p8v_x+1 - bmi label_asm_8_else - ; source: test_word_gt.p8:117 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_gt.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_word_gt.p8:122 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl3a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl3a -+ - ; source: test_word_gt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_word_gt.p8:125 lbl3a: fail_word(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:126 skip3a: -p8l_skip3a - ; source: test_word_gt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:129 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_word_gt.p8:132 lbl3b: fail_word(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:133 skip3b: -p8l_skip3b - ; source: test_word_gt.p8:135 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_9_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_9_afterif -+ - ; source: test_word_gt.p8:136 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_9_afterif - ; source: test_word_gt.p8:139 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_11_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_11_else -+ - ; source: test_word_gt.p8:140 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_gt.p8:142 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_word_gt.p8:145 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gt.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_word_gt.p8:148 lbl4a: fail_word(13) -p8l_lbl4a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:149 skip4a: -p8l_skip4a - ; source: test_word_gt.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:152 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_word_gt.p8:155 lbl4b: fail_word(14) -p8l_lbl4b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:156 skip4b: -p8l_skip4b - ; source: test_word_gt.p8:158 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_12_afterif - ; source: test_word_gt.p8:159 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_12_afterif - ; source: test_word_gt.p8:162 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_14_else - ; source: test_word_gt.p8:163 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_gt.p8:165 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_word_gt.p8:168 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gt.p8:170 goto skip5a - bra p8l_skip5a - ; source: test_word_gt.p8:171 lbl5a: fail_word(17) -p8l_lbl5a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:172 skip5a: -p8l_skip5a - ; source: test_word_gt.p8:174 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:175 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:177 goto skip5b - bra p8l_skip5b - ; source: test_word_gt.p8:178 lbl5b: fail_word(18) -p8l_lbl5b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:179 skip5b: -p8l_skip5b - ; source: test_word_gt.p8:181 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_gt.p8:182 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_15_afterif - ; source: test_word_gt.p8:185 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_gt.p8:186 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_gt.p8:188 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_word_gt.p8:191 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gt.p8:193 goto skip6a - bra p8l_skip6a - ; source: test_word_gt.p8:194 lbl6a: fail_word(21) -p8l_lbl6a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:195 skip6a: -p8l_skip6a - ; source: test_word_gt.p8:197 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:198 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:200 goto skip6b - bra p8l_skip6b - ; source: test_word_gt.p8:201 lbl6b: fail_word(22) -p8l_lbl6b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:202 skip6b: -p8l_skip6b - ; source: test_word_gt.p8:204 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_gt.p8:205 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_18_afterif - ; source: test_word_gt.p8:208 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_gt.p8:209 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_gt.p8:211 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_word_gt.p8:214 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gt.p8:216 goto skip7a - bra p8l_skip7a - ; source: test_word_gt.p8:217 lbl7a: fail_word(25) -p8l_lbl7a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:218 skip7a: -p8l_skip7a - ; source: test_word_gt.p8:220 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:221 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:223 goto skip7b - bra p8l_skip7b - ; source: test_word_gt.p8:224 lbl7b: fail_word(26) -p8l_lbl7b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:225 skip7b: -p8l_skip7b - ; source: test_word_gt.p8:227 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_gt.p8:228 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_21_afterif - ; source: test_word_gt.p8:231 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_gt.p8:232 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_gt.p8:234 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_word_gt.p8:236 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:238 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gt.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_word_gt.p8:241 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:242 skip8a: -p8l_skip8a - ; source: test_word_gt.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:245 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_word_gt.p8:248 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:249 skip8b: -p8l_skip8b - ; source: test_word_gt.p8:251 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_gt.p8:252 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_word_gt.p8:255 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_gt.p8:256 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_gt.p8:258 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_word_gt.p8:261 if x>-1 - lda p8v_x+1 - bpl p8l_lbl9a - ; source: test_word_gt.p8:263 goto skip9a - bra p8l_skip9a - ; source: test_word_gt.p8:264 lbl9a: fail_word(29) -p8l_lbl9a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:265 skip9a: -p8l_skip9a - ; source: test_word_gt.p8:267 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:268 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:270 goto skip9b - bra p8l_skip9b - ; source: test_word_gt.p8:271 lbl9b: fail_word(30) -p8l_lbl9b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:272 skip9b: -p8l_skip9b - ; source: test_word_gt.p8:274 if x>-1 - lda p8v_x+1 - bmi label_asm_27_afterif - ; source: test_word_gt.p8:275 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_27_afterif - ; source: test_word_gt.p8:278 if x>-1 - lda p8v_x+1 - bmi label_asm_29_else - ; source: test_word_gt.p8:279 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_gt.p8:281 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_word_gt.p8:284 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl10a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl10a -+ - ; source: test_word_gt.p8:286 goto skip10a - bra p8l_skip10a - ; source: test_word_gt.p8:287 lbl10a: fail_word(33) -p8l_lbl10a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:288 skip10a: -p8l_skip10a - ; source: test_word_gt.p8:290 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:291 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:293 goto skip10b - bra p8l_skip10b - ; source: test_word_gt.p8:294 lbl10b: fail_word(34) -p8l_lbl10b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:295 skip10b: -p8l_skip10b - ; source: test_word_gt.p8:297 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_30_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_30_afterif -+ - ; source: test_word_gt.p8:298 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_30_afterif - ; source: test_word_gt.p8:301 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_32_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_32_else -+ - ; source: test_word_gt.p8:302 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_gt.p8:304 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_word_gt.p8:307 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gt.p8:309 goto skip11a - bra p8l_skip11a - ; source: test_word_gt.p8:310 lbl11a: fail_word(37) -p8l_lbl11a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:311 skip11a: -p8l_skip11a - ; source: test_word_gt.p8:313 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:314 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:316 goto skip11b - bra p8l_skip11b - ; source: test_word_gt.p8:317 lbl11b: fail_word(38) -p8l_lbl11b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:318 skip11b: -p8l_skip11b - ; source: test_word_gt.p8:320 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_33_afterif - ; source: test_word_gt.p8:321 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_33_afterif - ; source: test_word_gt.p8:324 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_35_else - ; source: test_word_gt.p8:325 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_gt.p8:327 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_word_gt.p8:330 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gt.p8:332 goto skip12a - bra p8l_skip12a - ; source: test_word_gt.p8:333 lbl12a: fail_word(41) -p8l_lbl12a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:334 skip12a: -p8l_skip12a - ; source: test_word_gt.p8:336 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:337 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:339 goto skip12b - bra p8l_skip12b - ; source: test_word_gt.p8:340 lbl12b: fail_word(42) -p8l_lbl12b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:341 skip12b: -p8l_skip12b - ; source: test_word_gt.p8:343 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_gt.p8:344 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_36_afterif - ; source: test_word_gt.p8:347 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_gt.p8:348 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_gt.p8:350 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_word_gt.p8:353 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gt.p8:355 goto skip13a - bra p8l_skip13a - ; source: test_word_gt.p8:356 lbl13a: fail_word(45) -p8l_lbl13a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:357 skip13a: -p8l_skip13a - ; source: test_word_gt.p8:359 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:360 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:362 goto skip13b - bra p8l_skip13b - ; source: test_word_gt.p8:363 lbl13b: fail_word(46) -p8l_lbl13b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:364 skip13b: -p8l_skip13b - ; source: test_word_gt.p8:366 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_gt.p8:367 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_39_afterif - ; source: test_word_gt.p8:370 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_gt.p8:371 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_gt.p8:373 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_word_gt.p8:376 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gt.p8:378 goto skip14a - bra p8l_skip14a - ; source: test_word_gt.p8:379 lbl14a: fail_word(49) -p8l_lbl14a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:380 skip14a: -p8l_skip14a - ; source: test_word_gt.p8:382 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:383 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:385 goto skip14b - bra p8l_skip14b - ; source: test_word_gt.p8:386 lbl14b: fail_word(50) -p8l_lbl14b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:387 skip14b: -p8l_skip14b - ; source: test_word_gt.p8:389 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_gt.p8:390 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_42_afterif - ; source: test_word_gt.p8:393 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_gt.p8:394 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_gt.p8:396 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_word_gt.p8:398 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gt.p8:400 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gt.p8:402 goto skip15a - bra p8l_skip15a - ; source: test_word_gt.p8:403 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:404 skip15a: -p8l_skip15a - ; source: test_word_gt.p8:406 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:407 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:409 goto skip15b - bra p8l_skip15b - ; source: test_word_gt.p8:410 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:411 skip15b: -p8l_skip15b - ; source: test_word_gt.p8:413 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_gt.p8:414 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_word_gt.p8:417 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_gt.p8:418 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_gt.p8:420 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_word_gt.p8:423 if x>-1 - lda p8v_x+1 - bpl p8l_lbl16a - ; source: test_word_gt.p8:425 goto skip16a - bra p8l_skip16a - ; source: test_word_gt.p8:426 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:427 skip16a: -p8l_skip16a - ; source: test_word_gt.p8:429 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:430 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:432 goto skip16b - bra p8l_skip16b - ; source: test_word_gt.p8:433 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:434 skip16b: -p8l_skip16b - ; source: test_word_gt.p8:436 if x>-1 - lda p8v_x+1 - bmi label_asm_48_afterif - ; source: test_word_gt.p8:437 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_word_gt.p8:440 if x>-1 - lda p8v_x+1 - bmi label_asm_50_else - ; source: test_word_gt.p8:441 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_gt.p8:443 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_word_gt.p8:446 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl17a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl17a -+ - ; source: test_word_gt.p8:448 goto skip17a - bra p8l_skip17a - ; source: test_word_gt.p8:449 lbl17a: fail_word(53) -p8l_lbl17a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:450 skip17a: -p8l_skip17a - ; source: test_word_gt.p8:452 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:453 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:455 goto skip17b - bra p8l_skip17b - ; source: test_word_gt.p8:456 lbl17b: fail_word(54) -p8l_lbl17b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:457 skip17b: -p8l_skip17b - ; source: test_word_gt.p8:459 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_51_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_51_afterif -+ - ; source: test_word_gt.p8:460 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_51_afterif - ; source: test_word_gt.p8:463 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_53_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_53_else -+ - ; source: test_word_gt.p8:464 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_gt.p8:466 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_word_gt.p8:469 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gt.p8:471 goto skip18a - bra p8l_skip18a - ; source: test_word_gt.p8:472 lbl18a: fail_word(57) -p8l_lbl18a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:473 skip18a: -p8l_skip18a - ; source: test_word_gt.p8:475 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:476 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:478 goto skip18b - bra p8l_skip18b - ; source: test_word_gt.p8:479 lbl18b: fail_word(58) -p8l_lbl18b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:480 skip18b: -p8l_skip18b - ; source: test_word_gt.p8:482 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_54_afterif - ; source: test_word_gt.p8:483 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_54_afterif - ; source: test_word_gt.p8:486 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_56_else - ; source: test_word_gt.p8:487 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_gt.p8:489 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_word_gt.p8:492 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gt.p8:494 goto skip19a - bra p8l_skip19a - ; source: test_word_gt.p8:495 lbl19a: fail_word(61) -p8l_lbl19a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:496 skip19a: -p8l_skip19a - ; source: test_word_gt.p8:498 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:499 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:501 goto skip19b - bra p8l_skip19b - ; source: test_word_gt.p8:502 lbl19b: fail_word(62) -p8l_lbl19b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:503 skip19b: -p8l_skip19b - ; source: test_word_gt.p8:505 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_gt.p8:506 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_57_afterif - ; source: test_word_gt.p8:509 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_gt.p8:510 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_gt.p8:512 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_word_gt.p8:515 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gt.p8:517 goto skip20a - bra p8l_skip20a - ; source: test_word_gt.p8:518 lbl20a: fail_word(65) -p8l_lbl20a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:519 skip20a: -p8l_skip20a - ; source: test_word_gt.p8:521 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:522 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:524 goto skip20b - bra p8l_skip20b - ; source: test_word_gt.p8:525 lbl20b: fail_word(66) -p8l_lbl20b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:526 skip20b: -p8l_skip20b - ; source: test_word_gt.p8:528 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_gt.p8:529 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_60_afterif - ; source: test_word_gt.p8:532 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_gt.p8:533 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_gt.p8:535 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_word_gt.p8:538 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gt.p8:540 goto skip21a - bra p8l_skip21a - ; source: test_word_gt.p8:541 lbl21a: fail_word(69) -p8l_lbl21a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:542 skip21a: -p8l_skip21a - ; source: test_word_gt.p8:544 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:545 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:547 goto skip21b - bra p8l_skip21b - ; source: test_word_gt.p8:548 lbl21b: fail_word(70) -p8l_lbl21b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:549 skip21b: -p8l_skip21b - ; source: test_word_gt.p8:551 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_gt.p8:552 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_63_afterif - ; source: test_word_gt.p8:555 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_gt.p8:556 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_gt.p8:558 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_word_gt.p8:560 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:562 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gt.p8:564 goto skip22a - bra p8l_skip22a - ; source: test_word_gt.p8:565 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:566 skip22a: -p8l_skip22a - ; source: test_word_gt.p8:568 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:569 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:571 goto skip22b - bra p8l_skip22b - ; source: test_word_gt.p8:572 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:573 skip22b: -p8l_skip22b - ; source: test_word_gt.p8:575 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_gt.p8:576 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_word_gt.p8:579 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_gt.p8:580 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_gt.p8:582 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_word_gt.p8:585 if x>-1 - lda p8v_x+1 - bpl p8l_lbl23a - ; source: test_word_gt.p8:587 goto skip23a - bra p8l_skip23a - ; source: test_word_gt.p8:588 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:589 skip23a: -p8l_skip23a - ; source: test_word_gt.p8:591 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:592 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:594 goto skip23b - bra p8l_skip23b - ; source: test_word_gt.p8:595 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:596 skip23b: -p8l_skip23b - ; source: test_word_gt.p8:598 if x>-1 - lda p8v_x+1 - bmi label_asm_69_afterif - ; source: test_word_gt.p8:599 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_word_gt.p8:602 if x>-1 - lda p8v_x+1 - bmi label_asm_71_else - ; source: test_word_gt.p8:603 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_gt.p8:605 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_word_gt.p8:608 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl24a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl24a -+ - ; source: test_word_gt.p8:610 goto skip24a - bra p8l_skip24a - ; source: test_word_gt.p8:611 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:612 skip24a: -p8l_skip24a - ; source: test_word_gt.p8:614 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:615 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:617 goto skip24b - bra p8l_skip24b - ; source: test_word_gt.p8:618 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:619 skip24b: -p8l_skip24b - ; source: test_word_gt.p8:621 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_72_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_72_afterif -+ - ; source: test_word_gt.p8:622 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_word_gt.p8:625 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_74_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_74_else -+ - ; source: test_word_gt.p8:626 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_gt.p8:628 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_word_gt.p8:631 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gt.p8:633 goto skip25a - bra p8l_skip25a - ; source: test_word_gt.p8:634 lbl25a: fail_word(73) -p8l_lbl25a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:635 skip25a: -p8l_skip25a - ; source: test_word_gt.p8:637 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:638 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:640 goto skip25b - bra p8l_skip25b - ; source: test_word_gt.p8:641 lbl25b: fail_word(74) -p8l_lbl25b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:642 skip25b: -p8l_skip25b - ; source: test_word_gt.p8:644 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_75_afterif - ; source: test_word_gt.p8:645 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_75_afterif - ; source: test_word_gt.p8:648 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_77_else - ; source: test_word_gt.p8:649 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_gt.p8:651 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_word_gt.p8:654 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gt.p8:656 goto skip26a - bra p8l_skip26a - ; source: test_word_gt.p8:657 lbl26a: fail_word(77) -p8l_lbl26a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:658 skip26a: -p8l_skip26a - ; source: test_word_gt.p8:660 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:661 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:663 goto skip26b - bra p8l_skip26b - ; source: test_word_gt.p8:664 lbl26b: fail_word(78) -p8l_lbl26b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:665 skip26b: -p8l_skip26b - ; source: test_word_gt.p8:667 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_gt.p8:668 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_78_afterif - ; source: test_word_gt.p8:671 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_gt.p8:672 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_gt.p8:674 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_word_gt.p8:677 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gt.p8:679 goto skip27a - bra p8l_skip27a - ; source: test_word_gt.p8:680 lbl27a: fail_word(81) -p8l_lbl27a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:681 skip27a: -p8l_skip27a - ; source: test_word_gt.p8:683 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:684 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:686 goto skip27b - bra p8l_skip27b - ; source: test_word_gt.p8:687 lbl27b: fail_word(82) -p8l_lbl27b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:688 skip27b: -p8l_skip27b - ; source: test_word_gt.p8:690 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_gt.p8:691 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_81_afterif - ; source: test_word_gt.p8:694 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_gt.p8:695 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_gt.p8:697 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_word_gt.p8:700 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gt.p8:702 goto skip28a - bra p8l_skip28a - ; source: test_word_gt.p8:703 lbl28a: fail_word(85) -p8l_lbl28a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:704 skip28a: -p8l_skip28a - ; source: test_word_gt.p8:706 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:707 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:709 goto skip28b - bra p8l_skip28b - ; source: test_word_gt.p8:710 lbl28b: fail_word(86) -p8l_lbl28b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:711 skip28b: -p8l_skip28b - ; source: test_word_gt.p8:713 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_gt.p8:714 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_84_afterif - ; source: test_word_gt.p8:717 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_gt.p8:718 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_gt.p8:720 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_word_gt.p8:722 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:724 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gt.p8:726 goto skip29a - bra p8l_skip29a - ; source: test_word_gt.p8:727 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:728 skip29a: -p8l_skip29a - ; source: test_word_gt.p8:730 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:731 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:733 goto skip29b - bra p8l_skip29b - ; source: test_word_gt.p8:734 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:735 skip29b: -p8l_skip29b - ; source: test_word_gt.p8:737 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_gt.p8:738 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_word_gt.p8:741 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_gt.p8:742 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_gt.p8:744 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_word_gt.p8:747 if x>-1 - lda p8v_x+1 - bpl p8l_lbl30a - ; source: test_word_gt.p8:749 goto skip30a - bra p8l_skip30a - ; source: test_word_gt.p8:750 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:751 skip30a: -p8l_skip30a - ; source: test_word_gt.p8:753 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:754 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:756 goto skip30b - bra p8l_skip30b - ; source: test_word_gt.p8:757 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:758 skip30b: -p8l_skip30b - ; source: test_word_gt.p8:760 if x>-1 - lda p8v_x+1 - bmi label_asm_90_afterif - ; source: test_word_gt.p8:761 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_word_gt.p8:764 if x>-1 - lda p8v_x+1 - bmi label_asm_92_else - ; source: test_word_gt.p8:765 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_gt.p8:767 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_word_gt.p8:770 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl31a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl31a -+ - ; source: test_word_gt.p8:772 goto skip31a - bra p8l_skip31a - ; source: test_word_gt.p8:773 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:774 skip31a: -p8l_skip31a - ; source: test_word_gt.p8:776 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:777 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:779 goto skip31b - bra p8l_skip31b - ; source: test_word_gt.p8:780 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:781 skip31b: -p8l_skip31b - ; source: test_word_gt.p8:783 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_93_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_93_afterif -+ - ; source: test_word_gt.p8:784 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_word_gt.p8:787 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_95_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_95_else -+ - ; source: test_word_gt.p8:788 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_gt.p8:790 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_word_gt.p8:793 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gt.p8:795 goto skip32a - bra p8l_skip32a - ; source: test_word_gt.p8:796 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:797 skip32a: -p8l_skip32a - ; source: test_word_gt.p8:799 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:800 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:802 goto skip32b - bra p8l_skip32b - ; source: test_word_gt.p8:803 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:804 skip32b: -p8l_skip32b - ; source: test_word_gt.p8:806 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_96_afterif - ; source: test_word_gt.p8:807 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_word_gt.p8:810 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_98_else - ; source: test_word_gt.p8:811 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_gt.p8:813 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_word_gt.p8:816 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gt.p8:818 goto skip33a - bra p8l_skip33a - ; source: test_word_gt.p8:819 lbl33a: fail_word(89) -p8l_lbl33a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:820 skip33a: -p8l_skip33a - ; source: test_word_gt.p8:822 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:823 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:825 goto skip33b - bra p8l_skip33b - ; source: test_word_gt.p8:826 lbl33b: fail_word(90) -p8l_lbl33b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:827 skip33b: -p8l_skip33b - ; source: test_word_gt.p8:829 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_gt.p8:830 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_99_afterif - ; source: test_word_gt.p8:833 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_gt.p8:834 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_gt.p8:836 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_word_gt.p8:839 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gt.p8:841 goto skip34a - bra p8l_skip34a - ; source: test_word_gt.p8:842 lbl34a: fail_word(93) -p8l_lbl34a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:843 skip34a: -p8l_skip34a - ; source: test_word_gt.p8:845 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:846 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:848 goto skip34b - bra p8l_skip34b - ; source: test_word_gt.p8:849 lbl34b: fail_word(94) -p8l_lbl34b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:850 skip34b: -p8l_skip34b - ; source: test_word_gt.p8:852 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_gt.p8:853 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_102_afterif - ; source: test_word_gt.p8:856 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_gt.p8:857 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_gt.p8:859 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_word_gt.p8:862 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gt.p8:864 goto skip35a - bra p8l_skip35a - ; source: test_word_gt.p8:865 lbl35a: fail_word(97) -p8l_lbl35a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:866 skip35a: -p8l_skip35a - ; source: test_word_gt.p8:868 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:869 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:871 goto skip35b - bra p8l_skip35b - ; source: test_word_gt.p8:872 lbl35b: fail_word(98) -p8l_lbl35b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:873 skip35b: -p8l_skip35b - ; source: test_word_gt.p8:875 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_gt.p8:876 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_105_afterif - ; source: test_word_gt.p8:879 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_gt.p8:880 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_gt.p8:882 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_word_gt.p8:884 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:886 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gt.p8:888 goto skip36a - bra p8l_skip36a - ; source: test_word_gt.p8:889 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:890 skip36a: -p8l_skip36a - ; source: test_word_gt.p8:892 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:893 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:895 goto skip36b - bra p8l_skip36b - ; source: test_word_gt.p8:896 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:897 skip36b: -p8l_skip36b - ; source: test_word_gt.p8:899 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_gt.p8:900 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_word_gt.p8:903 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_gt.p8:904 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_gt.p8:906 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_word_gt.p8:909 if x>-1 - lda p8v_x+1 - bpl p8l_lbl37a - ; source: test_word_gt.p8:911 goto skip37a - bra p8l_skip37a - ; source: test_word_gt.p8:912 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:913 skip37a: -p8l_skip37a - ; source: test_word_gt.p8:915 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:916 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:918 goto skip37b - bra p8l_skip37b - ; source: test_word_gt.p8:919 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:920 skip37b: -p8l_skip37b - ; source: test_word_gt.p8:922 if x>-1 - lda p8v_x+1 - bmi label_asm_111_afterif - ; source: test_word_gt.p8:923 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_word_gt.p8:926 if x>-1 - lda p8v_x+1 - bmi label_asm_113_else - ; source: test_word_gt.p8:927 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_gt.p8:929 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_word_gt.p8:932 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl38a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl38a -+ - ; source: test_word_gt.p8:934 goto skip38a - bra p8l_skip38a - ; source: test_word_gt.p8:935 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:936 skip38a: -p8l_skip38a - ; source: test_word_gt.p8:938 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:939 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:941 goto skip38b - bra p8l_skip38b - ; source: test_word_gt.p8:942 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:943 skip38b: -p8l_skip38b - ; source: test_word_gt.p8:945 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_114_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_114_afterif -+ - ; source: test_word_gt.p8:946 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_word_gt.p8:949 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_116_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_116_else -+ - ; source: test_word_gt.p8:950 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_gt.p8:952 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_word_gt.p8:955 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gt.p8:957 goto skip39a - bra p8l_skip39a - ; source: test_word_gt.p8:958 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:959 skip39a: -p8l_skip39a - ; source: test_word_gt.p8:961 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:962 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:964 goto skip39b - bra p8l_skip39b - ; source: test_word_gt.p8:965 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:966 skip39b: -p8l_skip39b - ; source: test_word_gt.p8:968 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_117_afterif - ; source: test_word_gt.p8:969 success++ - inc p8b_main.p8v_success -label_asm_117_afterif - ; source: test_word_gt.p8:972 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_119_else - ; source: test_word_gt.p8:973 success++ - inc p8b_main.p8v_success - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_gt.p8:975 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_word_gt.p8:978 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gt.p8:980 goto skip40a - bra p8l_skip40a - ; source: test_word_gt.p8:981 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:982 skip40a: -p8l_skip40a - ; source: test_word_gt.p8:984 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:985 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:987 goto skip40b - bra p8l_skip40b - ; source: test_word_gt.p8:988 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:989 skip40b: -p8l_skip40b - ; source: test_word_gt.p8:991 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_gt.p8:992 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_word_gt.p8:995 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_gt.p8:996 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_gt.p8:998 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_word_gt.p8:1001 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gt.p8:1003 goto skip41a - bra p8l_skip41a - ; source: test_word_gt.p8:1004 lbl41a: fail_word(101) -p8l_lbl41a - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1005 skip41a: -p8l_skip41a - ; source: test_word_gt.p8:1007 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1008 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1010 goto skip41b - bra p8l_skip41b - ; source: test_word_gt.p8:1011 lbl41b: fail_word(102) -p8l_lbl41b - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1012 skip41b: -p8l_skip41b - ; source: test_word_gt.p8:1014 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_gt.p8:1015 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_123_afterif - ; source: test_word_gt.p8:1018 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_gt.p8:1019 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_gt.p8:1021 success++ - inc p8b_main.p8v_success -label_asm_124_afterif - ; source: test_word_gt.p8:1024 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gt.p8:1026 goto skip42a - bra p8l_skip42a - ; source: test_word_gt.p8:1027 lbl42a: fail_word(105) -p8l_lbl42a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1028 skip42a: -p8l_skip42a - ; source: test_word_gt.p8:1030 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1031 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1033 goto skip42b - bra p8l_skip42b - ; source: test_word_gt.p8:1034 lbl42b: fail_word(106) -p8l_lbl42b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1035 skip42b: -p8l_skip42b - ; source: test_word_gt.p8:1037 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_gt.p8:1038 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_126_afterif - ; source: test_word_gt.p8:1041 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_gt.p8:1042 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_gt.p8:1044 success++ - inc p8b_main.p8v_success -label_asm_127_afterif - ; source: test_word_gt.p8:1046 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:1048 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gt.p8:1050 goto skip43a - bra p8l_skip43a - ; source: test_word_gt.p8:1051 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1052 skip43a: -p8l_skip43a - ; source: test_word_gt.p8:1054 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1055 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1057 goto skip43b - bra p8l_skip43b - ; source: test_word_gt.p8:1058 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1059 skip43b: -p8l_skip43b - ; source: test_word_gt.p8:1061 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_gt.p8:1062 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_word_gt.p8:1065 if x>-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_gt.p8:1066 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_gt.p8:1068 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_word_gt.p8:1071 if x>-1 - lda p8v_x+1 - bpl p8l_lbl44a - ; source: test_word_gt.p8:1073 goto skip44a - bra p8l_skip44a - ; source: test_word_gt.p8:1074 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1075 skip44a: -p8l_skip44a - ; source: test_word_gt.p8:1077 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1078 if x>-1 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1080 goto skip44b - bra p8l_skip44b - ; source: test_word_gt.p8:1081 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1082 skip44b: -p8l_skip44b - ; source: test_word_gt.p8:1084 if x>-1 - lda p8v_x+1 - bmi label_asm_132_afterif - ; source: test_word_gt.p8:1085 success++ - inc p8b_main.p8v_success -label_asm_132_afterif - ; source: test_word_gt.p8:1088 if x>-1 - lda p8v_x+1 - bmi label_asm_134_else - ; source: test_word_gt.p8:1089 success++ - inc p8b_main.p8v_success - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_gt.p8:1091 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_word_gt.p8:1094 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl45a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl45a -+ - ; source: test_word_gt.p8:1096 goto skip45a - bra p8l_skip45a - ; source: test_word_gt.p8:1097 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1098 skip45a: -p8l_skip45a - ; source: test_word_gt.p8:1100 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1101 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1103 goto skip45b - bra p8l_skip45b - ; source: test_word_gt.p8:1104 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1105 skip45b: -p8l_skip45b - ; source: test_word_gt.p8:1107 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_135_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_135_afterif -+ - ; source: test_word_gt.p8:1108 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_word_gt.p8:1111 if x>0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_137_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_137_else -+ - ; source: test_word_gt.p8:1112 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_gt.p8:1114 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_word_gt.p8:1117 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gt.p8:1119 goto skip46a - bra p8l_skip46a - ; source: test_word_gt.p8:1120 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1121 skip46a: -p8l_skip46a - ; source: test_word_gt.p8:1123 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1124 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1126 goto skip46b - bra p8l_skip46b - ; source: test_word_gt.p8:1127 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1128 skip46b: -p8l_skip46b - ; source: test_word_gt.p8:1130 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_138_afterif - ; source: test_word_gt.p8:1131 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_word_gt.p8:1134 if x>1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_140_else - ; source: test_word_gt.p8:1135 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_gt.p8:1137 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_word_gt.p8:1140 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gt.p8:1142 goto skip47a - bra p8l_skip47a - ; source: test_word_gt.p8:1143 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1144 skip47a: -p8l_skip47a - ; source: test_word_gt.p8:1146 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1147 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1149 goto skip47b - bra p8l_skip47b - ; source: test_word_gt.p8:1150 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1151 skip47b: -p8l_skip47b - ; source: test_word_gt.p8:1153 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_gt.p8:1154 success++ - inc p8b_main.p8v_success -label_asm_141_afterif - ; source: test_word_gt.p8:1157 if x>170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_gt.p8:1158 success++ - inc p8b_main.p8v_success - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_gt.p8:1160 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_word_gt.p8:1163 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gt.p8:1165 goto skip48a - bra p8l_skip48a - ; source: test_word_gt.p8:1166 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1167 skip48a: -p8l_skip48a - ; source: test_word_gt.p8:1169 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1170 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1172 goto skip48b - bra p8l_skip48b - ; source: test_word_gt.p8:1173 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1174 skip48b: -p8l_skip48b - ; source: test_word_gt.p8:1176 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_gt.p8:1177 success++ - inc p8b_main.p8v_success -label_asm_144_afterif - ; source: test_word_gt.p8:1180 if x>30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_gt.p8:1181 success++ - inc p8b_main.p8v_success - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_gt.p8:1183 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_word_gt.p8:1186 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gt.p8:1188 goto skip49a - bra p8l_skip49a - ; source: test_word_gt.p8:1189 lbl49a: fail_word(109) -p8l_lbl49a - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1190 skip49a: -p8l_skip49a - ; source: test_word_gt.p8:1192 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1193 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1195 goto skip49b - bra p8l_skip49b - ; source: test_word_gt.p8:1196 lbl49b: fail_word(110) -p8l_lbl49b - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1197 skip49b: -p8l_skip49b - ; source: test_word_gt.p8:1199 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_gt.p8:1200 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_147_afterif - ; source: test_word_gt.p8:1203 if x>32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_gt.p8:1204 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_gt.p8:1206 success++ - inc p8b_main.p8v_success -label_asm_148_afterif - ; source: test_word_gt.p8:1208 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_gt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_gt.p8:1210 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_word_gt.p8:1211 word @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_word_gt.p8:1212 success = 0 - stz p8b_main.p8v_success - ; source: test_word_gt.p8:1213 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:1214 value=-21829 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1216 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gt.p8:1218 goto skip1a - bra p8l_skip1a - ; source: test_word_gt.p8:1219 lbl1a: fail_word(113) -p8l_lbl1a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1220 skip1a: -p8l_skip1a - ; source: test_word_gt.p8:1222 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1223 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1225 goto skip1b - bra p8l_skip1b - ; source: test_word_gt.p8:1226 lbl1b: fail_word(114) -p8l_lbl1b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1227 skip1b: -p8l_skip1b - ; source: test_word_gt.p8:1229 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_150_afterif - ; source: test_word_gt.p8:1230 fail_word(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_150_afterif - ; source: test_word_gt.p8:1233 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_152_else - ; source: test_word_gt.p8:1234 fail_word(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_gt.p8:1236 success++ - inc p8b_main.p8v_success -label_asm_151_afterif - ; source: test_word_gt.p8:1238 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1240 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gt.p8:1242 goto skip2a - bra p8l_skip2a - ; source: test_word_gt.p8:1243 lbl2a: fail_word(117) -p8l_lbl2a - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1244 skip2a: -p8l_skip2a - ; source: test_word_gt.p8:1246 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1247 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1249 goto skip2b - bra p8l_skip2b - ; source: test_word_gt.p8:1250 lbl2b: fail_word(118) -p8l_lbl2b - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1251 skip2b: -p8l_skip2b - ; source: test_word_gt.p8:1253 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_153_afterif - ; source: test_word_gt.p8:1254 fail_word(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_153_afterif - ; source: test_word_gt.p8:1257 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_155_else - ; source: test_word_gt.p8:1258 fail_word(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_gt.p8:1260 success++ - inc p8b_main.p8v_success -label_asm_154_afterif - ; source: test_word_gt.p8:1262 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:1264 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_gt.p8:1266 goto skip3a - bra p8l_skip3a - ; source: test_word_gt.p8:1267 lbl3a: fail_word(121) -p8l_lbl3a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1268 skip3a: -p8l_skip3a - ; source: test_word_gt.p8:1270 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1271 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1273 goto skip3b - bra p8l_skip3b - ; source: test_word_gt.p8:1274 lbl3b: fail_word(122) -p8l_lbl3b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1275 skip3b: -p8l_skip3b - ; source: test_word_gt.p8:1277 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_156_afterif - ; source: test_word_gt.p8:1278 fail_word(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_156_afterif - ; source: test_word_gt.p8:1281 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_158_else - ; source: test_word_gt.p8:1282 fail_word(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_gt.p8:1284 success++ - inc p8b_main.p8v_success -label_asm_157_afterif - ; source: test_word_gt.p8:1286 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1288 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gt.p8:1290 goto skip4a - bra p8l_skip4a - ; source: test_word_gt.p8:1291 lbl4a: fail_word(125) -p8l_lbl4a - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1292 skip4a: -p8l_skip4a - ; source: test_word_gt.p8:1294 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1295 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1297 goto skip4b - bra p8l_skip4b - ; source: test_word_gt.p8:1298 lbl4b: fail_word(126) -p8l_lbl4b - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1299 skip4b: -p8l_skip4b - ; source: test_word_gt.p8:1301 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_159_afterif - ; source: test_word_gt.p8:1302 fail_word(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_159_afterif - ; source: test_word_gt.p8:1305 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_161_else - ; source: test_word_gt.p8:1306 fail_word(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_gt.p8:1308 success++ - inc p8b_main.p8v_success -label_asm_160_afterif - ; source: test_word_gt.p8:1310 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1312 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gt.p8:1314 goto skip5a - bra p8l_skip5a - ; source: test_word_gt.p8:1315 lbl5a: fail_word(129) -p8l_lbl5a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1316 skip5a: -p8l_skip5a - ; source: test_word_gt.p8:1318 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1319 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1321 goto skip5b - bra p8l_skip5b - ; source: test_word_gt.p8:1322 lbl5b: fail_word(130) -p8l_lbl5b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1323 skip5b: -p8l_skip5b - ; source: test_word_gt.p8:1325 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_162_afterif - ; source: test_word_gt.p8:1326 fail_word(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_162_afterif - ; source: test_word_gt.p8:1329 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_164_else - ; source: test_word_gt.p8:1330 fail_word(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_gt.p8:1332 success++ - inc p8b_main.p8v_success -label_asm_163_afterif - ; source: test_word_gt.p8:1334 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1336 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gt.p8:1338 goto skip6a - bra p8l_skip6a - ; source: test_word_gt.p8:1339 lbl6a: fail_word(133) -p8l_lbl6a - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1340 skip6a: -p8l_skip6a - ; source: test_word_gt.p8:1342 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1343 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1345 goto skip6b - bra p8l_skip6b - ; source: test_word_gt.p8:1346 lbl6b: fail_word(134) -p8l_lbl6b - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1347 skip6b: -p8l_skip6b - ; source: test_word_gt.p8:1349 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_165_afterif - ; source: test_word_gt.p8:1350 fail_word(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_165_afterif - ; source: test_word_gt.p8:1353 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_167_else - ; source: test_word_gt.p8:1354 fail_word(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_gt.p8:1356 success++ - inc p8b_main.p8v_success -label_asm_166_afterif - ; source: test_word_gt.p8:1358 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1360 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gt.p8:1362 goto skip7a - bra p8l_skip7a - ; source: test_word_gt.p8:1363 lbl7a: fail_word(137) -p8l_lbl7a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1364 skip7a: -p8l_skip7a - ; source: test_word_gt.p8:1366 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1367 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1369 goto skip7b - bra p8l_skip7b - ; source: test_word_gt.p8:1370 lbl7b: fail_word(138) -p8l_lbl7b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1371 skip7b: -p8l_skip7b - ; source: test_word_gt.p8:1373 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_168_afterif - ; source: test_word_gt.p8:1374 fail_word(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_168_afterif - ; source: test_word_gt.p8:1377 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_170_else - ; source: test_word_gt.p8:1378 fail_word(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_gt.p8:1380 success++ - inc p8b_main.p8v_success -label_asm_169_afterif - ; source: test_word_gt.p8:1382 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:1383 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1385 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gt.p8:1387 goto skip8a - bra p8l_skip8a - ; source: test_word_gt.p8:1388 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1389 skip8a: -p8l_skip8a - ; source: test_word_gt.p8:1391 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1392 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1394 goto skip8b - bra p8l_skip8b - ; source: test_word_gt.p8:1395 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1396 skip8b: -p8l_skip8b - ; source: test_word_gt.p8:1398 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_171_afterif - ; source: test_word_gt.p8:1399 success++ - inc p8b_main.p8v_success -label_asm_171_afterif - ; source: test_word_gt.p8:1402 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_173_else - ; source: test_word_gt.p8:1403 success++ - inc p8b_main.p8v_success - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_gt.p8:1405 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_word_gt.p8:1407 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1409 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gt.p8:1411 goto skip9a - bra p8l_skip9a - ; source: test_word_gt.p8:1412 lbl9a: fail_word(141) -p8l_lbl9a - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1413 skip9a: -p8l_skip9a - ; source: test_word_gt.p8:1415 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1416 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1418 goto skip9b - bra p8l_skip9b - ; source: test_word_gt.p8:1419 lbl9b: fail_word(142) -p8l_lbl9b - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1420 skip9b: -p8l_skip9b - ; source: test_word_gt.p8:1422 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_174_afterif - ; source: test_word_gt.p8:1423 fail_word(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_174_afterif - ; source: test_word_gt.p8:1426 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_176_else - ; source: test_word_gt.p8:1427 fail_word(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_gt.p8:1429 success++ - inc p8b_main.p8v_success -label_asm_175_afterif - ; source: test_word_gt.p8:1431 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:1433 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_gt.p8:1435 goto skip10a - bra p8l_skip10a - ; source: test_word_gt.p8:1436 lbl10a: fail_word(145) -p8l_lbl10a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1437 skip10a: -p8l_skip10a - ; source: test_word_gt.p8:1439 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1440 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1442 goto skip10b - bra p8l_skip10b - ; source: test_word_gt.p8:1443 lbl10b: fail_word(146) -p8l_lbl10b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1444 skip10b: -p8l_skip10b - ; source: test_word_gt.p8:1446 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_177_afterif - ; source: test_word_gt.p8:1447 fail_word(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_177_afterif - ; source: test_word_gt.p8:1450 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_179_else - ; source: test_word_gt.p8:1451 fail_word(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_gt.p8:1453 success++ - inc p8b_main.p8v_success -label_asm_178_afterif - ; source: test_word_gt.p8:1455 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1457 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gt.p8:1459 goto skip11a - bra p8l_skip11a - ; source: test_word_gt.p8:1460 lbl11a: fail_word(149) -p8l_lbl11a - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1461 skip11a: -p8l_skip11a - ; source: test_word_gt.p8:1463 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1464 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1466 goto skip11b - bra p8l_skip11b - ; source: test_word_gt.p8:1467 lbl11b: fail_word(150) -p8l_lbl11b - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1468 skip11b: -p8l_skip11b - ; source: test_word_gt.p8:1470 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_180_afterif - ; source: test_word_gt.p8:1471 fail_word(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_180_afterif - ; source: test_word_gt.p8:1474 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_182_else - ; source: test_word_gt.p8:1475 fail_word(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_gt.p8:1477 success++ - inc p8b_main.p8v_success -label_asm_181_afterif - ; source: test_word_gt.p8:1479 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1481 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gt.p8:1483 goto skip12a - bra p8l_skip12a - ; source: test_word_gt.p8:1484 lbl12a: fail_word(153) -p8l_lbl12a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1485 skip12a: -p8l_skip12a - ; source: test_word_gt.p8:1487 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1488 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1490 goto skip12b - bra p8l_skip12b - ; source: test_word_gt.p8:1491 lbl12b: fail_word(154) -p8l_lbl12b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1492 skip12b: -p8l_skip12b - ; source: test_word_gt.p8:1494 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_183_afterif - ; source: test_word_gt.p8:1495 fail_word(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_183_afterif - ; source: test_word_gt.p8:1498 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_185_else - ; source: test_word_gt.p8:1499 fail_word(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_gt.p8:1501 success++ - inc p8b_main.p8v_success -label_asm_184_afterif - ; source: test_word_gt.p8:1503 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1505 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gt.p8:1507 goto skip13a - bra p8l_skip13a - ; source: test_word_gt.p8:1508 lbl13a: fail_word(157) -p8l_lbl13a - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1509 skip13a: -p8l_skip13a - ; source: test_word_gt.p8:1511 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1512 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1514 goto skip13b - bra p8l_skip13b - ; source: test_word_gt.p8:1515 lbl13b: fail_word(158) -p8l_lbl13b - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1516 skip13b: -p8l_skip13b - ; source: test_word_gt.p8:1518 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_186_afterif - ; source: test_word_gt.p8:1519 fail_word(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_186_afterif - ; source: test_word_gt.p8:1522 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_188_else - ; source: test_word_gt.p8:1523 fail_word(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_gt.p8:1525 success++ - inc p8b_main.p8v_success -label_asm_187_afterif - ; source: test_word_gt.p8:1527 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1529 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gt.p8:1531 goto skip14a - bra p8l_skip14a - ; source: test_word_gt.p8:1532 lbl14a: fail_word(161) -p8l_lbl14a - ldy #>$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1533 skip14a: -p8l_skip14a - ; source: test_word_gt.p8:1535 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1536 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1538 goto skip14b - bra p8l_skip14b - ; source: test_word_gt.p8:1539 lbl14b: fail_word(162) -p8l_lbl14b - ldy #>$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1540 skip14b: -p8l_skip14b - ; source: test_word_gt.p8:1542 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_189_afterif - ; source: test_word_gt.p8:1543 fail_word(163) - ldy #>$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_189_afterif - ; source: test_word_gt.p8:1546 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_191_else - ; source: test_word_gt.p8:1547 fail_word(164) - ldy #>$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_gt.p8:1549 success++ - inc p8b_main.p8v_success -label_asm_190_afterif - ; source: test_word_gt.p8:1551 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gt.p8:1552 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1554 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gt.p8:1556 goto skip15a - bra p8l_skip15a - ; source: test_word_gt.p8:1557 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1558 skip15a: -p8l_skip15a - ; source: test_word_gt.p8:1560 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1561 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1563 goto skip15b - bra p8l_skip15b - ; source: test_word_gt.p8:1564 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1565 skip15b: -p8l_skip15b - ; source: test_word_gt.p8:1567 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_192_afterif - ; source: test_word_gt.p8:1568 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_word_gt.p8:1571 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_194_else - ; source: test_word_gt.p8:1572 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_gt.p8:1574 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_word_gt.p8:1576 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1578 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gt.p8:1580 goto skip16a - bra p8l_skip16a - ; source: test_word_gt.p8:1581 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1582 skip16a: -p8l_skip16a - ; source: test_word_gt.p8:1584 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1585 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1587 goto skip16b - bra p8l_skip16b - ; source: test_word_gt.p8:1588 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1589 skip16b: -p8l_skip16b - ; source: test_word_gt.p8:1591 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_195_afterif - ; source: test_word_gt.p8:1592 success++ - inc p8b_main.p8v_success -label_asm_195_afterif - ; source: test_word_gt.p8:1595 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_197_else - ; source: test_word_gt.p8:1596 success++ - inc p8b_main.p8v_success - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_gt.p8:1598 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_word_gt.p8:1600 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:1602 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_gt.p8:1604 goto skip17a - bra p8l_skip17a - ; source: test_word_gt.p8:1605 lbl17a: fail_word(165) -p8l_lbl17a - ldy #>$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1606 skip17a: -p8l_skip17a - ; source: test_word_gt.p8:1608 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1609 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1611 goto skip17b - bra p8l_skip17b - ; source: test_word_gt.p8:1612 lbl17b: fail_word(166) -p8l_lbl17b - ldy #>$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1613 skip17b: -p8l_skip17b - ; source: test_word_gt.p8:1615 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_198_afterif - ; source: test_word_gt.p8:1616 fail_word(167) - ldy #>$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_198_afterif - ; source: test_word_gt.p8:1619 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_200_else - ; source: test_word_gt.p8:1620 fail_word(168) - ldy #>$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_gt.p8:1622 success++ - inc p8b_main.p8v_success -label_asm_199_afterif - ; source: test_word_gt.p8:1624 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1626 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gt.p8:1628 goto skip18a - bra p8l_skip18a - ; source: test_word_gt.p8:1629 lbl18a: fail_word(169) -p8l_lbl18a - ldy #>$a9 - lda #<$a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1630 skip18a: -p8l_skip18a - ; source: test_word_gt.p8:1632 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1633 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1635 goto skip18b - bra p8l_skip18b - ; source: test_word_gt.p8:1636 lbl18b: fail_word(170) -p8l_lbl18b - ldy #>$aa - lda #<$aa - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1637 skip18b: -p8l_skip18b - ; source: test_word_gt.p8:1639 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_201_afterif - ; source: test_word_gt.p8:1640 fail_word(171) - ldy #>$ab - lda #<$ab - jsr p8b_main.p8s_fail_word -label_asm_201_afterif - ; source: test_word_gt.p8:1643 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_203_else - ; source: test_word_gt.p8:1644 fail_word(172) - ldy #>$ac - lda #<$ac - jsr p8b_main.p8s_fail_word - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_gt.p8:1646 success++ - inc p8b_main.p8v_success -label_asm_202_afterif - ; source: test_word_gt.p8:1648 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1650 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gt.p8:1652 goto skip19a - bra p8l_skip19a - ; source: test_word_gt.p8:1653 lbl19a: fail_word(173) -p8l_lbl19a - ldy #>$ad - lda #<$ad - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1654 skip19a: -p8l_skip19a - ; source: test_word_gt.p8:1656 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1657 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1659 goto skip19b - bra p8l_skip19b - ; source: test_word_gt.p8:1660 lbl19b: fail_word(174) -p8l_lbl19b - ldy #>$ae - lda #<$ae - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1661 skip19b: -p8l_skip19b - ; source: test_word_gt.p8:1663 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_204_afterif - ; source: test_word_gt.p8:1664 fail_word(175) - ldy #>$af - lda #<$af - jsr p8b_main.p8s_fail_word -label_asm_204_afterif - ; source: test_word_gt.p8:1667 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_206_else - ; source: test_word_gt.p8:1668 fail_word(176) - ldy #>$b0 - lda #<$b0 - jsr p8b_main.p8s_fail_word - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_gt.p8:1670 success++ - inc p8b_main.p8v_success -label_asm_205_afterif - ; source: test_word_gt.p8:1672 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1674 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gt.p8:1676 goto skip20a - bra p8l_skip20a - ; source: test_word_gt.p8:1677 lbl20a: fail_word(177) -p8l_lbl20a - ldy #>$b1 - lda #<$b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1678 skip20a: -p8l_skip20a - ; source: test_word_gt.p8:1680 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1681 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1683 goto skip20b - bra p8l_skip20b - ; source: test_word_gt.p8:1684 lbl20b: fail_word(178) -p8l_lbl20b - ldy #>$b2 - lda #<$b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1685 skip20b: -p8l_skip20b - ; source: test_word_gt.p8:1687 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_207_afterif - ; source: test_word_gt.p8:1688 fail_word(179) - ldy #>$b3 - lda #<$b3 - jsr p8b_main.p8s_fail_word -label_asm_207_afterif - ; source: test_word_gt.p8:1691 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_209_else - ; source: test_word_gt.p8:1692 fail_word(180) - ldy #>$b4 - lda #<$b4 - jsr p8b_main.p8s_fail_word - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_gt.p8:1694 success++ - inc p8b_main.p8v_success -label_asm_208_afterif - ; source: test_word_gt.p8:1696 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1698 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gt.p8:1700 goto skip21a - bra p8l_skip21a - ; source: test_word_gt.p8:1701 lbl21a: fail_word(181) -p8l_lbl21a - ldy #>$b5 - lda #<$b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1702 skip21a: -p8l_skip21a - ; source: test_word_gt.p8:1704 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1705 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1707 goto skip21b - bra p8l_skip21b - ; source: test_word_gt.p8:1708 lbl21b: fail_word(182) -p8l_lbl21b - ldy #>$b6 - lda #<$b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1709 skip21b: -p8l_skip21b - ; source: test_word_gt.p8:1711 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_210_afterif - ; source: test_word_gt.p8:1712 fail_word(183) - ldy #>$b7 - lda #<$b7 - jsr p8b_main.p8s_fail_word -label_asm_210_afterif - ; source: test_word_gt.p8:1715 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_212_else - ; source: test_word_gt.p8:1716 fail_word(184) - ldy #>$b8 - lda #<$b8 - jsr p8b_main.p8s_fail_word - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_gt.p8:1718 success++ - inc p8b_main.p8v_success -label_asm_211_afterif - ; source: test_word_gt.p8:1720 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:1721 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1723 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gt.p8:1725 goto skip22a - bra p8l_skip22a - ; source: test_word_gt.p8:1726 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1727 skip22a: -p8l_skip22a - ; source: test_word_gt.p8:1729 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1730 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1732 goto skip22b - bra p8l_skip22b - ; source: test_word_gt.p8:1733 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1734 skip22b: -p8l_skip22b - ; source: test_word_gt.p8:1736 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_213_afterif - ; source: test_word_gt.p8:1737 success++ - inc p8b_main.p8v_success -label_asm_213_afterif - ; source: test_word_gt.p8:1740 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_215_else - ; source: test_word_gt.p8:1741 success++ - inc p8b_main.p8v_success - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_gt.p8:1743 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_word_gt.p8:1745 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1747 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gt.p8:1749 goto skip23a - bra p8l_skip23a - ; source: test_word_gt.p8:1750 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1751 skip23a: -p8l_skip23a - ; source: test_word_gt.p8:1753 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1754 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1756 goto skip23b - bra p8l_skip23b - ; source: test_word_gt.p8:1757 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1758 skip23b: -p8l_skip23b - ; source: test_word_gt.p8:1760 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_216_afterif - ; source: test_word_gt.p8:1761 success++ - inc p8b_main.p8v_success -label_asm_216_afterif - ; source: test_word_gt.p8:1764 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_218_else - ; source: test_word_gt.p8:1765 success++ - inc p8b_main.p8v_success - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_gt.p8:1767 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_word_gt.p8:1769 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:1771 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_gt.p8:1773 goto skip24a - bra p8l_skip24a - ; source: test_word_gt.p8:1774 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1775 skip24a: -p8l_skip24a - ; source: test_word_gt.p8:1777 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1778 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1780 goto skip24b - bra p8l_skip24b - ; source: test_word_gt.p8:1781 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1782 skip24b: -p8l_skip24b - ; source: test_word_gt.p8:1784 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_219_afterif - ; source: test_word_gt.p8:1785 success++ - inc p8b_main.p8v_success -label_asm_219_afterif - ; source: test_word_gt.p8:1788 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_221_else - ; source: test_word_gt.p8:1789 success++ - inc p8b_main.p8v_success - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_gt.p8:1791 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_word_gt.p8:1793 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1795 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gt.p8:1797 goto skip25a - bra p8l_skip25a - ; source: test_word_gt.p8:1798 lbl25a: fail_word(185) -p8l_lbl25a - ldy #>$b9 - lda #<$b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1799 skip25a: -p8l_skip25a - ; source: test_word_gt.p8:1801 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1802 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1804 goto skip25b - bra p8l_skip25b - ; source: test_word_gt.p8:1805 lbl25b: fail_word(186) -p8l_lbl25b - ldy #>$ba - lda #<$ba - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1806 skip25b: -p8l_skip25b - ; source: test_word_gt.p8:1808 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_222_afterif - ; source: test_word_gt.p8:1809 fail_word(187) - ldy #>$bb - lda #<$bb - jsr p8b_main.p8s_fail_word -label_asm_222_afterif - ; source: test_word_gt.p8:1812 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_224_else - ; source: test_word_gt.p8:1813 fail_word(188) - ldy #>$bc - lda #<$bc - jsr p8b_main.p8s_fail_word - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_gt.p8:1815 success++ - inc p8b_main.p8v_success -label_asm_223_afterif - ; source: test_word_gt.p8:1817 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1819 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gt.p8:1821 goto skip26a - bra p8l_skip26a - ; source: test_word_gt.p8:1822 lbl26a: fail_word(189) -p8l_lbl26a - ldy #>$bd - lda #<$bd - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1823 skip26a: -p8l_skip26a - ; source: test_word_gt.p8:1825 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1826 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1828 goto skip26b - bra p8l_skip26b - ; source: test_word_gt.p8:1829 lbl26b: fail_word(190) -p8l_lbl26b - ldy #>$be - lda #<$be - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1830 skip26b: -p8l_skip26b - ; source: test_word_gt.p8:1832 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_225_afterif - ; source: test_word_gt.p8:1833 fail_word(191) - ldy #>$bf - lda #<$bf - jsr p8b_main.p8s_fail_word -label_asm_225_afterif - ; source: test_word_gt.p8:1836 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_227_else - ; source: test_word_gt.p8:1837 fail_word(192) - ldy #>$c0 - lda #<$c0 - jsr p8b_main.p8s_fail_word - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_gt.p8:1839 success++ - inc p8b_main.p8v_success -label_asm_226_afterif - ; source: test_word_gt.p8:1841 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1843 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gt.p8:1845 goto skip27a - bra p8l_skip27a - ; source: test_word_gt.p8:1846 lbl27a: fail_word(193) -p8l_lbl27a - ldy #>$c1 - lda #<$c1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1847 skip27a: -p8l_skip27a - ; source: test_word_gt.p8:1849 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1850 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1852 goto skip27b - bra p8l_skip27b - ; source: test_word_gt.p8:1853 lbl27b: fail_word(194) -p8l_lbl27b - ldy #>$c2 - lda #<$c2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1854 skip27b: -p8l_skip27b - ; source: test_word_gt.p8:1856 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_228_afterif - ; source: test_word_gt.p8:1857 fail_word(195) - ldy #>$c3 - lda #<$c3 - jsr p8b_main.p8s_fail_word -label_asm_228_afterif - ; source: test_word_gt.p8:1860 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_230_else - ; source: test_word_gt.p8:1861 fail_word(196) - ldy #>$c4 - lda #<$c4 - jsr p8b_main.p8s_fail_word - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_gt.p8:1863 success++ - inc p8b_main.p8v_success -label_asm_229_afterif - ; source: test_word_gt.p8:1865 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1867 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gt.p8:1869 goto skip28a - bra p8l_skip28a - ; source: test_word_gt.p8:1870 lbl28a: fail_word(197) -p8l_lbl28a - ldy #>$c5 - lda #<$c5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1871 skip28a: -p8l_skip28a - ; source: test_word_gt.p8:1873 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1874 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1876 goto skip28b - bra p8l_skip28b - ; source: test_word_gt.p8:1877 lbl28b: fail_word(198) -p8l_lbl28b - ldy #>$c6 - lda #<$c6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1878 skip28b: -p8l_skip28b - ; source: test_word_gt.p8:1880 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_231_afterif - ; source: test_word_gt.p8:1881 fail_word(199) - ldy #>$c7 - lda #<$c7 - jsr p8b_main.p8s_fail_word -label_asm_231_afterif - ; source: test_word_gt.p8:1884 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_233_else - ; source: test_word_gt.p8:1885 fail_word(200) - ldy #>$c8 - lda #<$c8 - jsr p8b_main.p8s_fail_word - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_gt.p8:1887 success++ - inc p8b_main.p8v_success -label_asm_232_afterif - ; source: test_word_gt.p8:1889 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:1890 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1892 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gt.p8:1894 goto skip29a - bra p8l_skip29a - ; source: test_word_gt.p8:1895 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1896 skip29a: -p8l_skip29a - ; source: test_word_gt.p8:1898 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1899 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1901 goto skip29b - bra p8l_skip29b - ; source: test_word_gt.p8:1902 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1903 skip29b: -p8l_skip29b - ; source: test_word_gt.p8:1905 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_234_afterif - ; source: test_word_gt.p8:1906 success++ - inc p8b_main.p8v_success -label_asm_234_afterif - ; source: test_word_gt.p8:1909 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_236_else - ; source: test_word_gt.p8:1910 success++ - inc p8b_main.p8v_success - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_gt.p8:1912 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_word_gt.p8:1914 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1916 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gt.p8:1918 goto skip30a - bra p8l_skip30a - ; source: test_word_gt.p8:1919 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1920 skip30a: -p8l_skip30a - ; source: test_word_gt.p8:1922 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1923 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1925 goto skip30b - bra p8l_skip30b - ; source: test_word_gt.p8:1926 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1927 skip30b: -p8l_skip30b - ; source: test_word_gt.p8:1929 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_237_afterif - ; source: test_word_gt.p8:1930 success++ - inc p8b_main.p8v_success -label_asm_237_afterif - ; source: test_word_gt.p8:1933 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_239_else - ; source: test_word_gt.p8:1934 success++ - inc p8b_main.p8v_success - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_gt.p8:1936 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_word_gt.p8:1938 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:1940 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_gt.p8:1942 goto skip31a - bra p8l_skip31a - ; source: test_word_gt.p8:1943 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1944 skip31a: -p8l_skip31a - ; source: test_word_gt.p8:1946 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1947 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1949 goto skip31b - bra p8l_skip31b - ; source: test_word_gt.p8:1950 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1951 skip31b: -p8l_skip31b - ; source: test_word_gt.p8:1953 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_240_afterif - ; source: test_word_gt.p8:1954 success++ - inc p8b_main.p8v_success -label_asm_240_afterif - ; source: test_word_gt.p8:1957 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_242_else - ; source: test_word_gt.p8:1958 success++ - inc p8b_main.p8v_success - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_gt.p8:1960 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_word_gt.p8:1962 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1964 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gt.p8:1966 goto skip32a - bra p8l_skip32a - ; source: test_word_gt.p8:1967 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1968 skip32a: -p8l_skip32a - ; source: test_word_gt.p8:1970 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1971 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1973 goto skip32b - bra p8l_skip32b - ; source: test_word_gt.p8:1974 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:1975 skip32b: -p8l_skip32b - ; source: test_word_gt.p8:1977 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_243_afterif - ; source: test_word_gt.p8:1978 success++ - inc p8b_main.p8v_success -label_asm_243_afterif - ; source: test_word_gt.p8:1981 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_245_else - ; source: test_word_gt.p8:1982 success++ - inc p8b_main.p8v_success - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_gt.p8:1984 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_word_gt.p8:1986 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:1988 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gt.p8:1990 goto skip33a - bra p8l_skip33a - ; source: test_word_gt.p8:1991 lbl33a: fail_word(201) -p8l_lbl33a - ldy #>$c9 - lda #<$c9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1992 skip33a: -p8l_skip33a - ; source: test_word_gt.p8:1994 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:1995 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:1997 goto skip33b - bra p8l_skip33b - ; source: test_word_gt.p8:1998 lbl33b: fail_word(202) -p8l_lbl33b - ldy #>$ca - lda #<$ca - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:1999 skip33b: -p8l_skip33b - ; source: test_word_gt.p8:2001 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_246_afterif - ; source: test_word_gt.p8:2002 fail_word(203) - ldy #>$cb - lda #<$cb - jsr p8b_main.p8s_fail_word -label_asm_246_afterif - ; source: test_word_gt.p8:2005 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_248_else - ; source: test_word_gt.p8:2006 fail_word(204) - ldy #>$cc - lda #<$cc - jsr p8b_main.p8s_fail_word - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_gt.p8:2008 success++ - inc p8b_main.p8v_success -label_asm_247_afterif - ; source: test_word_gt.p8:2010 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2012 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gt.p8:2014 goto skip34a - bra p8l_skip34a - ; source: test_word_gt.p8:2015 lbl34a: fail_word(205) -p8l_lbl34a - ldy #>$cd - lda #<$cd - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2016 skip34a: -p8l_skip34a - ; source: test_word_gt.p8:2018 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2019 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2021 goto skip34b - bra p8l_skip34b - ; source: test_word_gt.p8:2022 lbl34b: fail_word(206) -p8l_lbl34b - ldy #>$ce - lda #<$ce - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2023 skip34b: -p8l_skip34b - ; source: test_word_gt.p8:2025 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_249_afterif - ; source: test_word_gt.p8:2026 fail_word(207) - ldy #>$cf - lda #<$cf - jsr p8b_main.p8s_fail_word -label_asm_249_afterif - ; source: test_word_gt.p8:2029 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_251_else - ; source: test_word_gt.p8:2030 fail_word(208) - ldy #>$d0 - lda #<$d0 - jsr p8b_main.p8s_fail_word - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_gt.p8:2032 success++ - inc p8b_main.p8v_success -label_asm_250_afterif - ; source: test_word_gt.p8:2034 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2036 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gt.p8:2038 goto skip35a - bra p8l_skip35a - ; source: test_word_gt.p8:2039 lbl35a: fail_word(209) -p8l_lbl35a - ldy #>$d1 - lda #<$d1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2040 skip35a: -p8l_skip35a - ; source: test_word_gt.p8:2042 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2043 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2045 goto skip35b - bra p8l_skip35b - ; source: test_word_gt.p8:2046 lbl35b: fail_word(210) -p8l_lbl35b - ldy #>$d2 - lda #<$d2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2047 skip35b: -p8l_skip35b - ; source: test_word_gt.p8:2049 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_252_afterif - ; source: test_word_gt.p8:2050 fail_word(211) - ldy #>$d3 - lda #<$d3 - jsr p8b_main.p8s_fail_word -label_asm_252_afterif - ; source: test_word_gt.p8:2053 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_254_else - ; source: test_word_gt.p8:2054 fail_word(212) - ldy #>$d4 - lda #<$d4 - jsr p8b_main.p8s_fail_word - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_gt.p8:2056 success++ - inc p8b_main.p8v_success -label_asm_253_afterif - ; source: test_word_gt.p8:2058 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:2059 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2061 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gt.p8:2063 goto skip36a - bra p8l_skip36a - ; source: test_word_gt.p8:2064 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2065 skip36a: -p8l_skip36a - ; source: test_word_gt.p8:2067 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2068 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2070 goto skip36b - bra p8l_skip36b - ; source: test_word_gt.p8:2071 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2072 skip36b: -p8l_skip36b - ; source: test_word_gt.p8:2074 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_255_afterif - ; source: test_word_gt.p8:2075 success++ - inc p8b_main.p8v_success -label_asm_255_afterif - ; source: test_word_gt.p8:2078 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_257_else - ; source: test_word_gt.p8:2079 success++ - inc p8b_main.p8v_success - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_gt.p8:2081 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_word_gt.p8:2083 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2085 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gt.p8:2087 goto skip37a - bra p8l_skip37a - ; source: test_word_gt.p8:2088 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2089 skip37a: -p8l_skip37a - ; source: test_word_gt.p8:2091 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2092 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2094 goto skip37b - bra p8l_skip37b - ; source: test_word_gt.p8:2095 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2096 skip37b: -p8l_skip37b - ; source: test_word_gt.p8:2098 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_258_afterif - ; source: test_word_gt.p8:2099 success++ - inc p8b_main.p8v_success -label_asm_258_afterif - ; source: test_word_gt.p8:2102 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_260_else - ; source: test_word_gt.p8:2103 success++ - inc p8b_main.p8v_success - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_gt.p8:2105 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_word_gt.p8:2107 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:2109 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_gt.p8:2111 goto skip38a - bra p8l_skip38a - ; source: test_word_gt.p8:2112 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2113 skip38a: -p8l_skip38a - ; source: test_word_gt.p8:2115 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2116 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2118 goto skip38b - bra p8l_skip38b - ; source: test_word_gt.p8:2119 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2120 skip38b: -p8l_skip38b - ; source: test_word_gt.p8:2122 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_261_afterif - ; source: test_word_gt.p8:2123 success++ - inc p8b_main.p8v_success -label_asm_261_afterif - ; source: test_word_gt.p8:2126 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_263_else - ; source: test_word_gt.p8:2127 success++ - inc p8b_main.p8v_success - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_gt.p8:2129 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_word_gt.p8:2131 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2133 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gt.p8:2135 goto skip39a - bra p8l_skip39a - ; source: test_word_gt.p8:2136 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2137 skip39a: -p8l_skip39a - ; source: test_word_gt.p8:2139 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2140 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2142 goto skip39b - bra p8l_skip39b - ; source: test_word_gt.p8:2143 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2144 skip39b: -p8l_skip39b - ; source: test_word_gt.p8:2146 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_264_afterif - ; source: test_word_gt.p8:2147 success++ - inc p8b_main.p8v_success -label_asm_264_afterif - ; source: test_word_gt.p8:2150 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_266_else - ; source: test_word_gt.p8:2151 success++ - inc p8b_main.p8v_success - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_gt.p8:2153 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_word_gt.p8:2155 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2157 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gt.p8:2159 goto skip40a - bra p8l_skip40a - ; source: test_word_gt.p8:2160 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2161 skip40a: -p8l_skip40a - ; source: test_word_gt.p8:2163 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2164 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2166 goto skip40b - bra p8l_skip40b - ; source: test_word_gt.p8:2167 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2168 skip40b: -p8l_skip40b - ; source: test_word_gt.p8:2170 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_267_afterif - ; source: test_word_gt.p8:2171 success++ - inc p8b_main.p8v_success -label_asm_267_afterif - ; source: test_word_gt.p8:2174 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_269_else - ; source: test_word_gt.p8:2175 success++ - inc p8b_main.p8v_success - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_gt.p8:2177 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_word_gt.p8:2179 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2181 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gt.p8:2183 goto skip41a - bra p8l_skip41a - ; source: test_word_gt.p8:2184 lbl41a: fail_word(213) -p8l_lbl41a - ldy #>$d5 - lda #<$d5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2185 skip41a: -p8l_skip41a - ; source: test_word_gt.p8:2187 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2188 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2190 goto skip41b - bra p8l_skip41b - ; source: test_word_gt.p8:2191 lbl41b: fail_word(214) -p8l_lbl41b - ldy #>$d6 - lda #<$d6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2192 skip41b: -p8l_skip41b - ; source: test_word_gt.p8:2194 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_270_afterif - ; source: test_word_gt.p8:2195 fail_word(215) - ldy #>$d7 - lda #<$d7 - jsr p8b_main.p8s_fail_word -label_asm_270_afterif - ; source: test_word_gt.p8:2198 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_272_else - ; source: test_word_gt.p8:2199 fail_word(216) - ldy #>$d8 - lda #<$d8 - jsr p8b_main.p8s_fail_word - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_gt.p8:2201 success++ - inc p8b_main.p8v_success -label_asm_271_afterif - ; source: test_word_gt.p8:2203 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2205 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gt.p8:2207 goto skip42a - bra p8l_skip42a - ; source: test_word_gt.p8:2208 lbl42a: fail_word(217) -p8l_lbl42a - ldy #>$d9 - lda #<$d9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2209 skip42a: -p8l_skip42a - ; source: test_word_gt.p8:2211 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2212 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2214 goto skip42b - bra p8l_skip42b - ; source: test_word_gt.p8:2215 lbl42b: fail_word(218) -p8l_lbl42b - ldy #>$da - lda #<$da - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2216 skip42b: -p8l_skip42b - ; source: test_word_gt.p8:2218 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_273_afterif - ; source: test_word_gt.p8:2219 fail_word(219) - ldy #>$db - lda #<$db - jsr p8b_main.p8s_fail_word -label_asm_273_afterif - ; source: test_word_gt.p8:2222 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_275_else - ; source: test_word_gt.p8:2223 fail_word(220) - ldy #>$dc - lda #<$dc - jsr p8b_main.p8s_fail_word - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_gt.p8:2225 success++ - inc p8b_main.p8v_success -label_asm_274_afterif - ; source: test_word_gt.p8:2227 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:2228 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2230 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gt.p8:2232 goto skip43a - bra p8l_skip43a - ; source: test_word_gt.p8:2233 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2234 skip43a: -p8l_skip43a - ; source: test_word_gt.p8:2236 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2237 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2239 goto skip43b - bra p8l_skip43b - ; source: test_word_gt.p8:2240 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2241 skip43b: -p8l_skip43b - ; source: test_word_gt.p8:2243 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_276_afterif - ; source: test_word_gt.p8:2244 success++ - inc p8b_main.p8v_success -label_asm_276_afterif - ; source: test_word_gt.p8:2247 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_278_else - ; source: test_word_gt.p8:2248 success++ - inc p8b_main.p8v_success - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_gt.p8:2250 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_word_gt.p8:2252 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2254 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gt.p8:2256 goto skip44a - bra p8l_skip44a - ; source: test_word_gt.p8:2257 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2258 skip44a: -p8l_skip44a - ; source: test_word_gt.p8:2260 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2261 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2263 goto skip44b - bra p8l_skip44b - ; source: test_word_gt.p8:2264 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2265 skip44b: -p8l_skip44b - ; source: test_word_gt.p8:2267 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_279_afterif - ; source: test_word_gt.p8:2268 success++ - inc p8b_main.p8v_success -label_asm_279_afterif - ; source: test_word_gt.p8:2271 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_281_else - ; source: test_word_gt.p8:2272 success++ - inc p8b_main.p8v_success - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_gt.p8:2274 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_word_gt.p8:2276 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gt.p8:2278 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_gt.p8:2280 goto skip45a - bra p8l_skip45a - ; source: test_word_gt.p8:2281 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2282 skip45a: -p8l_skip45a - ; source: test_word_gt.p8:2284 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2285 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2287 goto skip45b - bra p8l_skip45b - ; source: test_word_gt.p8:2288 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2289 skip45b: -p8l_skip45b - ; source: test_word_gt.p8:2291 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_282_afterif - ; source: test_word_gt.p8:2292 success++ - inc p8b_main.p8v_success -label_asm_282_afterif - ; source: test_word_gt.p8:2295 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_284_else - ; source: test_word_gt.p8:2296 success++ - inc p8b_main.p8v_success - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_gt.p8:2298 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_word_gt.p8:2300 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2302 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gt.p8:2304 goto skip46a - bra p8l_skip46a - ; source: test_word_gt.p8:2305 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2306 skip46a: -p8l_skip46a - ; source: test_word_gt.p8:2308 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2309 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2311 goto skip46b - bra p8l_skip46b - ; source: test_word_gt.p8:2312 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2313 skip46b: -p8l_skip46b - ; source: test_word_gt.p8:2315 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_285_afterif - ; source: test_word_gt.p8:2316 success++ - inc p8b_main.p8v_success -label_asm_285_afterif - ; source: test_word_gt.p8:2319 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_287_else - ; source: test_word_gt.p8:2320 success++ - inc p8b_main.p8v_success - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_gt.p8:2322 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_word_gt.p8:2324 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2326 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gt.p8:2328 goto skip47a - bra p8l_skip47a - ; source: test_word_gt.p8:2329 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2330 skip47a: -p8l_skip47a - ; source: test_word_gt.p8:2332 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2333 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2335 goto skip47b - bra p8l_skip47b - ; source: test_word_gt.p8:2336 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2337 skip47b: -p8l_skip47b - ; source: test_word_gt.p8:2339 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_288_afterif - ; source: test_word_gt.p8:2340 success++ - inc p8b_main.p8v_success -label_asm_288_afterif - ; source: test_word_gt.p8:2343 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_290_else - ; source: test_word_gt.p8:2344 success++ - inc p8b_main.p8v_success - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_gt.p8:2346 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_word_gt.p8:2348 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2350 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gt.p8:2352 goto skip48a - bra p8l_skip48a - ; source: test_word_gt.p8:2353 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2354 skip48a: -p8l_skip48a - ; source: test_word_gt.p8:2356 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2357 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2359 goto skip48b - bra p8l_skip48b - ; source: test_word_gt.p8:2360 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2361 skip48b: -p8l_skip48b - ; source: test_word_gt.p8:2363 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_291_afterif - ; source: test_word_gt.p8:2364 success++ - inc p8b_main.p8v_success -label_asm_291_afterif - ; source: test_word_gt.p8:2367 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_293_else - ; source: test_word_gt.p8:2368 success++ - inc p8b_main.p8v_success - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_gt.p8:2370 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_word_gt.p8:2372 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gt.p8:2374 if x>value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gt.p8:2376 goto skip49a - bra p8l_skip49a - ; source: test_word_gt.p8:2377 lbl49a: fail_word(221) -p8l_lbl49a - ldy #>$dd - lda #<$dd - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2378 skip49a: -p8l_skip49a - ; source: test_word_gt.p8:2380 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2381 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2383 goto skip49b - bra p8l_skip49b - ; source: test_word_gt.p8:2384 lbl49b: fail_word(222) -p8l_lbl49b - ldy #>$de - lda #<$de - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2385 skip49b: -p8l_skip49b - ; source: test_word_gt.p8:2387 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_294_afterif - ; source: test_word_gt.p8:2388 fail_word(223) - ldy #>$df - lda #<$df - jsr p8b_main.p8s_fail_word -label_asm_294_afterif - ; source: test_word_gt.p8:2391 if x>value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_296_else - ; source: test_word_gt.p8:2392 fail_word(224) - ldy #>$e0 - lda #<$e0 - jsr p8b_main.p8s_fail_word - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_gt.p8:2394 success++ - inc p8b_main.p8v_success -label_asm_295_afterif - ; source: test_word_gt.p8:2396 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_gt.p8:1210 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .sint ? -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_gt.p8:2398 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_word_gt.p8:2399 word @shared x - ; source: test_word_gt.p8:2400 word[] values = [0, 0] - ; source: test_word_gt.p8:2399 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_gt.p8:2401 success = 0 - stz p8b_main.p8v_success - ; source: test_word_gt.p8:2402 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:2403 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:2405 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gt.p8:2407 goto skip1a - bra p8l_skip1a - ; source: test_word_gt.p8:2408 lbl1a: fail_word(225) -p8l_lbl1a - ldy #>$e1 - lda #<$e1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2409 skip1a: -p8l_skip1a - ; source: test_word_gt.p8:2411 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2412 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2414 goto skip1b - bra p8l_skip1b - ; source: test_word_gt.p8:2415 lbl1b: fail_word(226) -p8l_lbl1b - ldy #>$e2 - lda #<$e2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2416 skip1b: -p8l_skip1b - ; source: test_word_gt.p8:2418 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_297_afterif - ; source: test_word_gt.p8:2419 fail_word(227) - ldy #>$e3 - lda #<$e3 - jsr p8b_main.p8s_fail_word -label_asm_297_afterif - ; source: test_word_gt.p8:2422 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_299_else - ; source: test_word_gt.p8:2423 fail_word(228) - ldy #>$e4 - lda #<$e4 - jsr p8b_main.p8s_fail_word - bra label_asm_298_afterif -label_asm_299_else - ; source: test_word_gt.p8:2425 success++ - inc p8b_main.p8v_success -label_asm_298_afterif - ; source: test_word_gt.p8:2427 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2429 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gt.p8:2431 goto skip2a - bra p8l_skip2a - ; source: test_word_gt.p8:2432 lbl2a: fail_word(229) -p8l_lbl2a - ldy #>$e5 - lda #<$e5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2433 skip2a: -p8l_skip2a - ; source: test_word_gt.p8:2435 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2436 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2438 goto skip2b - bra p8l_skip2b - ; source: test_word_gt.p8:2439 lbl2b: fail_word(230) -p8l_lbl2b - ldy #>$e6 - lda #<$e6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2440 skip2b: -p8l_skip2b - ; source: test_word_gt.p8:2442 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_300_afterif - ; source: test_word_gt.p8:2443 fail_word(231) - ldy #>$e7 - lda #<$e7 - jsr p8b_main.p8s_fail_word -label_asm_300_afterif - ; source: test_word_gt.p8:2446 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_302_else - ; source: test_word_gt.p8:2447 fail_word(232) - ldy #>$e8 - lda #<$e8 - jsr p8b_main.p8s_fail_word - bra label_asm_301_afterif -label_asm_302_else - ; source: test_word_gt.p8:2449 success++ - inc p8b_main.p8v_success -label_asm_301_afterif - ; source: test_word_gt.p8:2451 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:2453 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_gt.p8:2455 goto skip3a - bra p8l_skip3a - ; source: test_word_gt.p8:2456 lbl3a: fail_word(233) -p8l_lbl3a - ldy #>$e9 - lda #<$e9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2457 skip3a: -p8l_skip3a - ; source: test_word_gt.p8:2459 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2460 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2462 goto skip3b - bra p8l_skip3b - ; source: test_word_gt.p8:2463 lbl3b: fail_word(234) -p8l_lbl3b - ldy #>$ea - lda #<$ea - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2464 skip3b: -p8l_skip3b - ; source: test_word_gt.p8:2466 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_303_afterif - ; source: test_word_gt.p8:2467 fail_word(235) - ldy #>$eb - lda #<$eb - jsr p8b_main.p8s_fail_word -label_asm_303_afterif - ; source: test_word_gt.p8:2470 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_305_else - ; source: test_word_gt.p8:2471 fail_word(236) - ldy #>$ec - lda #<$ec - jsr p8b_main.p8s_fail_word - bra label_asm_304_afterif -label_asm_305_else - ; source: test_word_gt.p8:2473 success++ - inc p8b_main.p8v_success -label_asm_304_afterif - ; source: test_word_gt.p8:2475 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2477 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gt.p8:2479 goto skip4a - bra p8l_skip4a - ; source: test_word_gt.p8:2480 lbl4a: fail_word(237) -p8l_lbl4a - ldy #>$ed - lda #<$ed - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2481 skip4a: -p8l_skip4a - ; source: test_word_gt.p8:2483 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2484 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2486 goto skip4b - bra p8l_skip4b - ; source: test_word_gt.p8:2487 lbl4b: fail_word(238) -p8l_lbl4b - ldy #>$ee - lda #<$ee - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2488 skip4b: -p8l_skip4b - ; source: test_word_gt.p8:2490 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_306_afterif - ; source: test_word_gt.p8:2491 fail_word(239) - ldy #>$ef - lda #<$ef - jsr p8b_main.p8s_fail_word -label_asm_306_afterif - ; source: test_word_gt.p8:2494 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_308_else - ; source: test_word_gt.p8:2495 fail_word(240) - ldy #>$f0 - lda #<$f0 - jsr p8b_main.p8s_fail_word - bra label_asm_307_afterif -label_asm_308_else - ; source: test_word_gt.p8:2497 success++ - inc p8b_main.p8v_success -label_asm_307_afterif - ; source: test_word_gt.p8:2499 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:2501 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gt.p8:2503 goto skip5a - bra p8l_skip5a - ; source: test_word_gt.p8:2504 lbl5a: fail_word(241) -p8l_lbl5a - ldy #>$f1 - lda #<$f1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2505 skip5a: -p8l_skip5a - ; source: test_word_gt.p8:2507 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2508 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2510 goto skip5b - bra p8l_skip5b - ; source: test_word_gt.p8:2511 lbl5b: fail_word(242) -p8l_lbl5b - ldy #>$f2 - lda #<$f2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2512 skip5b: -p8l_skip5b - ; source: test_word_gt.p8:2514 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_309_afterif - ; source: test_word_gt.p8:2515 fail_word(243) - ldy #>$f3 - lda #<$f3 - jsr p8b_main.p8s_fail_word -label_asm_309_afterif - ; source: test_word_gt.p8:2518 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_311_else - ; source: test_word_gt.p8:2519 fail_word(244) - ldy #>$f4 - lda #<$f4 - jsr p8b_main.p8s_fail_word - bra label_asm_310_afterif -label_asm_311_else - ; source: test_word_gt.p8:2521 success++ - inc p8b_main.p8v_success -label_asm_310_afterif - ; source: test_word_gt.p8:2523 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:2525 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gt.p8:2527 goto skip6a - bra p8l_skip6a - ; source: test_word_gt.p8:2528 lbl6a: fail_word(245) -p8l_lbl6a - ldy #>$f5 - lda #<$f5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2529 skip6a: -p8l_skip6a - ; source: test_word_gt.p8:2531 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2532 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2534 goto skip6b - bra p8l_skip6b - ; source: test_word_gt.p8:2535 lbl6b: fail_word(246) -p8l_lbl6b - ldy #>$f6 - lda #<$f6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2536 skip6b: -p8l_skip6b - ; source: test_word_gt.p8:2538 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_312_afterif - ; source: test_word_gt.p8:2539 fail_word(247) - ldy #>$f7 - lda #<$f7 - jsr p8b_main.p8s_fail_word -label_asm_312_afterif - ; source: test_word_gt.p8:2542 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_314_else - ; source: test_word_gt.p8:2543 fail_word(248) - ldy #>$f8 - lda #<$f8 - jsr p8b_main.p8s_fail_word - bra label_asm_313_afterif -label_asm_314_else - ; source: test_word_gt.p8:2545 success++ - inc p8b_main.p8v_success -label_asm_313_afterif - ; source: test_word_gt.p8:2547 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:2549 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gt.p8:2551 goto skip7a - bra p8l_skip7a - ; source: test_word_gt.p8:2552 lbl7a: fail_word(249) -p8l_lbl7a - ldy #>$f9 - lda #<$f9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2553 skip7a: -p8l_skip7a - ; source: test_word_gt.p8:2555 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2556 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2558 goto skip7b - bra p8l_skip7b - ; source: test_word_gt.p8:2559 lbl7b: fail_word(250) -p8l_lbl7b - ldy #>$fa - lda #<$fa - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2560 skip7b: -p8l_skip7b - ; source: test_word_gt.p8:2562 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_315_afterif - ; source: test_word_gt.p8:2563 fail_word(251) - ldy #>$fb - lda #<$fb - jsr p8b_main.p8s_fail_word -label_asm_315_afterif - ; source: test_word_gt.p8:2566 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_317_else - ; source: test_word_gt.p8:2567 fail_word(252) - ldy #>$fc - lda #<$fc - jsr p8b_main.p8s_fail_word - bra label_asm_316_afterif -label_asm_317_else - ; source: test_word_gt.p8:2569 success++ - inc p8b_main.p8v_success -label_asm_316_afterif - ; source: test_word_gt.p8:2571 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:2572 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:2574 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gt.p8:2576 goto skip8a - bra p8l_skip8a - ; source: test_word_gt.p8:2577 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2578 skip8a: -p8l_skip8a - ; source: test_word_gt.p8:2580 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2581 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2583 goto skip8b - bra p8l_skip8b - ; source: test_word_gt.p8:2584 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2585 skip8b: -p8l_skip8b - ; source: test_word_gt.p8:2587 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_318_afterif - ; source: test_word_gt.p8:2588 success++ - inc p8b_main.p8v_success -label_asm_318_afterif - ; source: test_word_gt.p8:2591 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_320_else - ; source: test_word_gt.p8:2592 success++ - inc p8b_main.p8v_success - bra label_asm_319_afterif -label_asm_320_else - ; source: test_word_gt.p8:2594 cx16.r0L++ - inc cx16.r0L -label_asm_319_afterif - ; source: test_word_gt.p8:2596 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2598 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gt.p8:2600 goto skip9a - bra p8l_skip9a - ; source: test_word_gt.p8:2601 lbl9a: fail_word(253) -p8l_lbl9a - ldy #>$fd - lda #<$fd - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2602 skip9a: -p8l_skip9a - ; source: test_word_gt.p8:2604 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2605 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2607 goto skip9b - bra p8l_skip9b - ; source: test_word_gt.p8:2608 lbl9b: fail_word(254) -p8l_lbl9b - ldy #>$fe - lda #<$fe - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2609 skip9b: -p8l_skip9b - ; source: test_word_gt.p8:2611 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_321_afterif - ; source: test_word_gt.p8:2612 fail_word(255) - ldy #>$ff - lda #<$ff - jsr p8b_main.p8s_fail_word -label_asm_321_afterif - ; source: test_word_gt.p8:2615 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_323_else - ; source: test_word_gt.p8:2616 fail_word(256) - ldy #>$0100 - lda #<$0100 - jsr p8b_main.p8s_fail_word - bra label_asm_322_afterif -label_asm_323_else - ; source: test_word_gt.p8:2618 success++ - inc p8b_main.p8v_success -label_asm_322_afterif - ; source: test_word_gt.p8:2620 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:2622 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_gt.p8:2624 goto skip10a - bra p8l_skip10a - ; source: test_word_gt.p8:2625 lbl10a: fail_word(257) -p8l_lbl10a - ldy #>$0101 - lda #<$0101 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2626 skip10a: -p8l_skip10a - ; source: test_word_gt.p8:2628 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2629 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2631 goto skip10b - bra p8l_skip10b - ; source: test_word_gt.p8:2632 lbl10b: fail_word(258) -p8l_lbl10b - ldy #>$0102 - lda #<$0102 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2633 skip10b: -p8l_skip10b - ; source: test_word_gt.p8:2635 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_324_afterif - ; source: test_word_gt.p8:2636 fail_word(259) - ldy #>$0103 - lda #<$0103 - jsr p8b_main.p8s_fail_word -label_asm_324_afterif - ; source: test_word_gt.p8:2639 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_326_else - ; source: test_word_gt.p8:2640 fail_word(260) - ldy #>$0104 - lda #<$0104 - jsr p8b_main.p8s_fail_word - bra label_asm_325_afterif -label_asm_326_else - ; source: test_word_gt.p8:2642 success++ - inc p8b_main.p8v_success -label_asm_325_afterif - ; source: test_word_gt.p8:2644 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2646 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gt.p8:2648 goto skip11a - bra p8l_skip11a - ; source: test_word_gt.p8:2649 lbl11a: fail_word(261) -p8l_lbl11a - ldy #>$0105 - lda #<$0105 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2650 skip11a: -p8l_skip11a - ; source: test_word_gt.p8:2652 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2653 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2655 goto skip11b - bra p8l_skip11b - ; source: test_word_gt.p8:2656 lbl11b: fail_word(262) -p8l_lbl11b - ldy #>$0106 - lda #<$0106 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2657 skip11b: -p8l_skip11b - ; source: test_word_gt.p8:2659 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_327_afterif - ; source: test_word_gt.p8:2660 fail_word(263) - ldy #>$0107 - lda #<$0107 - jsr p8b_main.p8s_fail_word -label_asm_327_afterif - ; source: test_word_gt.p8:2663 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_329_else - ; source: test_word_gt.p8:2664 fail_word(264) - ldy #>$0108 - lda #<$0108 - jsr p8b_main.p8s_fail_word - bra label_asm_328_afterif -label_asm_329_else - ; source: test_word_gt.p8:2666 success++ - inc p8b_main.p8v_success -label_asm_328_afterif - ; source: test_word_gt.p8:2668 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:2670 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gt.p8:2672 goto skip12a - bra p8l_skip12a - ; source: test_word_gt.p8:2673 lbl12a: fail_word(265) -p8l_lbl12a - ldy #>$0109 - lda #<$0109 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2674 skip12a: -p8l_skip12a - ; source: test_word_gt.p8:2676 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2677 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2679 goto skip12b - bra p8l_skip12b - ; source: test_word_gt.p8:2680 lbl12b: fail_word(266) -p8l_lbl12b - ldy #>$010a - lda #<$010a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2681 skip12b: -p8l_skip12b - ; source: test_word_gt.p8:2683 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_330_afterif - ; source: test_word_gt.p8:2684 fail_word(267) - ldy #>$010b - lda #<$010b - jsr p8b_main.p8s_fail_word -label_asm_330_afterif - ; source: test_word_gt.p8:2687 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_332_else - ; source: test_word_gt.p8:2688 fail_word(268) - ldy #>$010c - lda #<$010c - jsr p8b_main.p8s_fail_word - bra label_asm_331_afterif -label_asm_332_else - ; source: test_word_gt.p8:2690 success++ - inc p8b_main.p8v_success -label_asm_331_afterif - ; source: test_word_gt.p8:2692 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:2694 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gt.p8:2696 goto skip13a - bra p8l_skip13a - ; source: test_word_gt.p8:2697 lbl13a: fail_word(269) -p8l_lbl13a - ldy #>$010d - lda #<$010d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2698 skip13a: -p8l_skip13a - ; source: test_word_gt.p8:2700 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2701 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2703 goto skip13b - bra p8l_skip13b - ; source: test_word_gt.p8:2704 lbl13b: fail_word(270) -p8l_lbl13b - ldy #>$010e - lda #<$010e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2705 skip13b: -p8l_skip13b - ; source: test_word_gt.p8:2707 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_333_afterif - ; source: test_word_gt.p8:2708 fail_word(271) - ldy #>$010f - lda #<$010f - jsr p8b_main.p8s_fail_word -label_asm_333_afterif - ; source: test_word_gt.p8:2711 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_335_else - ; source: test_word_gt.p8:2712 fail_word(272) - ldy #>$0110 - lda #<$0110 - jsr p8b_main.p8s_fail_word - bra label_asm_334_afterif -label_asm_335_else - ; source: test_word_gt.p8:2714 success++ - inc p8b_main.p8v_success -label_asm_334_afterif - ; source: test_word_gt.p8:2716 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:2718 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gt.p8:2720 goto skip14a - bra p8l_skip14a - ; source: test_word_gt.p8:2721 lbl14a: fail_word(273) -p8l_lbl14a - ldy #>$0111 - lda #<$0111 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2722 skip14a: -p8l_skip14a - ; source: test_word_gt.p8:2724 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2725 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2727 goto skip14b - bra p8l_skip14b - ; source: test_word_gt.p8:2728 lbl14b: fail_word(274) -p8l_lbl14b - ldy #>$0112 - lda #<$0112 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2729 skip14b: -p8l_skip14b - ; source: test_word_gt.p8:2731 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_336_afterif - ; source: test_word_gt.p8:2732 fail_word(275) - ldy #>$0113 - lda #<$0113 - jsr p8b_main.p8s_fail_word -label_asm_336_afterif - ; source: test_word_gt.p8:2735 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_338_else - ; source: test_word_gt.p8:2736 fail_word(276) - ldy #>$0114 - lda #<$0114 - jsr p8b_main.p8s_fail_word - bra label_asm_337_afterif -label_asm_338_else - ; source: test_word_gt.p8:2738 success++ - inc p8b_main.p8v_success -label_asm_337_afterif - ; source: test_word_gt.p8:2740 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gt.p8:2741 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:2743 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gt.p8:2745 goto skip15a - bra p8l_skip15a - ; source: test_word_gt.p8:2746 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2747 skip15a: -p8l_skip15a - ; source: test_word_gt.p8:2749 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2750 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2752 goto skip15b - bra p8l_skip15b - ; source: test_word_gt.p8:2753 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2754 skip15b: -p8l_skip15b - ; source: test_word_gt.p8:2756 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_339_afterif - ; source: test_word_gt.p8:2757 success++ - inc p8b_main.p8v_success -label_asm_339_afterif - ; source: test_word_gt.p8:2760 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_341_else - ; source: test_word_gt.p8:2761 success++ - inc p8b_main.p8v_success - bra label_asm_340_afterif -label_asm_341_else - ; source: test_word_gt.p8:2763 cx16.r0L++ - inc cx16.r0L -label_asm_340_afterif - ; source: test_word_gt.p8:2765 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2767 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gt.p8:2769 goto skip16a - bra p8l_skip16a - ; source: test_word_gt.p8:2770 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2771 skip16a: -p8l_skip16a - ; source: test_word_gt.p8:2773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2774 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2776 goto skip16b - bra p8l_skip16b - ; source: test_word_gt.p8:2777 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2778 skip16b: -p8l_skip16b - ; source: test_word_gt.p8:2780 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_342_afterif - ; source: test_word_gt.p8:2781 success++ - inc p8b_main.p8v_success -label_asm_342_afterif - ; source: test_word_gt.p8:2784 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_344_else - ; source: test_word_gt.p8:2785 success++ - inc p8b_main.p8v_success - bra label_asm_343_afterif -label_asm_344_else - ; source: test_word_gt.p8:2787 cx16.r0L++ - inc cx16.r0L -label_asm_343_afterif - ; source: test_word_gt.p8:2789 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:2791 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_gt.p8:2793 goto skip17a - bra p8l_skip17a - ; source: test_word_gt.p8:2794 lbl17a: fail_word(277) -p8l_lbl17a - ldy #>$0115 - lda #<$0115 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2795 skip17a: -p8l_skip17a - ; source: test_word_gt.p8:2797 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2798 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2800 goto skip17b - bra p8l_skip17b - ; source: test_word_gt.p8:2801 lbl17b: fail_word(278) -p8l_lbl17b - ldy #>$0116 - lda #<$0116 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2802 skip17b: -p8l_skip17b - ; source: test_word_gt.p8:2804 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_345_afterif - ; source: test_word_gt.p8:2805 fail_word(279) - ldy #>$0117 - lda #<$0117 - jsr p8b_main.p8s_fail_word -label_asm_345_afterif - ; source: test_word_gt.p8:2808 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_347_else - ; source: test_word_gt.p8:2809 fail_word(280) - ldy #>$0118 - lda #<$0118 - jsr p8b_main.p8s_fail_word - bra label_asm_346_afterif -label_asm_347_else - ; source: test_word_gt.p8:2811 success++ - inc p8b_main.p8v_success -label_asm_346_afterif - ; source: test_word_gt.p8:2813 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2815 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gt.p8:2817 goto skip18a - bra p8l_skip18a - ; source: test_word_gt.p8:2818 lbl18a: fail_word(281) -p8l_lbl18a - ldy #>$0119 - lda #<$0119 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2819 skip18a: -p8l_skip18a - ; source: test_word_gt.p8:2821 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2822 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2824 goto skip18b - bra p8l_skip18b - ; source: test_word_gt.p8:2825 lbl18b: fail_word(282) -p8l_lbl18b - ldy #>$011a - lda #<$011a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2826 skip18b: -p8l_skip18b - ; source: test_word_gt.p8:2828 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_348_afterif - ; source: test_word_gt.p8:2829 fail_word(283) - ldy #>$011b - lda #<$011b - jsr p8b_main.p8s_fail_word -label_asm_348_afterif - ; source: test_word_gt.p8:2832 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_350_else - ; source: test_word_gt.p8:2833 fail_word(284) - ldy #>$011c - lda #<$011c - jsr p8b_main.p8s_fail_word - bra label_asm_349_afterif -label_asm_350_else - ; source: test_word_gt.p8:2835 success++ - inc p8b_main.p8v_success -label_asm_349_afterif - ; source: test_word_gt.p8:2837 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:2839 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gt.p8:2841 goto skip19a - bra p8l_skip19a - ; source: test_word_gt.p8:2842 lbl19a: fail_word(285) -p8l_lbl19a - ldy #>$011d - lda #<$011d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2843 skip19a: -p8l_skip19a - ; source: test_word_gt.p8:2845 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2846 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2848 goto skip19b - bra p8l_skip19b - ; source: test_word_gt.p8:2849 lbl19b: fail_word(286) -p8l_lbl19b - ldy #>$011e - lda #<$011e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2850 skip19b: -p8l_skip19b - ; source: test_word_gt.p8:2852 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_351_afterif - ; source: test_word_gt.p8:2853 fail_word(287) - ldy #>$011f - lda #<$011f - jsr p8b_main.p8s_fail_word -label_asm_351_afterif - ; source: test_word_gt.p8:2856 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_353_else - ; source: test_word_gt.p8:2857 fail_word(288) - ldy #>$0120 - lda #<$0120 - jsr p8b_main.p8s_fail_word - bra label_asm_352_afterif -label_asm_353_else - ; source: test_word_gt.p8:2859 success++ - inc p8b_main.p8v_success -label_asm_352_afterif - ; source: test_word_gt.p8:2861 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:2863 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gt.p8:2865 goto skip20a - bra p8l_skip20a - ; source: test_word_gt.p8:2866 lbl20a: fail_word(289) -p8l_lbl20a - ldy #>$0121 - lda #<$0121 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2867 skip20a: -p8l_skip20a - ; source: test_word_gt.p8:2869 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2870 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2872 goto skip20b - bra p8l_skip20b - ; source: test_word_gt.p8:2873 lbl20b: fail_word(290) -p8l_lbl20b - ldy #>$0122 - lda #<$0122 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2874 skip20b: -p8l_skip20b - ; source: test_word_gt.p8:2876 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_354_afterif - ; source: test_word_gt.p8:2877 fail_word(291) - ldy #>$0123 - lda #<$0123 - jsr p8b_main.p8s_fail_word -label_asm_354_afterif - ; source: test_word_gt.p8:2880 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_356_else - ; source: test_word_gt.p8:2881 fail_word(292) - ldy #>$0124 - lda #<$0124 - jsr p8b_main.p8s_fail_word - bra label_asm_355_afterif -label_asm_356_else - ; source: test_word_gt.p8:2883 success++ - inc p8b_main.p8v_success -label_asm_355_afterif - ; source: test_word_gt.p8:2885 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:2887 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gt.p8:2889 goto skip21a - bra p8l_skip21a - ; source: test_word_gt.p8:2890 lbl21a: fail_word(293) -p8l_lbl21a - ldy #>$0125 - lda #<$0125 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2891 skip21a: -p8l_skip21a - ; source: test_word_gt.p8:2893 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2894 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2896 goto skip21b - bra p8l_skip21b - ; source: test_word_gt.p8:2897 lbl21b: fail_word(294) -p8l_lbl21b - ldy #>$0126 - lda #<$0126 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2898 skip21b: -p8l_skip21b - ; source: test_word_gt.p8:2900 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_357_afterif - ; source: test_word_gt.p8:2901 fail_word(295) - ldy #>$0127 - lda #<$0127 - jsr p8b_main.p8s_fail_word -label_asm_357_afterif - ; source: test_word_gt.p8:2904 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_359_else - ; source: test_word_gt.p8:2905 fail_word(296) - ldy #>$0128 - lda #<$0128 - jsr p8b_main.p8s_fail_word - bra label_asm_358_afterif -label_asm_359_else - ; source: test_word_gt.p8:2907 success++ - inc p8b_main.p8v_success -label_asm_358_afterif - ; source: test_word_gt.p8:2909 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:2910 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:2912 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gt.p8:2914 goto skip22a - bra p8l_skip22a - ; source: test_word_gt.p8:2915 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2916 skip22a: -p8l_skip22a - ; source: test_word_gt.p8:2918 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2919 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2921 goto skip22b - bra p8l_skip22b - ; source: test_word_gt.p8:2922 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2923 skip22b: -p8l_skip22b - ; source: test_word_gt.p8:2925 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_360_afterif - ; source: test_word_gt.p8:2926 success++ - inc p8b_main.p8v_success -label_asm_360_afterif - ; source: test_word_gt.p8:2929 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_362_else - ; source: test_word_gt.p8:2930 success++ - inc p8b_main.p8v_success - bra label_asm_361_afterif -label_asm_362_else - ; source: test_word_gt.p8:2932 cx16.r0L++ - inc cx16.r0L -label_asm_361_afterif - ; source: test_word_gt.p8:2934 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2936 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gt.p8:2938 goto skip23a - bra p8l_skip23a - ; source: test_word_gt.p8:2939 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2940 skip23a: -p8l_skip23a - ; source: test_word_gt.p8:2942 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2943 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2945 goto skip23b - bra p8l_skip23b - ; source: test_word_gt.p8:2946 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2947 skip23b: -p8l_skip23b - ; source: test_word_gt.p8:2949 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_363_afterif - ; source: test_word_gt.p8:2950 success++ - inc p8b_main.p8v_success -label_asm_363_afterif - ; source: test_word_gt.p8:2953 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_365_else - ; source: test_word_gt.p8:2954 success++ - inc p8b_main.p8v_success - bra label_asm_364_afterif -label_asm_365_else - ; source: test_word_gt.p8:2956 cx16.r0L++ - inc cx16.r0L -label_asm_364_afterif - ; source: test_word_gt.p8:2958 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:2960 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_gt.p8:2962 goto skip24a - bra p8l_skip24a - ; source: test_word_gt.p8:2963 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2964 skip24a: -p8l_skip24a - ; source: test_word_gt.p8:2966 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2967 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2969 goto skip24b - bra p8l_skip24b - ; source: test_word_gt.p8:2970 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:2971 skip24b: -p8l_skip24b - ; source: test_word_gt.p8:2973 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_366_afterif - ; source: test_word_gt.p8:2974 success++ - inc p8b_main.p8v_success -label_asm_366_afterif - ; source: test_word_gt.p8:2977 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_368_else - ; source: test_word_gt.p8:2978 success++ - inc p8b_main.p8v_success - bra label_asm_367_afterif -label_asm_368_else - ; source: test_word_gt.p8:2980 cx16.r0L++ - inc cx16.r0L -label_asm_367_afterif - ; source: test_word_gt.p8:2982 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:2984 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gt.p8:2986 goto skip25a - bra p8l_skip25a - ; source: test_word_gt.p8:2987 lbl25a: fail_word(297) -p8l_lbl25a - ldy #>$0129 - lda #<$0129 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2988 skip25a: -p8l_skip25a - ; source: test_word_gt.p8:2990 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:2991 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:2993 goto skip25b - bra p8l_skip25b - ; source: test_word_gt.p8:2994 lbl25b: fail_word(298) -p8l_lbl25b - ldy #>$012a - lda #<$012a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:2995 skip25b: -p8l_skip25b - ; source: test_word_gt.p8:2997 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_369_afterif - ; source: test_word_gt.p8:2998 fail_word(299) - ldy #>$012b - lda #<$012b - jsr p8b_main.p8s_fail_word -label_asm_369_afterif - ; source: test_word_gt.p8:3001 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_371_else - ; source: test_word_gt.p8:3002 fail_word(300) - ldy #>$012c - lda #<$012c - jsr p8b_main.p8s_fail_word - bra label_asm_370_afterif -label_asm_371_else - ; source: test_word_gt.p8:3004 success++ - inc p8b_main.p8v_success -label_asm_370_afterif - ; source: test_word_gt.p8:3006 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:3008 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gt.p8:3010 goto skip26a - bra p8l_skip26a - ; source: test_word_gt.p8:3011 lbl26a: fail_word(301) -p8l_lbl26a - ldy #>$012d - lda #<$012d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3012 skip26a: -p8l_skip26a - ; source: test_word_gt.p8:3014 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3015 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3017 goto skip26b - bra p8l_skip26b - ; source: test_word_gt.p8:3018 lbl26b: fail_word(302) -p8l_lbl26b - ldy #>$012e - lda #<$012e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3019 skip26b: -p8l_skip26b - ; source: test_word_gt.p8:3021 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_372_afterif - ; source: test_word_gt.p8:3022 fail_word(303) - ldy #>$012f - lda #<$012f - jsr p8b_main.p8s_fail_word -label_asm_372_afterif - ; source: test_word_gt.p8:3025 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_374_else - ; source: test_word_gt.p8:3026 fail_word(304) - ldy #>$0130 - lda #<$0130 - jsr p8b_main.p8s_fail_word - bra label_asm_373_afterif -label_asm_374_else - ; source: test_word_gt.p8:3028 success++ - inc p8b_main.p8v_success -label_asm_373_afterif - ; source: test_word_gt.p8:3030 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:3032 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gt.p8:3034 goto skip27a - bra p8l_skip27a - ; source: test_word_gt.p8:3035 lbl27a: fail_word(305) -p8l_lbl27a - ldy #>$0131 - lda #<$0131 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3036 skip27a: -p8l_skip27a - ; source: test_word_gt.p8:3038 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3039 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3041 goto skip27b - bra p8l_skip27b - ; source: test_word_gt.p8:3042 lbl27b: fail_word(306) -p8l_lbl27b - ldy #>$0132 - lda #<$0132 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3043 skip27b: -p8l_skip27b - ; source: test_word_gt.p8:3045 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_375_afterif - ; source: test_word_gt.p8:3046 fail_word(307) - ldy #>$0133 - lda #<$0133 - jsr p8b_main.p8s_fail_word -label_asm_375_afterif - ; source: test_word_gt.p8:3049 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_377_else - ; source: test_word_gt.p8:3050 fail_word(308) - ldy #>$0134 - lda #<$0134 - jsr p8b_main.p8s_fail_word - bra label_asm_376_afterif -label_asm_377_else - ; source: test_word_gt.p8:3052 success++ - inc p8b_main.p8v_success -label_asm_376_afterif - ; source: test_word_gt.p8:3054 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:3056 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gt.p8:3058 goto skip28a - bra p8l_skip28a - ; source: test_word_gt.p8:3059 lbl28a: fail_word(309) -p8l_lbl28a - ldy #>$0135 - lda #<$0135 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3060 skip28a: -p8l_skip28a - ; source: test_word_gt.p8:3062 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3063 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3065 goto skip28b - bra p8l_skip28b - ; source: test_word_gt.p8:3066 lbl28b: fail_word(310) -p8l_lbl28b - ldy #>$0136 - lda #<$0136 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3067 skip28b: -p8l_skip28b - ; source: test_word_gt.p8:3069 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_378_afterif - ; source: test_word_gt.p8:3070 fail_word(311) - ldy #>$0137 - lda #<$0137 - jsr p8b_main.p8s_fail_word -label_asm_378_afterif - ; source: test_word_gt.p8:3073 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_380_else - ; source: test_word_gt.p8:3074 fail_word(312) - ldy #>$0138 - lda #<$0138 - jsr p8b_main.p8s_fail_word - bra label_asm_379_afterif -label_asm_380_else - ; source: test_word_gt.p8:3076 success++ - inc p8b_main.p8v_success -label_asm_379_afterif - ; source: test_word_gt.p8:3078 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:3079 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:3081 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gt.p8:3083 goto skip29a - bra p8l_skip29a - ; source: test_word_gt.p8:3084 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3085 skip29a: -p8l_skip29a - ; source: test_word_gt.p8:3087 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3088 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3090 goto skip29b - bra p8l_skip29b - ; source: test_word_gt.p8:3091 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3092 skip29b: -p8l_skip29b - ; source: test_word_gt.p8:3094 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_381_afterif - ; source: test_word_gt.p8:3095 success++ - inc p8b_main.p8v_success -label_asm_381_afterif - ; source: test_word_gt.p8:3098 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_383_else - ; source: test_word_gt.p8:3099 success++ - inc p8b_main.p8v_success - bra label_asm_382_afterif -label_asm_383_else - ; source: test_word_gt.p8:3101 cx16.r0L++ - inc cx16.r0L -label_asm_382_afterif - ; source: test_word_gt.p8:3103 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:3105 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gt.p8:3107 goto skip30a - bra p8l_skip30a - ; source: test_word_gt.p8:3108 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3109 skip30a: -p8l_skip30a - ; source: test_word_gt.p8:3111 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3112 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3114 goto skip30b - bra p8l_skip30b - ; source: test_word_gt.p8:3115 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3116 skip30b: -p8l_skip30b - ; source: test_word_gt.p8:3118 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_384_afterif - ; source: test_word_gt.p8:3119 success++ - inc p8b_main.p8v_success -label_asm_384_afterif - ; source: test_word_gt.p8:3122 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_386_else - ; source: test_word_gt.p8:3123 success++ - inc p8b_main.p8v_success - bra label_asm_385_afterif -label_asm_386_else - ; source: test_word_gt.p8:3125 cx16.r0L++ - inc cx16.r0L -label_asm_385_afterif - ; source: test_word_gt.p8:3127 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:3129 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_gt.p8:3131 goto skip31a - bra p8l_skip31a - ; source: test_word_gt.p8:3132 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3133 skip31a: -p8l_skip31a - ; source: test_word_gt.p8:3135 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3136 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3138 goto skip31b - bra p8l_skip31b - ; source: test_word_gt.p8:3139 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3140 skip31b: -p8l_skip31b - ; source: test_word_gt.p8:3142 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_387_afterif - ; source: test_word_gt.p8:3143 success++ - inc p8b_main.p8v_success -label_asm_387_afterif - ; source: test_word_gt.p8:3146 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_389_else - ; source: test_word_gt.p8:3147 success++ - inc p8b_main.p8v_success - bra label_asm_388_afterif -label_asm_389_else - ; source: test_word_gt.p8:3149 cx16.r0L++ - inc cx16.r0L -label_asm_388_afterif - ; source: test_word_gt.p8:3151 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:3153 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gt.p8:3155 goto skip32a - bra p8l_skip32a - ; source: test_word_gt.p8:3156 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3157 skip32a: -p8l_skip32a - ; source: test_word_gt.p8:3159 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3160 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3162 goto skip32b - bra p8l_skip32b - ; source: test_word_gt.p8:3163 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3164 skip32b: -p8l_skip32b - ; source: test_word_gt.p8:3166 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_390_afterif - ; source: test_word_gt.p8:3167 success++ - inc p8b_main.p8v_success -label_asm_390_afterif - ; source: test_word_gt.p8:3170 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_392_else - ; source: test_word_gt.p8:3171 success++ - inc p8b_main.p8v_success - bra label_asm_391_afterif -label_asm_392_else - ; source: test_word_gt.p8:3173 cx16.r0L++ - inc cx16.r0L -label_asm_391_afterif - ; source: test_word_gt.p8:3175 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:3177 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gt.p8:3179 goto skip33a - bra p8l_skip33a - ; source: test_word_gt.p8:3180 lbl33a: fail_word(313) -p8l_lbl33a - ldy #>$0139 - lda #<$0139 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3181 skip33a: -p8l_skip33a - ; source: test_word_gt.p8:3183 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3184 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3186 goto skip33b - bra p8l_skip33b - ; source: test_word_gt.p8:3187 lbl33b: fail_word(314) -p8l_lbl33b - ldy #>$013a - lda #<$013a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3188 skip33b: -p8l_skip33b - ; source: test_word_gt.p8:3190 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_393_afterif - ; source: test_word_gt.p8:3191 fail_word(315) - ldy #>$013b - lda #<$013b - jsr p8b_main.p8s_fail_word -label_asm_393_afterif - ; source: test_word_gt.p8:3194 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_395_else - ; source: test_word_gt.p8:3195 fail_word(316) - ldy #>$013c - lda #<$013c - jsr p8b_main.p8s_fail_word - bra label_asm_394_afterif -label_asm_395_else - ; source: test_word_gt.p8:3197 success++ - inc p8b_main.p8v_success -label_asm_394_afterif - ; source: test_word_gt.p8:3199 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:3201 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gt.p8:3203 goto skip34a - bra p8l_skip34a - ; source: test_word_gt.p8:3204 lbl34a: fail_word(317) -p8l_lbl34a - ldy #>$013d - lda #<$013d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3205 skip34a: -p8l_skip34a - ; source: test_word_gt.p8:3207 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3208 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3210 goto skip34b - bra p8l_skip34b - ; source: test_word_gt.p8:3211 lbl34b: fail_word(318) -p8l_lbl34b - ldy #>$013e - lda #<$013e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3212 skip34b: -p8l_skip34b - ; source: test_word_gt.p8:3214 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_396_afterif - ; source: test_word_gt.p8:3215 fail_word(319) - ldy #>$013f - lda #<$013f - jsr p8b_main.p8s_fail_word -label_asm_396_afterif - ; source: test_word_gt.p8:3218 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_398_else - ; source: test_word_gt.p8:3219 fail_word(320) - ldy #>$0140 - lda #<$0140 - jsr p8b_main.p8s_fail_word - bra label_asm_397_afterif -label_asm_398_else - ; source: test_word_gt.p8:3221 success++ - inc p8b_main.p8v_success -label_asm_397_afterif - ; source: test_word_gt.p8:3223 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:3225 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gt.p8:3227 goto skip35a - bra p8l_skip35a - ; source: test_word_gt.p8:3228 lbl35a: fail_word(321) -p8l_lbl35a - ldy #>$0141 - lda #<$0141 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3229 skip35a: -p8l_skip35a - ; source: test_word_gt.p8:3231 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3232 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3234 goto skip35b - bra p8l_skip35b - ; source: test_word_gt.p8:3235 lbl35b: fail_word(322) -p8l_lbl35b - ldy #>$0142 - lda #<$0142 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3236 skip35b: -p8l_skip35b - ; source: test_word_gt.p8:3238 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_399_afterif - ; source: test_word_gt.p8:3239 fail_word(323) - ldy #>$0143 - lda #<$0143 - jsr p8b_main.p8s_fail_word -label_asm_399_afterif - ; source: test_word_gt.p8:3242 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_401_else - ; source: test_word_gt.p8:3243 fail_word(324) - ldy #>$0144 - lda #<$0144 - jsr p8b_main.p8s_fail_word - bra label_asm_400_afterif -label_asm_401_else - ; source: test_word_gt.p8:3245 success++ - inc p8b_main.p8v_success -label_asm_400_afterif - ; source: test_word_gt.p8:3247 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:3248 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:3250 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gt.p8:3252 goto skip36a - bra p8l_skip36a - ; source: test_word_gt.p8:3253 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3254 skip36a: -p8l_skip36a - ; source: test_word_gt.p8:3256 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3257 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3259 goto skip36b - bra p8l_skip36b - ; source: test_word_gt.p8:3260 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3261 skip36b: -p8l_skip36b - ; source: test_word_gt.p8:3263 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_402_afterif - ; source: test_word_gt.p8:3264 success++ - inc p8b_main.p8v_success -label_asm_402_afterif - ; source: test_word_gt.p8:3267 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_404_else - ; source: test_word_gt.p8:3268 success++ - inc p8b_main.p8v_success - bra label_asm_403_afterif -label_asm_404_else - ; source: test_word_gt.p8:3270 cx16.r0L++ - inc cx16.r0L -label_asm_403_afterif - ; source: test_word_gt.p8:3272 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:3274 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gt.p8:3276 goto skip37a - bra p8l_skip37a - ; source: test_word_gt.p8:3277 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3278 skip37a: -p8l_skip37a - ; source: test_word_gt.p8:3280 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3281 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3283 goto skip37b - bra p8l_skip37b - ; source: test_word_gt.p8:3284 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3285 skip37b: -p8l_skip37b - ; source: test_word_gt.p8:3287 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_405_afterif - ; source: test_word_gt.p8:3288 success++ - inc p8b_main.p8v_success -label_asm_405_afterif - ; source: test_word_gt.p8:3291 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_407_else - ; source: test_word_gt.p8:3292 success++ - inc p8b_main.p8v_success - bra label_asm_406_afterif -label_asm_407_else - ; source: test_word_gt.p8:3294 cx16.r0L++ - inc cx16.r0L -label_asm_406_afterif - ; source: test_word_gt.p8:3296 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:3298 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_gt.p8:3300 goto skip38a - bra p8l_skip38a - ; source: test_word_gt.p8:3301 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3302 skip38a: -p8l_skip38a - ; source: test_word_gt.p8:3304 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3305 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3307 goto skip38b - bra p8l_skip38b - ; source: test_word_gt.p8:3308 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3309 skip38b: -p8l_skip38b - ; source: test_word_gt.p8:3311 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_408_afterif - ; source: test_word_gt.p8:3312 success++ - inc p8b_main.p8v_success -label_asm_408_afterif - ; source: test_word_gt.p8:3315 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_410_else - ; source: test_word_gt.p8:3316 success++ - inc p8b_main.p8v_success - bra label_asm_409_afterif -label_asm_410_else - ; source: test_word_gt.p8:3318 cx16.r0L++ - inc cx16.r0L -label_asm_409_afterif - ; source: test_word_gt.p8:3320 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:3322 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gt.p8:3324 goto skip39a - bra p8l_skip39a - ; source: test_word_gt.p8:3325 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3326 skip39a: -p8l_skip39a - ; source: test_word_gt.p8:3328 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3329 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3331 goto skip39b - bra p8l_skip39b - ; source: test_word_gt.p8:3332 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3333 skip39b: -p8l_skip39b - ; source: test_word_gt.p8:3335 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_411_afterif - ; source: test_word_gt.p8:3336 success++ - inc p8b_main.p8v_success -label_asm_411_afterif - ; source: test_word_gt.p8:3339 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_413_else - ; source: test_word_gt.p8:3340 success++ - inc p8b_main.p8v_success - bra label_asm_412_afterif -label_asm_413_else - ; source: test_word_gt.p8:3342 cx16.r0L++ - inc cx16.r0L -label_asm_412_afterif - ; source: test_word_gt.p8:3344 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:3346 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gt.p8:3348 goto skip40a - bra p8l_skip40a - ; source: test_word_gt.p8:3349 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3350 skip40a: -p8l_skip40a - ; source: test_word_gt.p8:3352 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3353 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3355 goto skip40b - bra p8l_skip40b - ; source: test_word_gt.p8:3356 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3357 skip40b: -p8l_skip40b - ; source: test_word_gt.p8:3359 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_414_afterif - ; source: test_word_gt.p8:3360 success++ - inc p8b_main.p8v_success -label_asm_414_afterif - ; source: test_word_gt.p8:3363 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_416_else - ; source: test_word_gt.p8:3364 success++ - inc p8b_main.p8v_success - bra label_asm_415_afterif -label_asm_416_else - ; source: test_word_gt.p8:3366 cx16.r0L++ - inc cx16.r0L -label_asm_415_afterif - ; source: test_word_gt.p8:3368 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:3370 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gt.p8:3372 goto skip41a - bra p8l_skip41a - ; source: test_word_gt.p8:3373 lbl41a: fail_word(325) -p8l_lbl41a - ldy #>$0145 - lda #<$0145 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3374 skip41a: -p8l_skip41a - ; source: test_word_gt.p8:3376 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3377 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3379 goto skip41b - bra p8l_skip41b - ; source: test_word_gt.p8:3380 lbl41b: fail_word(326) -p8l_lbl41b - ldy #>$0146 - lda #<$0146 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3381 skip41b: -p8l_skip41b - ; source: test_word_gt.p8:3383 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_417_afterif - ; source: test_word_gt.p8:3384 fail_word(327) - ldy #>$0147 - lda #<$0147 - jsr p8b_main.p8s_fail_word -label_asm_417_afterif - ; source: test_word_gt.p8:3387 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_419_else - ; source: test_word_gt.p8:3388 fail_word(328) - ldy #>$0148 - lda #<$0148 - jsr p8b_main.p8s_fail_word - bra label_asm_418_afterif -label_asm_419_else - ; source: test_word_gt.p8:3390 success++ - inc p8b_main.p8v_success -label_asm_418_afterif - ; source: test_word_gt.p8:3392 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:3394 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gt.p8:3396 goto skip42a - bra p8l_skip42a - ; source: test_word_gt.p8:3397 lbl42a: fail_word(329) -p8l_lbl42a - ldy #>$0149 - lda #<$0149 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3398 skip42a: -p8l_skip42a - ; source: test_word_gt.p8:3400 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3401 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3403 goto skip42b - bra p8l_skip42b - ; source: test_word_gt.p8:3404 lbl42b: fail_word(330) -p8l_lbl42b - ldy #>$014a - lda #<$014a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3405 skip42b: -p8l_skip42b - ; source: test_word_gt.p8:3407 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_420_afterif - ; source: test_word_gt.p8:3408 fail_word(331) - ldy #>$014b - lda #<$014b - jsr p8b_main.p8s_fail_word -label_asm_420_afterif - ; source: test_word_gt.p8:3411 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_422_else - ; source: test_word_gt.p8:3412 fail_word(332) - ldy #>$014c - lda #<$014c - jsr p8b_main.p8s_fail_word - bra label_asm_421_afterif -label_asm_422_else - ; source: test_word_gt.p8:3414 success++ - inc p8b_main.p8v_success -label_asm_421_afterif - ; source: test_word_gt.p8:3416 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:3417 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gt.p8:3419 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gt.p8:3421 goto skip43a - bra p8l_skip43a - ; source: test_word_gt.p8:3422 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3423 skip43a: -p8l_skip43a - ; source: test_word_gt.p8:3425 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3426 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3428 goto skip43b - bra p8l_skip43b - ; source: test_word_gt.p8:3429 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3430 skip43b: -p8l_skip43b - ; source: test_word_gt.p8:3432 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_423_afterif - ; source: test_word_gt.p8:3433 success++ - inc p8b_main.p8v_success -label_asm_423_afterif - ; source: test_word_gt.p8:3436 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_425_else - ; source: test_word_gt.p8:3437 success++ - inc p8b_main.p8v_success - bra label_asm_424_afterif -label_asm_425_else - ; source: test_word_gt.p8:3439 cx16.r0L++ - inc cx16.r0L -label_asm_424_afterif - ; source: test_word_gt.p8:3441 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gt.p8:3443 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gt.p8:3445 goto skip44a - bra p8l_skip44a - ; source: test_word_gt.p8:3446 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3447 skip44a: -p8l_skip44a - ; source: test_word_gt.p8:3449 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3450 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3452 goto skip44b - bra p8l_skip44b - ; source: test_word_gt.p8:3453 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3454 skip44b: -p8l_skip44b - ; source: test_word_gt.p8:3456 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_426_afterif - ; source: test_word_gt.p8:3457 success++ - inc p8b_main.p8v_success -label_asm_426_afterif - ; source: test_word_gt.p8:3460 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_428_else - ; source: test_word_gt.p8:3461 success++ - inc p8b_main.p8v_success - bra label_asm_427_afterif -label_asm_428_else - ; source: test_word_gt.p8:3463 cx16.r0L++ - inc cx16.r0L -label_asm_427_afterif - ; source: test_word_gt.p8:3465 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gt.p8:3467 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_gt.p8:3469 goto skip45a - bra p8l_skip45a - ; source: test_word_gt.p8:3470 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3471 skip45a: -p8l_skip45a - ; source: test_word_gt.p8:3473 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3474 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3476 goto skip45b - bra p8l_skip45b - ; source: test_word_gt.p8:3477 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3478 skip45b: -p8l_skip45b - ; source: test_word_gt.p8:3480 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_429_afterif - ; source: test_word_gt.p8:3481 success++ - inc p8b_main.p8v_success -label_asm_429_afterif - ; source: test_word_gt.p8:3484 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_431_else - ; source: test_word_gt.p8:3485 success++ - inc p8b_main.p8v_success - bra label_asm_430_afterif -label_asm_431_else - ; source: test_word_gt.p8:3487 cx16.r0L++ - inc cx16.r0L -label_asm_430_afterif - ; source: test_word_gt.p8:3489 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gt.p8:3491 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gt.p8:3493 goto skip46a - bra p8l_skip46a - ; source: test_word_gt.p8:3494 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3495 skip46a: -p8l_skip46a - ; source: test_word_gt.p8:3497 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3498 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3500 goto skip46b - bra p8l_skip46b - ; source: test_word_gt.p8:3501 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3502 skip46b: -p8l_skip46b - ; source: test_word_gt.p8:3504 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_432_afterif - ; source: test_word_gt.p8:3505 success++ - inc p8b_main.p8v_success -label_asm_432_afterif - ; source: test_word_gt.p8:3508 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_434_else - ; source: test_word_gt.p8:3509 success++ - inc p8b_main.p8v_success - bra label_asm_433_afterif -label_asm_434_else - ; source: test_word_gt.p8:3511 cx16.r0L++ - inc cx16.r0L -label_asm_433_afterif - ; source: test_word_gt.p8:3513 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gt.p8:3515 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gt.p8:3517 goto skip47a - bra p8l_skip47a - ; source: test_word_gt.p8:3518 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3519 skip47a: -p8l_skip47a - ; source: test_word_gt.p8:3521 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3522 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3524 goto skip47b - bra p8l_skip47b - ; source: test_word_gt.p8:3525 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3526 skip47b: -p8l_skip47b - ; source: test_word_gt.p8:3528 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_435_afterif - ; source: test_word_gt.p8:3529 success++ - inc p8b_main.p8v_success -label_asm_435_afterif - ; source: test_word_gt.p8:3532 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_437_else - ; source: test_word_gt.p8:3533 success++ - inc p8b_main.p8v_success - bra label_asm_436_afterif -label_asm_437_else - ; source: test_word_gt.p8:3535 cx16.r0L++ - inc cx16.r0L -label_asm_436_afterif - ; source: test_word_gt.p8:3537 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gt.p8:3539 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gt.p8:3541 goto skip48a - bra p8l_skip48a - ; source: test_word_gt.p8:3542 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3543 skip48a: -p8l_skip48a - ; source: test_word_gt.p8:3545 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3546 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3548 goto skip48b - bra p8l_skip48b - ; source: test_word_gt.p8:3549 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3550 skip48b: -p8l_skip48b - ; source: test_word_gt.p8:3552 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_438_afterif - ; source: test_word_gt.p8:3553 success++ - inc p8b_main.p8v_success -label_asm_438_afterif - ; source: test_word_gt.p8:3556 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_440_else - ; source: test_word_gt.p8:3557 success++ - inc p8b_main.p8v_success - bra label_asm_439_afterif -label_asm_440_else - ; source: test_word_gt.p8:3559 cx16.r0L++ - inc cx16.r0L -label_asm_439_afterif - ; source: test_word_gt.p8:3561 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gt.p8:3563 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gt.p8:3565 goto skip49a - bra p8l_skip49a - ; source: test_word_gt.p8:3566 lbl49a: fail_word(333) -p8l_lbl49a - ldy #>$014d - lda #<$014d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3567 skip49a: -p8l_skip49a - ; source: test_word_gt.p8:3569 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3570 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3572 goto skip49b - bra p8l_skip49b - ; source: test_word_gt.p8:3573 lbl49b: fail_word(334) -p8l_lbl49b - ldy #>$014e - lda #<$014e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3574 skip49b: -p8l_skip49b - ; source: test_word_gt.p8:3576 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_441_afterif - ; source: test_word_gt.p8:3577 fail_word(335) - ldy #>$014f - lda #<$014f - jsr p8b_main.p8s_fail_word -label_asm_441_afterif - ; source: test_word_gt.p8:3580 if x>values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_443_else - ; source: test_word_gt.p8:3581 fail_word(336) - ldy #>$0150 - lda #<$0150 - jsr p8b_main.p8s_fail_word - bra label_asm_442_afterif -label_asm_443_else - ; source: test_word_gt.p8:3583 success++ - inc p8b_main.p8v_success -label_asm_442_afterif - ; source: test_word_gt.p8:3585 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_gt.p8:2398 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -p8v_values .sint $0000, $0000 - .pend - ; source: test_word_gt.p8:3587 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_word_gt.p8:3588 word @shared x - ; source: test_word_gt.p8:3591 float @shared f4 = 1.0 - ; source: test_word_gt.p8:3592 float @shared f5 = 1.0 - ; source: test_word_gt.p8:3588 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_gt.p8:3589 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_gt.p8:3590 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_gt.p8:3591 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_word_gt.p8:3592 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_word_gt.p8:3593 success = 0 - stz p8b_main.p8v_success - ; source: test_word_gt.p8:3594 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:3596 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gt.p8:3598 goto skip1a - bra p8l_skip1a - ; source: test_word_gt.p8:3599 lbl1a: fail_word(337) -p8l_lbl1a - ldy #>$0151 - lda #<$0151 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3600 skip1a: -p8l_skip1a - ; source: test_word_gt.p8:3602 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3603 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3605 goto skip1b - bra p8l_skip1b - ; source: test_word_gt.p8:3606 lbl1b: fail_word(338) -p8l_lbl1b - ldy #>$0152 - lda #<$0152 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3607 skip1b: -p8l_skip1b - ; source: test_word_gt.p8:3609 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_444_afterif - ; source: test_word_gt.p8:3610 fail_word(339) - ldy #>$0153 - lda #<$0153 - jsr p8b_main.p8s_fail_word -label_asm_444_afterif - ; source: test_word_gt.p8:3613 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_446_else - ; source: test_word_gt.p8:3614 fail_word(340) - ldy #>$0154 - lda #<$0154 - jsr p8b_main.p8s_fail_word - bra label_asm_445_afterif -label_asm_446_else - ; source: test_word_gt.p8:3616 success++ - inc p8b_main.p8v_success -label_asm_445_afterif - ; source: test_word_gt.p8:3619 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gt.p8:3621 goto skip2a - bra p8l_skip2a - ; source: test_word_gt.p8:3622 lbl2a: fail_word(341) -p8l_lbl2a - ldy #>$0155 - lda #<$0155 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3623 skip2a: -p8l_skip2a - ; source: test_word_gt.p8:3625 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3626 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3628 goto skip2b - bra p8l_skip2b - ; source: test_word_gt.p8:3629 lbl2b: fail_word(342) -p8l_lbl2b - ldy #>$0156 - lda #<$0156 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3630 skip2b: -p8l_skip2b - ; source: test_word_gt.p8:3632 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_447_afterif - ; source: test_word_gt.p8:3633 fail_word(343) - ldy #>$0157 - lda #<$0157 - jsr p8b_main.p8s_fail_word -label_asm_447_afterif - ; source: test_word_gt.p8:3636 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_449_else - ; source: test_word_gt.p8:3637 fail_word(344) - ldy #>$0158 - lda #<$0158 - jsr p8b_main.p8s_fail_word - bra label_asm_448_afterif -label_asm_449_else - ; source: test_word_gt.p8:3639 success++ - inc p8b_main.p8v_success -label_asm_448_afterif - ; source: test_word_gt.p8:3642 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_gt.p8:3644 goto skip3a - bra p8l_skip3a - ; source: test_word_gt.p8:3645 lbl3a: fail_word(345) -p8l_lbl3a - ldy #>$0159 - lda #<$0159 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3646 skip3a: -p8l_skip3a - ; source: test_word_gt.p8:3648 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3649 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3651 goto skip3b - bra p8l_skip3b - ; source: test_word_gt.p8:3652 lbl3b: fail_word(346) -p8l_lbl3b - ldy #>$015a - lda #<$015a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3653 skip3b: -p8l_skip3b - ; source: test_word_gt.p8:3655 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_450_afterif - ; source: test_word_gt.p8:3656 fail_word(347) - ldy #>$015b - lda #<$015b - jsr p8b_main.p8s_fail_word -label_asm_450_afterif - ; source: test_word_gt.p8:3659 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_452_else - ; source: test_word_gt.p8:3660 fail_word(348) - ldy #>$015c - lda #<$015c - jsr p8b_main.p8s_fail_word - bra label_asm_451_afterif -label_asm_452_else - ; source: test_word_gt.p8:3662 success++ - inc p8b_main.p8v_success -label_asm_451_afterif - ; source: test_word_gt.p8:3665 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gt.p8:3667 goto skip4a - bra p8l_skip4a - ; source: test_word_gt.p8:3668 lbl4a: fail_word(349) -p8l_lbl4a - ldy #>$015d - lda #<$015d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3669 skip4a: -p8l_skip4a - ; source: test_word_gt.p8:3671 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3672 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3674 goto skip4b - bra p8l_skip4b - ; source: test_word_gt.p8:3675 lbl4b: fail_word(350) -p8l_lbl4b - ldy #>$015e - lda #<$015e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3676 skip4b: -p8l_skip4b - ; source: test_word_gt.p8:3678 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_453_afterif - ; source: test_word_gt.p8:3679 fail_word(351) - ldy #>$015f - lda #<$015f - jsr p8b_main.p8s_fail_word -label_asm_453_afterif - ; source: test_word_gt.p8:3682 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_455_else - ; source: test_word_gt.p8:3683 fail_word(352) - ldy #>$0160 - lda #<$0160 - jsr p8b_main.p8s_fail_word - bra label_asm_454_afterif -label_asm_455_else - ; source: test_word_gt.p8:3685 success++ - inc p8b_main.p8v_success -label_asm_454_afterif - ; source: test_word_gt.p8:3688 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gt.p8:3690 goto skip5a - bra p8l_skip5a - ; source: test_word_gt.p8:3691 lbl5a: fail_word(353) -p8l_lbl5a - ldy #>$0161 - lda #<$0161 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3692 skip5a: -p8l_skip5a - ; source: test_word_gt.p8:3694 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3695 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3697 goto skip5b - bra p8l_skip5b - ; source: test_word_gt.p8:3698 lbl5b: fail_word(354) -p8l_lbl5b - ldy #>$0162 - lda #<$0162 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3699 skip5b: -p8l_skip5b - ; source: test_word_gt.p8:3701 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_456_afterif - ; source: test_word_gt.p8:3702 fail_word(355) - ldy #>$0163 - lda #<$0163 - jsr p8b_main.p8s_fail_word -label_asm_456_afterif - ; source: test_word_gt.p8:3705 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_458_else - ; source: test_word_gt.p8:3706 fail_word(356) - ldy #>$0164 - lda #<$0164 - jsr p8b_main.p8s_fail_word - bra label_asm_457_afterif -label_asm_458_else - ; source: test_word_gt.p8:3708 success++ - inc p8b_main.p8v_success -label_asm_457_afterif - ; source: test_word_gt.p8:3711 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gt.p8:3713 goto skip6a - bra p8l_skip6a - ; source: test_word_gt.p8:3714 lbl6a: fail_word(357) -p8l_lbl6a - ldy #>$0165 - lda #<$0165 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3715 skip6a: -p8l_skip6a - ; source: test_word_gt.p8:3717 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3718 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3720 goto skip6b - bra p8l_skip6b - ; source: test_word_gt.p8:3721 lbl6b: fail_word(358) -p8l_lbl6b - ldy #>$0166 - lda #<$0166 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3722 skip6b: -p8l_skip6b - ; source: test_word_gt.p8:3724 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_459_afterif - ; source: test_word_gt.p8:3725 fail_word(359) - ldy #>$0167 - lda #<$0167 - jsr p8b_main.p8s_fail_word -label_asm_459_afterif - ; source: test_word_gt.p8:3728 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_461_else - ; source: test_word_gt.p8:3729 fail_word(360) - ldy #>$0168 - lda #<$0168 - jsr p8b_main.p8s_fail_word - bra label_asm_460_afterif -label_asm_461_else - ; source: test_word_gt.p8:3731 success++ - inc p8b_main.p8v_success -label_asm_460_afterif - ; source: test_word_gt.p8:3734 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gt.p8:3736 goto skip7a - bra p8l_skip7a - ; source: test_word_gt.p8:3737 lbl7a: fail_word(361) -p8l_lbl7a - ldy #>$0169 - lda #<$0169 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3738 skip7a: -p8l_skip7a - ; source: test_word_gt.p8:3740 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3741 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3743 goto skip7b - bra p8l_skip7b - ; source: test_word_gt.p8:3744 lbl7b: fail_word(362) -p8l_lbl7b - ldy #>$016a - lda #<$016a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3745 skip7b: -p8l_skip7b - ; source: test_word_gt.p8:3747 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_462_afterif - ; source: test_word_gt.p8:3748 fail_word(363) - ldy #>$016b - lda #<$016b - jsr p8b_main.p8s_fail_word -label_asm_462_afterif - ; source: test_word_gt.p8:3751 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_464_else - ; source: test_word_gt.p8:3752 fail_word(364) - ldy #>$016c - lda #<$016c - jsr p8b_main.p8s_fail_word - bra label_asm_463_afterif -label_asm_464_else - ; source: test_word_gt.p8:3754 success++ - inc p8b_main.p8v_success -label_asm_463_afterif - ; source: test_word_gt.p8:3756 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:3758 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gt.p8:3760 goto skip8a - bra p8l_skip8a - ; source: test_word_gt.p8:3761 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3762 skip8a: -p8l_skip8a - ; source: test_word_gt.p8:3764 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3765 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3767 goto skip8b - bra p8l_skip8b - ; source: test_word_gt.p8:3768 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3769 skip8b: -p8l_skip8b - ; source: test_word_gt.p8:3771 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_465_afterif - ; source: test_word_gt.p8:3772 success++ - inc p8b_main.p8v_success -label_asm_465_afterif - ; source: test_word_gt.p8:3775 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_467_else - ; source: test_word_gt.p8:3776 success++ - inc p8b_main.p8v_success - bra label_asm_466_afterif -label_asm_467_else - ; source: test_word_gt.p8:3778 cx16.r0L++ - inc cx16.r0L -label_asm_466_afterif - ; source: test_word_gt.p8:3781 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gt.p8:3783 goto skip9a - bra p8l_skip9a - ; source: test_word_gt.p8:3784 lbl9a: fail_word(365) -p8l_lbl9a - ldy #>$016d - lda #<$016d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3785 skip9a: -p8l_skip9a - ; source: test_word_gt.p8:3787 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3788 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3790 goto skip9b - bra p8l_skip9b - ; source: test_word_gt.p8:3791 lbl9b: fail_word(366) -p8l_lbl9b - ldy #>$016e - lda #<$016e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3792 skip9b: -p8l_skip9b - ; source: test_word_gt.p8:3794 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_468_afterif - ; source: test_word_gt.p8:3795 fail_word(367) - ldy #>$016f - lda #<$016f - jsr p8b_main.p8s_fail_word -label_asm_468_afterif - ; source: test_word_gt.p8:3798 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_470_else - ; source: test_word_gt.p8:3799 fail_word(368) - ldy #>$0170 - lda #<$0170 - jsr p8b_main.p8s_fail_word - bra label_asm_469_afterif -label_asm_470_else - ; source: test_word_gt.p8:3801 success++ - inc p8b_main.p8v_success -label_asm_469_afterif - ; source: test_word_gt.p8:3804 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_gt.p8:3806 goto skip10a - bra p8l_skip10a - ; source: test_word_gt.p8:3807 lbl10a: fail_word(369) -p8l_lbl10a - ldy #>$0171 - lda #<$0171 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3808 skip10a: -p8l_skip10a - ; source: test_word_gt.p8:3810 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3811 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3813 goto skip10b - bra p8l_skip10b - ; source: test_word_gt.p8:3814 lbl10b: fail_word(370) -p8l_lbl10b - ldy #>$0172 - lda #<$0172 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3815 skip10b: -p8l_skip10b - ; source: test_word_gt.p8:3817 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_471_afterif - ; source: test_word_gt.p8:3818 fail_word(371) - ldy #>$0173 - lda #<$0173 - jsr p8b_main.p8s_fail_word -label_asm_471_afterif - ; source: test_word_gt.p8:3821 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_473_else - ; source: test_word_gt.p8:3822 fail_word(372) - ldy #>$0174 - lda #<$0174 - jsr p8b_main.p8s_fail_word - bra label_asm_472_afterif -label_asm_473_else - ; source: test_word_gt.p8:3824 success++ - inc p8b_main.p8v_success -label_asm_472_afterif - ; source: test_word_gt.p8:3827 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gt.p8:3829 goto skip11a - bra p8l_skip11a - ; source: test_word_gt.p8:3830 lbl11a: fail_word(373) -p8l_lbl11a - ldy #>$0175 - lda #<$0175 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3831 skip11a: -p8l_skip11a - ; source: test_word_gt.p8:3833 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3834 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3836 goto skip11b - bra p8l_skip11b - ; source: test_word_gt.p8:3837 lbl11b: fail_word(374) -p8l_lbl11b - ldy #>$0176 - lda #<$0176 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3838 skip11b: -p8l_skip11b - ; source: test_word_gt.p8:3840 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_474_afterif - ; source: test_word_gt.p8:3841 fail_word(375) - ldy #>$0177 - lda #<$0177 - jsr p8b_main.p8s_fail_word -label_asm_474_afterif - ; source: test_word_gt.p8:3844 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_476_else - ; source: test_word_gt.p8:3845 fail_word(376) - ldy #>$0178 - lda #<$0178 - jsr p8b_main.p8s_fail_word - bra label_asm_475_afterif -label_asm_476_else - ; source: test_word_gt.p8:3847 success++ - inc p8b_main.p8v_success -label_asm_475_afterif - ; source: test_word_gt.p8:3850 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gt.p8:3852 goto skip12a - bra p8l_skip12a - ; source: test_word_gt.p8:3853 lbl12a: fail_word(377) -p8l_lbl12a - ldy #>$0179 - lda #<$0179 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3854 skip12a: -p8l_skip12a - ; source: test_word_gt.p8:3856 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3857 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3859 goto skip12b - bra p8l_skip12b - ; source: test_word_gt.p8:3860 lbl12b: fail_word(378) -p8l_lbl12b - ldy #>$017a - lda #<$017a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3861 skip12b: -p8l_skip12b - ; source: test_word_gt.p8:3863 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_477_afterif - ; source: test_word_gt.p8:3864 fail_word(379) - ldy #>$017b - lda #<$017b - jsr p8b_main.p8s_fail_word -label_asm_477_afterif - ; source: test_word_gt.p8:3867 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_479_else - ; source: test_word_gt.p8:3868 fail_word(380) - ldy #>$017c - lda #<$017c - jsr p8b_main.p8s_fail_word - bra label_asm_478_afterif -label_asm_479_else - ; source: test_word_gt.p8:3870 success++ - inc p8b_main.p8v_success -label_asm_478_afterif - ; source: test_word_gt.p8:3873 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gt.p8:3875 goto skip13a - bra p8l_skip13a - ; source: test_word_gt.p8:3876 lbl13a: fail_word(381) -p8l_lbl13a - ldy #>$017d - lda #<$017d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3877 skip13a: -p8l_skip13a - ; source: test_word_gt.p8:3879 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3880 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3882 goto skip13b - bra p8l_skip13b - ; source: test_word_gt.p8:3883 lbl13b: fail_word(382) -p8l_lbl13b - ldy #>$017e - lda #<$017e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3884 skip13b: -p8l_skip13b - ; source: test_word_gt.p8:3886 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_480_afterif - ; source: test_word_gt.p8:3887 fail_word(383) - ldy #>$017f - lda #<$017f - jsr p8b_main.p8s_fail_word -label_asm_480_afterif - ; source: test_word_gt.p8:3890 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_482_else - ; source: test_word_gt.p8:3891 fail_word(384) - ldy #>$0180 - lda #<$0180 - jsr p8b_main.p8s_fail_word - bra label_asm_481_afterif -label_asm_482_else - ; source: test_word_gt.p8:3893 success++ - inc p8b_main.p8v_success -label_asm_481_afterif - ; source: test_word_gt.p8:3896 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gt.p8:3898 goto skip14a - bra p8l_skip14a - ; source: test_word_gt.p8:3899 lbl14a: fail_word(385) -p8l_lbl14a - ldy #>$0181 - lda #<$0181 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3900 skip14a: -p8l_skip14a - ; source: test_word_gt.p8:3902 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3903 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3905 goto skip14b - bra p8l_skip14b - ; source: test_word_gt.p8:3906 lbl14b: fail_word(386) -p8l_lbl14b - ldy #>$0182 - lda #<$0182 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3907 skip14b: -p8l_skip14b - ; source: test_word_gt.p8:3909 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_483_afterif - ; source: test_word_gt.p8:3910 fail_word(387) - ldy #>$0183 - lda #<$0183 - jsr p8b_main.p8s_fail_word -label_asm_483_afterif - ; source: test_word_gt.p8:3913 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_485_else - ; source: test_word_gt.p8:3914 fail_word(388) - ldy #>$0184 - lda #<$0184 - jsr p8b_main.p8s_fail_word - bra label_asm_484_afterif -label_asm_485_else - ; source: test_word_gt.p8:3916 success++ - inc p8b_main.p8v_success -label_asm_484_afterif - ; source: test_word_gt.p8:3918 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gt.p8:3920 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gt.p8:3922 goto skip15a - bra p8l_skip15a - ; source: test_word_gt.p8:3923 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3924 skip15a: -p8l_skip15a - ; source: test_word_gt.p8:3926 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3927 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3929 goto skip15b - bra p8l_skip15b - ; source: test_word_gt.p8:3930 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3931 skip15b: -p8l_skip15b - ; source: test_word_gt.p8:3933 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_486_afterif - ; source: test_word_gt.p8:3934 success++ - inc p8b_main.p8v_success -label_asm_486_afterif - ; source: test_word_gt.p8:3937 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_488_else - ; source: test_word_gt.p8:3938 success++ - inc p8b_main.p8v_success - bra label_asm_487_afterif -label_asm_488_else - ; source: test_word_gt.p8:3940 cx16.r0L++ - inc cx16.r0L -label_asm_487_afterif - ; source: test_word_gt.p8:3943 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gt.p8:3945 goto skip16a - bra p8l_skip16a - ; source: test_word_gt.p8:3946 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3947 skip16a: -p8l_skip16a - ; source: test_word_gt.p8:3949 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3950 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3952 goto skip16b - bra p8l_skip16b - ; source: test_word_gt.p8:3953 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:3954 skip16b: -p8l_skip16b - ; source: test_word_gt.p8:3956 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_489_afterif - ; source: test_word_gt.p8:3957 success++ - inc p8b_main.p8v_success -label_asm_489_afterif - ; source: test_word_gt.p8:3960 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_491_else - ; source: test_word_gt.p8:3961 success++ - inc p8b_main.p8v_success - bra label_asm_490_afterif -label_asm_491_else - ; source: test_word_gt.p8:3963 cx16.r0L++ - inc cx16.r0L -label_asm_490_afterif - ; source: test_word_gt.p8:3966 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_gt.p8:3968 goto skip17a - bra p8l_skip17a - ; source: test_word_gt.p8:3969 lbl17a: fail_word(389) -p8l_lbl17a - ldy #>$0185 - lda #<$0185 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3970 skip17a: -p8l_skip17a - ; source: test_word_gt.p8:3972 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3973 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3975 goto skip17b - bra p8l_skip17b - ; source: test_word_gt.p8:3976 lbl17b: fail_word(390) -p8l_lbl17b - ldy #>$0186 - lda #<$0186 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3977 skip17b: -p8l_skip17b - ; source: test_word_gt.p8:3979 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_492_afterif - ; source: test_word_gt.p8:3980 fail_word(391) - ldy #>$0187 - lda #<$0187 - jsr p8b_main.p8s_fail_word -label_asm_492_afterif - ; source: test_word_gt.p8:3983 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_494_else - ; source: test_word_gt.p8:3984 fail_word(392) - ldy #>$0188 - lda #<$0188 - jsr p8b_main.p8s_fail_word - bra label_asm_493_afterif -label_asm_494_else - ; source: test_word_gt.p8:3986 success++ - inc p8b_main.p8v_success -label_asm_493_afterif - ; source: test_word_gt.p8:3989 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gt.p8:3991 goto skip18a - bra p8l_skip18a - ; source: test_word_gt.p8:3992 lbl18a: fail_word(393) -p8l_lbl18a - ldy #>$0189 - lda #<$0189 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:3993 skip18a: -p8l_skip18a - ; source: test_word_gt.p8:3995 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:3996 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:3998 goto skip18b - bra p8l_skip18b - ; source: test_word_gt.p8:3999 lbl18b: fail_word(394) -p8l_lbl18b - ldy #>$018a - lda #<$018a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4000 skip18b: -p8l_skip18b - ; source: test_word_gt.p8:4002 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_495_afterif - ; source: test_word_gt.p8:4003 fail_word(395) - ldy #>$018b - lda #<$018b - jsr p8b_main.p8s_fail_word -label_asm_495_afterif - ; source: test_word_gt.p8:4006 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_497_else - ; source: test_word_gt.p8:4007 fail_word(396) - ldy #>$018c - lda #<$018c - jsr p8b_main.p8s_fail_word - bra label_asm_496_afterif -label_asm_497_else - ; source: test_word_gt.p8:4009 success++ - inc p8b_main.p8v_success -label_asm_496_afterif - ; source: test_word_gt.p8:4012 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gt.p8:4014 goto skip19a - bra p8l_skip19a - ; source: test_word_gt.p8:4015 lbl19a: fail_word(397) -p8l_lbl19a - ldy #>$018d - lda #<$018d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4016 skip19a: -p8l_skip19a - ; source: test_word_gt.p8:4018 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4019 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4021 goto skip19b - bra p8l_skip19b - ; source: test_word_gt.p8:4022 lbl19b: fail_word(398) -p8l_lbl19b - ldy #>$018e - lda #<$018e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4023 skip19b: -p8l_skip19b - ; source: test_word_gt.p8:4025 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_498_afterif - ; source: test_word_gt.p8:4026 fail_word(399) - ldy #>$018f - lda #<$018f - jsr p8b_main.p8s_fail_word -label_asm_498_afterif - ; source: test_word_gt.p8:4029 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_500_else - ; source: test_word_gt.p8:4030 fail_word(400) - ldy #>$0190 - lda #<$0190 - jsr p8b_main.p8s_fail_word - bra label_asm_499_afterif -label_asm_500_else - ; source: test_word_gt.p8:4032 success++ - inc p8b_main.p8v_success -label_asm_499_afterif - ; source: test_word_gt.p8:4035 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gt.p8:4037 goto skip20a - bra p8l_skip20a - ; source: test_word_gt.p8:4038 lbl20a: fail_word(401) -p8l_lbl20a - ldy #>$0191 - lda #<$0191 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4039 skip20a: -p8l_skip20a - ; source: test_word_gt.p8:4041 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4042 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4044 goto skip20b - bra p8l_skip20b - ; source: test_word_gt.p8:4045 lbl20b: fail_word(402) -p8l_lbl20b - ldy #>$0192 - lda #<$0192 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4046 skip20b: -p8l_skip20b - ; source: test_word_gt.p8:4048 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_501_afterif - ; source: test_word_gt.p8:4049 fail_word(403) - ldy #>$0193 - lda #<$0193 - jsr p8b_main.p8s_fail_word -label_asm_501_afterif - ; source: test_word_gt.p8:4052 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_503_else - ; source: test_word_gt.p8:4053 fail_word(404) - ldy #>$0194 - lda #<$0194 - jsr p8b_main.p8s_fail_word - bra label_asm_502_afterif -label_asm_503_else - ; source: test_word_gt.p8:4055 success++ - inc p8b_main.p8v_success -label_asm_502_afterif - ; source: test_word_gt.p8:4058 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gt.p8:4060 goto skip21a - bra p8l_skip21a - ; source: test_word_gt.p8:4061 lbl21a: fail_word(405) -p8l_lbl21a - ldy #>$0195 - lda #<$0195 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4062 skip21a: -p8l_skip21a - ; source: test_word_gt.p8:4064 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4065 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4067 goto skip21b - bra p8l_skip21b - ; source: test_word_gt.p8:4068 lbl21b: fail_word(406) -p8l_lbl21b - ldy #>$0196 - lda #<$0196 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4069 skip21b: -p8l_skip21b - ; source: test_word_gt.p8:4071 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_504_afterif - ; source: test_word_gt.p8:4072 fail_word(407) - ldy #>$0197 - lda #<$0197 - jsr p8b_main.p8s_fail_word -label_asm_504_afterif - ; source: test_word_gt.p8:4075 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_506_else - ; source: test_word_gt.p8:4076 fail_word(408) - ldy #>$0198 - lda #<$0198 - jsr p8b_main.p8s_fail_word - bra label_asm_505_afterif -label_asm_506_else - ; source: test_word_gt.p8:4078 success++ - inc p8b_main.p8v_success -label_asm_505_afterif - ; source: test_word_gt.p8:4080 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:4082 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gt.p8:4084 goto skip22a - bra p8l_skip22a - ; source: test_word_gt.p8:4085 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4086 skip22a: -p8l_skip22a - ; source: test_word_gt.p8:4088 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4089 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4091 goto skip22b - bra p8l_skip22b - ; source: test_word_gt.p8:4092 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4093 skip22b: -p8l_skip22b - ; source: test_word_gt.p8:4095 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_507_afterif - ; source: test_word_gt.p8:4096 success++ - inc p8b_main.p8v_success -label_asm_507_afterif - ; source: test_word_gt.p8:4099 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_509_else - ; source: test_word_gt.p8:4100 success++ - inc p8b_main.p8v_success - bra label_asm_508_afterif -label_asm_509_else - ; source: test_word_gt.p8:4102 cx16.r0L++ - inc cx16.r0L -label_asm_508_afterif - ; source: test_word_gt.p8:4105 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gt.p8:4107 goto skip23a - bra p8l_skip23a - ; source: test_word_gt.p8:4108 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4109 skip23a: -p8l_skip23a - ; source: test_word_gt.p8:4111 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4112 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4114 goto skip23b - bra p8l_skip23b - ; source: test_word_gt.p8:4115 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4116 skip23b: -p8l_skip23b - ; source: test_word_gt.p8:4118 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_510_afterif - ; source: test_word_gt.p8:4119 success++ - inc p8b_main.p8v_success -label_asm_510_afterif - ; source: test_word_gt.p8:4122 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_512_else - ; source: test_word_gt.p8:4123 success++ - inc p8b_main.p8v_success - bra label_asm_511_afterif -label_asm_512_else - ; source: test_word_gt.p8:4125 cx16.r0L++ - inc cx16.r0L -label_asm_511_afterif - ; source: test_word_gt.p8:4128 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_gt.p8:4130 goto skip24a - bra p8l_skip24a - ; source: test_word_gt.p8:4131 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4132 skip24a: -p8l_skip24a - ; source: test_word_gt.p8:4134 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4135 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4137 goto skip24b - bra p8l_skip24b - ; source: test_word_gt.p8:4138 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4139 skip24b: -p8l_skip24b - ; source: test_word_gt.p8:4141 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_513_afterif - ; source: test_word_gt.p8:4142 success++ - inc p8b_main.p8v_success -label_asm_513_afterif - ; source: test_word_gt.p8:4145 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_515_else - ; source: test_word_gt.p8:4146 success++ - inc p8b_main.p8v_success - bra label_asm_514_afterif -label_asm_515_else - ; source: test_word_gt.p8:4148 cx16.r0L++ - inc cx16.r0L -label_asm_514_afterif - ; source: test_word_gt.p8:4151 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gt.p8:4153 goto skip25a - bra p8l_skip25a - ; source: test_word_gt.p8:4154 lbl25a: fail_word(409) -p8l_lbl25a - ldy #>$0199 - lda #<$0199 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4155 skip25a: -p8l_skip25a - ; source: test_word_gt.p8:4157 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4158 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4160 goto skip25b - bra p8l_skip25b - ; source: test_word_gt.p8:4161 lbl25b: fail_word(410) -p8l_lbl25b - ldy #>$019a - lda #<$019a - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4162 skip25b: -p8l_skip25b - ; source: test_word_gt.p8:4164 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_516_afterif - ; source: test_word_gt.p8:4165 fail_word(411) - ldy #>$019b - lda #<$019b - jsr p8b_main.p8s_fail_word -label_asm_516_afterif - ; source: test_word_gt.p8:4168 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_518_else - ; source: test_word_gt.p8:4169 fail_word(412) - ldy #>$019c - lda #<$019c - jsr p8b_main.p8s_fail_word - bra label_asm_517_afterif -label_asm_518_else - ; source: test_word_gt.p8:4171 success++ - inc p8b_main.p8v_success -label_asm_517_afterif - ; source: test_word_gt.p8:4174 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gt.p8:4176 goto skip26a - bra p8l_skip26a - ; source: test_word_gt.p8:4177 lbl26a: fail_word(413) -p8l_lbl26a - ldy #>$019d - lda #<$019d - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4178 skip26a: -p8l_skip26a - ; source: test_word_gt.p8:4180 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4181 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4183 goto skip26b - bra p8l_skip26b - ; source: test_word_gt.p8:4184 lbl26b: fail_word(414) -p8l_lbl26b - ldy #>$019e - lda #<$019e - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4185 skip26b: -p8l_skip26b - ; source: test_word_gt.p8:4187 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_519_afterif - ; source: test_word_gt.p8:4188 fail_word(415) - ldy #>$019f - lda #<$019f - jsr p8b_main.p8s_fail_word -label_asm_519_afterif - ; source: test_word_gt.p8:4191 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_521_else - ; source: test_word_gt.p8:4192 fail_word(416) - ldy #>$01a0 - lda #<$01a0 - jsr p8b_main.p8s_fail_word - bra label_asm_520_afterif -label_asm_521_else - ; source: test_word_gt.p8:4194 success++ - inc p8b_main.p8v_success -label_asm_520_afterif - ; source: test_word_gt.p8:4197 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gt.p8:4199 goto skip27a - bra p8l_skip27a - ; source: test_word_gt.p8:4200 lbl27a: fail_word(417) -p8l_lbl27a - ldy #>$01a1 - lda #<$01a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4201 skip27a: -p8l_skip27a - ; source: test_word_gt.p8:4203 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4204 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4206 goto skip27b - bra p8l_skip27b - ; source: test_word_gt.p8:4207 lbl27b: fail_word(418) -p8l_lbl27b - ldy #>$01a2 - lda #<$01a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4208 skip27b: -p8l_skip27b - ; source: test_word_gt.p8:4210 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_522_afterif - ; source: test_word_gt.p8:4211 fail_word(419) - ldy #>$01a3 - lda #<$01a3 - jsr p8b_main.p8s_fail_word -label_asm_522_afterif - ; source: test_word_gt.p8:4214 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_524_else - ; source: test_word_gt.p8:4215 fail_word(420) - ldy #>$01a4 - lda #<$01a4 - jsr p8b_main.p8s_fail_word - bra label_asm_523_afterif -label_asm_524_else - ; source: test_word_gt.p8:4217 success++ - inc p8b_main.p8v_success -label_asm_523_afterif - ; source: test_word_gt.p8:4220 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gt.p8:4222 goto skip28a - bra p8l_skip28a - ; source: test_word_gt.p8:4223 lbl28a: fail_word(421) -p8l_lbl28a - ldy #>$01a5 - lda #<$01a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4224 skip28a: -p8l_skip28a - ; source: test_word_gt.p8:4226 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4227 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4229 goto skip28b - bra p8l_skip28b - ; source: test_word_gt.p8:4230 lbl28b: fail_word(422) -p8l_lbl28b - ldy #>$01a6 - lda #<$01a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4231 skip28b: -p8l_skip28b - ; source: test_word_gt.p8:4233 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_525_afterif - ; source: test_word_gt.p8:4234 fail_word(423) - ldy #>$01a7 - lda #<$01a7 - jsr p8b_main.p8s_fail_word -label_asm_525_afterif - ; source: test_word_gt.p8:4237 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_527_else - ; source: test_word_gt.p8:4238 fail_word(424) - ldy #>$01a8 - lda #<$01a8 - jsr p8b_main.p8s_fail_word - bra label_asm_526_afterif -label_asm_527_else - ; source: test_word_gt.p8:4240 success++ - inc p8b_main.p8v_success -label_asm_526_afterif - ; source: test_word_gt.p8:4242 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:4244 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gt.p8:4246 goto skip29a - bra p8l_skip29a - ; source: test_word_gt.p8:4247 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4248 skip29a: -p8l_skip29a - ; source: test_word_gt.p8:4250 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4251 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4253 goto skip29b - bra p8l_skip29b - ; source: test_word_gt.p8:4254 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4255 skip29b: -p8l_skip29b - ; source: test_word_gt.p8:4257 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_528_afterif - ; source: test_word_gt.p8:4258 success++ - inc p8b_main.p8v_success -label_asm_528_afterif - ; source: test_word_gt.p8:4261 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_530_else - ; source: test_word_gt.p8:4262 success++ - inc p8b_main.p8v_success - bra label_asm_529_afterif -label_asm_530_else - ; source: test_word_gt.p8:4264 cx16.r0L++ - inc cx16.r0L -label_asm_529_afterif - ; source: test_word_gt.p8:4267 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gt.p8:4269 goto skip30a - bra p8l_skip30a - ; source: test_word_gt.p8:4270 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4271 skip30a: -p8l_skip30a - ; source: test_word_gt.p8:4273 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4274 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4276 goto skip30b - bra p8l_skip30b - ; source: test_word_gt.p8:4277 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4278 skip30b: -p8l_skip30b - ; source: test_word_gt.p8:4280 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_531_afterif - ; source: test_word_gt.p8:4281 success++ - inc p8b_main.p8v_success -label_asm_531_afterif - ; source: test_word_gt.p8:4284 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_533_else - ; source: test_word_gt.p8:4285 success++ - inc p8b_main.p8v_success - bra label_asm_532_afterif -label_asm_533_else - ; source: test_word_gt.p8:4287 cx16.r0L++ - inc cx16.r0L -label_asm_532_afterif - ; source: test_word_gt.p8:4290 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_gt.p8:4292 goto skip31a - bra p8l_skip31a - ; source: test_word_gt.p8:4293 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4294 skip31a: -p8l_skip31a - ; source: test_word_gt.p8:4296 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4297 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4299 goto skip31b - bra p8l_skip31b - ; source: test_word_gt.p8:4300 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4301 skip31b: -p8l_skip31b - ; source: test_word_gt.p8:4303 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_534_afterif - ; source: test_word_gt.p8:4304 success++ - inc p8b_main.p8v_success -label_asm_534_afterif - ; source: test_word_gt.p8:4307 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_536_else - ; source: test_word_gt.p8:4308 success++ - inc p8b_main.p8v_success - bra label_asm_535_afterif -label_asm_536_else - ; source: test_word_gt.p8:4310 cx16.r0L++ - inc cx16.r0L -label_asm_535_afterif - ; source: test_word_gt.p8:4313 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gt.p8:4315 goto skip32a - bra p8l_skip32a - ; source: test_word_gt.p8:4316 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4317 skip32a: -p8l_skip32a - ; source: test_word_gt.p8:4319 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4320 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4322 goto skip32b - bra p8l_skip32b - ; source: test_word_gt.p8:4323 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4324 skip32b: -p8l_skip32b - ; source: test_word_gt.p8:4326 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_537_afterif - ; source: test_word_gt.p8:4327 success++ - inc p8b_main.p8v_success -label_asm_537_afterif - ; source: test_word_gt.p8:4330 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_539_else - ; source: test_word_gt.p8:4331 success++ - inc p8b_main.p8v_success - bra label_asm_538_afterif -label_asm_539_else - ; source: test_word_gt.p8:4333 cx16.r0L++ - inc cx16.r0L -label_asm_538_afterif - ; source: test_word_gt.p8:4336 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gt.p8:4338 goto skip33a - bra p8l_skip33a - ; source: test_word_gt.p8:4339 lbl33a: fail_word(425) -p8l_lbl33a - ldy #>$01a9 - lda #<$01a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4340 skip33a: -p8l_skip33a - ; source: test_word_gt.p8:4342 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4343 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4345 goto skip33b - bra p8l_skip33b - ; source: test_word_gt.p8:4346 lbl33b: fail_word(426) -p8l_lbl33b - ldy #>$01aa - lda #<$01aa - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4347 skip33b: -p8l_skip33b - ; source: test_word_gt.p8:4349 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_540_afterif - ; source: test_word_gt.p8:4350 fail_word(427) - ldy #>$01ab - lda #<$01ab - jsr p8b_main.p8s_fail_word -label_asm_540_afterif - ; source: test_word_gt.p8:4353 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_542_else - ; source: test_word_gt.p8:4354 fail_word(428) - ldy #>$01ac - lda #<$01ac - jsr p8b_main.p8s_fail_word - bra label_asm_541_afterif -label_asm_542_else - ; source: test_word_gt.p8:4356 success++ - inc p8b_main.p8v_success -label_asm_541_afterif - ; source: test_word_gt.p8:4359 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gt.p8:4361 goto skip34a - bra p8l_skip34a - ; source: test_word_gt.p8:4362 lbl34a: fail_word(429) -p8l_lbl34a - ldy #>$01ad - lda #<$01ad - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4363 skip34a: -p8l_skip34a - ; source: test_word_gt.p8:4365 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4366 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4368 goto skip34b - bra p8l_skip34b - ; source: test_word_gt.p8:4369 lbl34b: fail_word(430) -p8l_lbl34b - ldy #>$01ae - lda #<$01ae - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4370 skip34b: -p8l_skip34b - ; source: test_word_gt.p8:4372 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_543_afterif - ; source: test_word_gt.p8:4373 fail_word(431) - ldy #>$01af - lda #<$01af - jsr p8b_main.p8s_fail_word -label_asm_543_afterif - ; source: test_word_gt.p8:4376 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_545_else - ; source: test_word_gt.p8:4377 fail_word(432) - ldy #>$01b0 - lda #<$01b0 - jsr p8b_main.p8s_fail_word - bra label_asm_544_afterif -label_asm_545_else - ; source: test_word_gt.p8:4379 success++ - inc p8b_main.p8v_success -label_asm_544_afterif - ; source: test_word_gt.p8:4382 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gt.p8:4384 goto skip35a - bra p8l_skip35a - ; source: test_word_gt.p8:4385 lbl35a: fail_word(433) -p8l_lbl35a - ldy #>$01b1 - lda #<$01b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4386 skip35a: -p8l_skip35a - ; source: test_word_gt.p8:4388 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4389 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4391 goto skip35b - bra p8l_skip35b - ; source: test_word_gt.p8:4392 lbl35b: fail_word(434) -p8l_lbl35b - ldy #>$01b2 - lda #<$01b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4393 skip35b: -p8l_skip35b - ; source: test_word_gt.p8:4395 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_546_afterif - ; source: test_word_gt.p8:4396 fail_word(435) - ldy #>$01b3 - lda #<$01b3 - jsr p8b_main.p8s_fail_word -label_asm_546_afterif - ; source: test_word_gt.p8:4399 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_548_else - ; source: test_word_gt.p8:4400 fail_word(436) - ldy #>$01b4 - lda #<$01b4 - jsr p8b_main.p8s_fail_word - bra label_asm_547_afterif -label_asm_548_else - ; source: test_word_gt.p8:4402 success++ - inc p8b_main.p8v_success -label_asm_547_afterif - ; source: test_word_gt.p8:4404 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:4406 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gt.p8:4408 goto skip36a - bra p8l_skip36a - ; source: test_word_gt.p8:4409 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4410 skip36a: -p8l_skip36a - ; source: test_word_gt.p8:4412 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4413 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4415 goto skip36b - bra p8l_skip36b - ; source: test_word_gt.p8:4416 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4417 skip36b: -p8l_skip36b - ; source: test_word_gt.p8:4419 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_549_afterif - ; source: test_word_gt.p8:4420 success++ - inc p8b_main.p8v_success -label_asm_549_afterif - ; source: test_word_gt.p8:4423 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_551_else - ; source: test_word_gt.p8:4424 success++ - inc p8b_main.p8v_success - bra label_asm_550_afterif -label_asm_551_else - ; source: test_word_gt.p8:4426 cx16.r0L++ - inc cx16.r0L -label_asm_550_afterif - ; source: test_word_gt.p8:4429 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gt.p8:4431 goto skip37a - bra p8l_skip37a - ; source: test_word_gt.p8:4432 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4433 skip37a: -p8l_skip37a - ; source: test_word_gt.p8:4435 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4436 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4438 goto skip37b - bra p8l_skip37b - ; source: test_word_gt.p8:4439 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4440 skip37b: -p8l_skip37b - ; source: test_word_gt.p8:4442 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_552_afterif - ; source: test_word_gt.p8:4443 success++ - inc p8b_main.p8v_success -label_asm_552_afterif - ; source: test_word_gt.p8:4446 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_554_else - ; source: test_word_gt.p8:4447 success++ - inc p8b_main.p8v_success - bra label_asm_553_afterif -label_asm_554_else - ; source: test_word_gt.p8:4449 cx16.r0L++ - inc cx16.r0L -label_asm_553_afterif - ; source: test_word_gt.p8:4452 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_gt.p8:4454 goto skip38a - bra p8l_skip38a - ; source: test_word_gt.p8:4455 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4456 skip38a: -p8l_skip38a - ; source: test_word_gt.p8:4458 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4459 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4461 goto skip38b - bra p8l_skip38b - ; source: test_word_gt.p8:4462 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4463 skip38b: -p8l_skip38b - ; source: test_word_gt.p8:4465 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_555_afterif - ; source: test_word_gt.p8:4466 success++ - inc p8b_main.p8v_success -label_asm_555_afterif - ; source: test_word_gt.p8:4469 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_557_else - ; source: test_word_gt.p8:4470 success++ - inc p8b_main.p8v_success - bra label_asm_556_afterif -label_asm_557_else - ; source: test_word_gt.p8:4472 cx16.r0L++ - inc cx16.r0L -label_asm_556_afterif - ; source: test_word_gt.p8:4475 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gt.p8:4477 goto skip39a - bra p8l_skip39a - ; source: test_word_gt.p8:4478 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4479 skip39a: -p8l_skip39a - ; source: test_word_gt.p8:4481 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4482 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4484 goto skip39b - bra p8l_skip39b - ; source: test_word_gt.p8:4485 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4486 skip39b: -p8l_skip39b - ; source: test_word_gt.p8:4488 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_558_afterif - ; source: test_word_gt.p8:4489 success++ - inc p8b_main.p8v_success -label_asm_558_afterif - ; source: test_word_gt.p8:4492 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_560_else - ; source: test_word_gt.p8:4493 success++ - inc p8b_main.p8v_success - bra label_asm_559_afterif -label_asm_560_else - ; source: test_word_gt.p8:4495 cx16.r0L++ - inc cx16.r0L -label_asm_559_afterif - ; source: test_word_gt.p8:4498 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gt.p8:4500 goto skip40a - bra p8l_skip40a - ; source: test_word_gt.p8:4501 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4502 skip40a: -p8l_skip40a - ; source: test_word_gt.p8:4504 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4505 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4507 goto skip40b - bra p8l_skip40b - ; source: test_word_gt.p8:4508 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4509 skip40b: -p8l_skip40b - ; source: test_word_gt.p8:4511 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_561_afterif - ; source: test_word_gt.p8:4512 success++ - inc p8b_main.p8v_success -label_asm_561_afterif - ; source: test_word_gt.p8:4515 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_563_else - ; source: test_word_gt.p8:4516 success++ - inc p8b_main.p8v_success - bra label_asm_562_afterif -label_asm_563_else - ; source: test_word_gt.p8:4518 cx16.r0L++ - inc cx16.r0L -label_asm_562_afterif - ; source: test_word_gt.p8:4521 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gt.p8:4523 goto skip41a - bra p8l_skip41a - ; source: test_word_gt.p8:4524 lbl41a: fail_word(437) -p8l_lbl41a - ldy #>$01b5 - lda #<$01b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4525 skip41a: -p8l_skip41a - ; source: test_word_gt.p8:4527 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4528 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4530 goto skip41b - bra p8l_skip41b - ; source: test_word_gt.p8:4531 lbl41b: fail_word(438) -p8l_lbl41b - ldy #>$01b6 - lda #<$01b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4532 skip41b: -p8l_skip41b - ; source: test_word_gt.p8:4534 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_564_afterif - ; source: test_word_gt.p8:4535 fail_word(439) - ldy #>$01b7 - lda #<$01b7 - jsr p8b_main.p8s_fail_word -label_asm_564_afterif - ; source: test_word_gt.p8:4538 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_566_else - ; source: test_word_gt.p8:4539 fail_word(440) - ldy #>$01b8 - lda #<$01b8 - jsr p8b_main.p8s_fail_word - bra label_asm_565_afterif -label_asm_566_else - ; source: test_word_gt.p8:4541 success++ - inc p8b_main.p8v_success -label_asm_565_afterif - ; source: test_word_gt.p8:4544 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gt.p8:4546 goto skip42a - bra p8l_skip42a - ; source: test_word_gt.p8:4547 lbl42a: fail_word(441) -p8l_lbl42a - ldy #>$01b9 - lda #<$01b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4548 skip42a: -p8l_skip42a - ; source: test_word_gt.p8:4550 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4551 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4553 goto skip42b - bra p8l_skip42b - ; source: test_word_gt.p8:4554 lbl42b: fail_word(442) -p8l_lbl42b - ldy #>$01ba - lda #<$01ba - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4555 skip42b: -p8l_skip42b - ; source: test_word_gt.p8:4557 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_567_afterif - ; source: test_word_gt.p8:4558 fail_word(443) - ldy #>$01bb - lda #<$01bb - jsr p8b_main.p8s_fail_word -label_asm_567_afterif - ; source: test_word_gt.p8:4561 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_569_else - ; source: test_word_gt.p8:4562 fail_word(444) - ldy #>$01bc - lda #<$01bc - jsr p8b_main.p8s_fail_word - bra label_asm_568_afterif -label_asm_569_else - ; source: test_word_gt.p8:4564 success++ - inc p8b_main.p8v_success -label_asm_568_afterif - ; source: test_word_gt.p8:4566 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gt.p8:4568 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gt.p8:4570 goto skip43a - bra p8l_skip43a - ; source: test_word_gt.p8:4571 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4572 skip43a: -p8l_skip43a - ; source: test_word_gt.p8:4574 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4575 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4577 goto skip43b - bra p8l_skip43b - ; source: test_word_gt.p8:4578 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4579 skip43b: -p8l_skip43b - ; source: test_word_gt.p8:4581 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_570_afterif - ; source: test_word_gt.p8:4582 success++ - inc p8b_main.p8v_success -label_asm_570_afterif - ; source: test_word_gt.p8:4585 if x>cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_572_else - ; source: test_word_gt.p8:4586 success++ - inc p8b_main.p8v_success - bra label_asm_571_afterif -label_asm_572_else - ; source: test_word_gt.p8:4588 cx16.r0L++ - inc cx16.r0L -label_asm_571_afterif - ; source: test_word_gt.p8:4591 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gt.p8:4593 goto skip44a - bra p8l_skip44a - ; source: test_word_gt.p8:4594 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4595 skip44a: -p8l_skip44a - ; source: test_word_gt.p8:4597 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4598 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4600 goto skip44b - bra p8l_skip44b - ; source: test_word_gt.p8:4601 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4602 skip44b: -p8l_skip44b - ; source: test_word_gt.p8:4604 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_573_afterif - ; source: test_word_gt.p8:4605 success++ - inc p8b_main.p8v_success -label_asm_573_afterif - ; source: test_word_gt.p8:4608 if x>cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_575_else - ; source: test_word_gt.p8:4609 success++ - inc p8b_main.p8v_success - bra label_asm_574_afterif -label_asm_575_else - ; source: test_word_gt.p8:4611 cx16.r0L++ - inc cx16.r0L -label_asm_574_afterif - ; source: test_word_gt.p8:4614 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_gt.p8:4616 goto skip45a - bra p8l_skip45a - ; source: test_word_gt.p8:4617 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4618 skip45a: -p8l_skip45a - ; source: test_word_gt.p8:4620 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4621 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4623 goto skip45b - bra p8l_skip45b - ; source: test_word_gt.p8:4624 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4625 skip45b: -p8l_skip45b - ; source: test_word_gt.p8:4627 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_576_afterif - ; source: test_word_gt.p8:4628 success++ - inc p8b_main.p8v_success -label_asm_576_afterif - ; source: test_word_gt.p8:4631 if x>cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_578_else - ; source: test_word_gt.p8:4632 success++ - inc p8b_main.p8v_success - bra label_asm_577_afterif -label_asm_578_else - ; source: test_word_gt.p8:4634 cx16.r0L++ - inc cx16.r0L -label_asm_577_afterif - ; source: test_word_gt.p8:4637 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gt.p8:4639 goto skip46a - bra p8l_skip46a - ; source: test_word_gt.p8:4640 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4641 skip46a: -p8l_skip46a - ; source: test_word_gt.p8:4643 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4644 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4646 goto skip46b - bra p8l_skip46b - ; source: test_word_gt.p8:4647 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4648 skip46b: -p8l_skip46b - ; source: test_word_gt.p8:4650 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_579_afterif - ; source: test_word_gt.p8:4651 success++ - inc p8b_main.p8v_success -label_asm_579_afterif - ; source: test_word_gt.p8:4654 if x>cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_581_else - ; source: test_word_gt.p8:4655 success++ - inc p8b_main.p8v_success - bra label_asm_580_afterif -label_asm_581_else - ; source: test_word_gt.p8:4657 cx16.r0L++ - inc cx16.r0L -label_asm_580_afterif - ; source: test_word_gt.p8:4660 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gt.p8:4662 goto skip47a - bra p8l_skip47a - ; source: test_word_gt.p8:4663 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4664 skip47a: -p8l_skip47a - ; source: test_word_gt.p8:4666 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4667 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4669 goto skip47b - bra p8l_skip47b - ; source: test_word_gt.p8:4670 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4671 skip47b: -p8l_skip47b - ; source: test_word_gt.p8:4673 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_582_afterif - ; source: test_word_gt.p8:4674 success++ - inc p8b_main.p8v_success -label_asm_582_afterif - ; source: test_word_gt.p8:4677 if x>cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_584_else - ; source: test_word_gt.p8:4678 success++ - inc p8b_main.p8v_success - bra label_asm_583_afterif -label_asm_584_else - ; source: test_word_gt.p8:4680 cx16.r0L++ - inc cx16.r0L -label_asm_583_afterif - ; source: test_word_gt.p8:4683 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gt.p8:4685 goto skip48a - bra p8l_skip48a - ; source: test_word_gt.p8:4686 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4687 skip48a: -p8l_skip48a - ; source: test_word_gt.p8:4689 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4690 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4692 goto skip48b - bra p8l_skip48b - ; source: test_word_gt.p8:4693 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gt.p8:4694 skip48b: -p8l_skip48b - ; source: test_word_gt.p8:4696 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_585_afterif - ; source: test_word_gt.p8:4697 success++ - inc p8b_main.p8v_success -label_asm_585_afterif - ; source: test_word_gt.p8:4700 if x>cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_587_else - ; source: test_word_gt.p8:4701 success++ - inc p8b_main.p8v_success - bra label_asm_586_afterif -label_asm_587_else - ; source: test_word_gt.p8:4703 cx16.r0L++ - inc cx16.r0L -label_asm_586_afterif - ; source: test_word_gt.p8:4706 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gt.p8:4708 goto skip49a - bra p8l_skip49a - ; source: test_word_gt.p8:4709 lbl49a: fail_word(445) -p8l_lbl49a - ldy #>$01bd - lda #<$01bd - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4710 skip49a: -p8l_skip49a - ; source: test_word_gt.p8:4712 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gt.p8:4713 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gt.p8:4715 goto skip49b - bra p8l_skip49b - ; source: test_word_gt.p8:4716 lbl49b: fail_word(446) -p8l_lbl49b - ldy #>$01be - lda #<$01be - jsr p8b_main.p8s_fail_word - ; source: test_word_gt.p8:4717 skip49b: -p8l_skip49b - ; source: test_word_gt.p8:4719 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_588_afterif - ; source: test_word_gt.p8:4720 fail_word(447) - ldy #>$01bf - lda #<$01bf - jsr p8b_main.p8s_fail_word -label_asm_588_afterif - ; source: test_word_gt.p8:4723 if x>cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_590_else - ; source: test_word_gt.p8:4724 fail_word(448) - ldy #>$01c0 - lda #<$01c0 - jsr p8b_main.p8s_fail_word - bra label_asm_589_afterif -label_asm_590_else - ; source: test_word_gt.p8:4726 success++ - inc p8b_main.p8v_success -label_asm_589_afterif - ; source: test_word_gt.p8:4728 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_gt.p8:3587 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .sint ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>number: " - .byte $0d, $3e, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>var: " - .byte $0d, $3e, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>expr: " - .byte $0d, $3e, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_word_gt.p8:14 txt.print("\ngreater-than tests for: ") - ; source: test_word_gt.p8:18 txt.print("\n>number: ") - ; source: test_word_gt.p8:20 txt.print("\n>var: ") - ; source: test_word_gt.p8:22 txt.print("\n>array[]: ") - ; source: test_word_gt.p8:24 txt.print("\n>expr: ") - ; source: test_word_gt.p8:33 txt.print(" **failed** ") - ; source: test_word_gt.p8:35 txt.print(" success, expected ") - ; source: test_word_gt.p8:41 txt.print(" **fail#") - ; source: test_word_gt.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_gt.p8 b/compiler/test/comparisons/test_word_gt.p8 deleted file mode 100644 index 9f22eebca..000000000 --- a/compiler/test/comparisons/test_word_gt.p8 +++ /dev/null @@ -1,4732 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>number: ") - test_cmp_number() - txt.print("\n>var: ") - test_cmp_var() - txt.print("\n>array[]: ") - test_cmp_array() - txt.print("\n>expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - word @shared x - success = 0 - x=-21829 - ; direct jump - if x>-21829 - goto lbl1a - goto skip1a -lbl1a: fail_word(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>-21829 - goto cx16.r3 - goto skip1b -lbl1b: fail_word(2) -skip1b: - ; no else - if x>-21829 - fail_word(3) - - ; with else - if x>-21829 - fail_word(4) - else - success++ - - ; direct jump - if x>-1 - goto lbl2a - goto skip2a -lbl2a: fail_word(5) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>-1 - goto cx16.r3 - goto skip2b -lbl2b: fail_word(6) -skip2b: - ; no else - if x>-1 - fail_word(7) - - ; with else - if x>-1 - fail_word(8) - else - success++ - - ; direct jump - if x>0 - goto lbl3a - goto skip3a -lbl3a: fail_word(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>0 - goto cx16.r3 - goto skip3b -lbl3b: fail_word(10) -skip3b: - ; no else - if x>0 - fail_word(11) - - ; with else - if x>0 - fail_word(12) - else - success++ - - ; direct jump - if x>1 - goto lbl4a - goto skip4a -lbl4a: fail_word(13) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>1 - goto cx16.r3 - goto skip4b -lbl4b: fail_word(14) -skip4b: - ; no else - if x>1 - fail_word(15) - - ; with else - if x>1 - fail_word(16) - else - success++ - - ; direct jump - if x>170 - goto lbl5a - goto skip5a -lbl5a: fail_word(17) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>170 - goto cx16.r3 - goto skip5b -lbl5b: fail_word(18) -skip5b: - ; no else - if x>170 - fail_word(19) - - ; with else - if x>170 - fail_word(20) - else - success++ - - ; direct jump - if x>30464 - goto lbl6a - goto skip6a -lbl6a: fail_word(21) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>30464 - goto cx16.r3 - goto skip6b -lbl6b: fail_word(22) -skip6b: - ; no else - if x>30464 - fail_word(23) - - ; with else - if x>30464 - fail_word(24) - else - success++ - - ; direct jump - if x>32767 - goto lbl7a - goto skip7a -lbl7a: fail_word(25) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>32767 - goto cx16.r3 - goto skip7b -lbl7b: fail_word(26) -skip7b: - ; no else - if x>32767 - fail_word(27) - - ; with else - if x>32767 - fail_word(28) - else - success++ - - x=-1 - ; direct jump - if x>-21829 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>-21829 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>-21829 - success++ - - ; with else - if x>-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>-1 - goto lbl9a - goto skip9a -lbl9a: fail_word(29) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>-1 - goto cx16.r3 - goto skip9b -lbl9b: fail_word(30) -skip9b: - ; no else - if x>-1 - fail_word(31) - - ; with else - if x>-1 - fail_word(32) - else - success++ - - ; direct jump - if x>0 - goto lbl10a - goto skip10a -lbl10a: fail_word(33) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>0 - goto cx16.r3 - goto skip10b -lbl10b: fail_word(34) -skip10b: - ; no else - if x>0 - fail_word(35) - - ; with else - if x>0 - fail_word(36) - else - success++ - - ; direct jump - if x>1 - goto lbl11a - goto skip11a -lbl11a: fail_word(37) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>1 - goto cx16.r3 - goto skip11b -lbl11b: fail_word(38) -skip11b: - ; no else - if x>1 - fail_word(39) - - ; with else - if x>1 - fail_word(40) - else - success++ - - ; direct jump - if x>170 - goto lbl12a - goto skip12a -lbl12a: fail_word(41) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>170 - goto cx16.r3 - goto skip12b -lbl12b: fail_word(42) -skip12b: - ; no else - if x>170 - fail_word(43) - - ; with else - if x>170 - fail_word(44) - else - success++ - - ; direct jump - if x>30464 - goto lbl13a - goto skip13a -lbl13a: fail_word(45) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>30464 - goto cx16.r3 - goto skip13b -lbl13b: fail_word(46) -skip13b: - ; no else - if x>30464 - fail_word(47) - - ; with else - if x>30464 - fail_word(48) - else - success++ - - ; direct jump - if x>32767 - goto lbl14a - goto skip14a -lbl14a: fail_word(49) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>32767 - goto cx16.r3 - goto skip14b -lbl14b: fail_word(50) -skip14b: - ; no else - if x>32767 - fail_word(51) - - ; with else - if x>32767 - fail_word(52) - else - success++ - - x=0 - ; direct jump - if x>-21829 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>-21829 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>-21829 - success++ - - ; with else - if x>-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>-1 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>-1 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl17a - goto skip17a -lbl17a: fail_word(53) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>0 - goto cx16.r3 - goto skip17b -lbl17b: fail_word(54) -skip17b: - ; no else - if x>0 - fail_word(55) - - ; with else - if x>0 - fail_word(56) - else - success++ - - ; direct jump - if x>1 - goto lbl18a - goto skip18a -lbl18a: fail_word(57) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>1 - goto cx16.r3 - goto skip18b -lbl18b: fail_word(58) -skip18b: - ; no else - if x>1 - fail_word(59) - - ; with else - if x>1 - fail_word(60) - else - success++ - - ; direct jump - if x>170 - goto lbl19a - goto skip19a -lbl19a: fail_word(61) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>170 - goto cx16.r3 - goto skip19b -lbl19b: fail_word(62) -skip19b: - ; no else - if x>170 - fail_word(63) - - ; with else - if x>170 - fail_word(64) - else - success++ - - ; direct jump - if x>30464 - goto lbl20a - goto skip20a -lbl20a: fail_word(65) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>30464 - goto cx16.r3 - goto skip20b -lbl20b: fail_word(66) -skip20b: - ; no else - if x>30464 - fail_word(67) - - ; with else - if x>30464 - fail_word(68) - else - success++ - - ; direct jump - if x>32767 - goto lbl21a - goto skip21a -lbl21a: fail_word(69) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>32767 - goto cx16.r3 - goto skip21b -lbl21b: fail_word(70) -skip21b: - ; no else - if x>32767 - fail_word(71) - - ; with else - if x>32767 - fail_word(72) - else - success++ - - x=1 - ; direct jump - if x>-21829 - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>-21829 - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>-21829 - success++ - - ; with else - if x>-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>-1 - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>-1 - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>0 - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl25a - goto skip25a -lbl25a: fail_word(73) -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>1 - goto cx16.r3 - goto skip25b -lbl25b: fail_word(74) -skip25b: - ; no else - if x>1 - fail_word(75) - - ; with else - if x>1 - fail_word(76) - else - success++ - - ; direct jump - if x>170 - goto lbl26a - goto skip26a -lbl26a: fail_word(77) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>170 - goto cx16.r3 - goto skip26b -lbl26b: fail_word(78) -skip26b: - ; no else - if x>170 - fail_word(79) - - ; with else - if x>170 - fail_word(80) - else - success++ - - ; direct jump - if x>30464 - goto lbl27a - goto skip27a -lbl27a: fail_word(81) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>30464 - goto cx16.r3 - goto skip27b -lbl27b: fail_word(82) -skip27b: - ; no else - if x>30464 - fail_word(83) - - ; with else - if x>30464 - fail_word(84) - else - success++ - - ; direct jump - if x>32767 - goto lbl28a - goto skip28a -lbl28a: fail_word(85) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>32767 - goto cx16.r3 - goto skip28b -lbl28b: fail_word(86) -skip28b: - ; no else - if x>32767 - fail_word(87) - - ; with else - if x>32767 - fail_word(88) - else - success++ - - x=170 - ; direct jump - if x>-21829 - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>-21829 - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>-21829 - success++ - - ; with else - if x>-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>-1 - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>-1 - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>0 - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>1 - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>1 - success++ - - ; with else - if x>1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>170 - goto lbl33a - goto skip33a -lbl33a: fail_word(89) -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>170 - goto cx16.r3 - goto skip33b -lbl33b: fail_word(90) -skip33b: - ; no else - if x>170 - fail_word(91) - - ; with else - if x>170 - fail_word(92) - else - success++ - - ; direct jump - if x>30464 - goto lbl34a - goto skip34a -lbl34a: fail_word(93) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>30464 - goto cx16.r3 - goto skip34b -lbl34b: fail_word(94) -skip34b: - ; no else - if x>30464 - fail_word(95) - - ; with else - if x>30464 - fail_word(96) - else - success++ - - ; direct jump - if x>32767 - goto lbl35a - goto skip35a -lbl35a: fail_word(97) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>32767 - goto cx16.r3 - goto skip35b -lbl35b: fail_word(98) -skip35b: - ; no else - if x>32767 - fail_word(99) - - ; with else - if x>32767 - fail_word(100) - else - success++ - - x=30464 - ; direct jump - if x>-21829 - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>-21829 - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>-21829 - success++ - - ; with else - if x>-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>-1 - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>-1 - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>0 - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>1 - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>1 - success++ - - ; with else - if x>1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>170 - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>170 - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>170 - success++ - - ; with else - if x>170 - success++ - else - cx16.r0L++ - - ; direct jump - if x>30464 - goto lbl41a - goto skip41a -lbl41a: fail_word(101) -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>30464 - goto cx16.r3 - goto skip41b -lbl41b: fail_word(102) -skip41b: - ; no else - if x>30464 - fail_word(103) - - ; with else - if x>30464 - fail_word(104) - else - success++ - - ; direct jump - if x>32767 - goto lbl42a - goto skip42a -lbl42a: fail_word(105) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>32767 - goto cx16.r3 - goto skip42b -lbl42b: fail_word(106) -skip42b: - ; no else - if x>32767 - fail_word(107) - - ; with else - if x>32767 - fail_word(108) - else - success++ - - x=32767 - ; direct jump - if x>-21829 - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>-21829 - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>-21829 - success++ - - ; with else - if x>-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>-1 - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>-1 - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>-1 - success++ - - ; with else - if x>-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>0 - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>0 - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>0 - success++ - - ; with else - if x>0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>1 - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>1 - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>1 - success++ - - ; with else - if x>1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>170 - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>170 - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>170 - success++ - - ; with else - if x>170 - success++ - else - cx16.r0L++ - - ; direct jump - if x>30464 - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>30464 - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>30464 - success++ - - ; with else - if x>30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x>32767 - goto lbl49a - goto skip49a -lbl49a: fail_word(109) -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>32767 - goto cx16.r3 - goto skip49b -lbl49b: fail_word(110) -skip49b: - ; no else - if x>32767 - fail_word(111) - - ; with else - if x>32767 - fail_word(112) - else - success++ - - verify_success(112) -} - sub test_cmp_var() { - word @shared x, value - success = 0 - x=-21829 - value=-21829 - ; direct jump - if x>value - goto lbl1a - goto skip1a -lbl1a: fail_word(113) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>value - goto cx16.r3 - goto skip1b -lbl1b: fail_word(114) -skip1b: - ; no else - if x>value - fail_word(115) - - ; with else - if x>value - fail_word(116) - else - success++ - - value=-1 - ; direct jump - if x>value - goto lbl2a - goto skip2a -lbl2a: fail_word(117) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>value - goto cx16.r3 - goto skip2b -lbl2b: fail_word(118) -skip2b: - ; no else - if x>value - fail_word(119) - - ; with else - if x>value - fail_word(120) - else - success++ - - value=0 - ; direct jump - if x>value - goto lbl3a - goto skip3a -lbl3a: fail_word(121) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>value - goto cx16.r3 - goto skip3b -lbl3b: fail_word(122) -skip3b: - ; no else - if x>value - fail_word(123) - - ; with else - if x>value - fail_word(124) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl4a - goto skip4a -lbl4a: fail_word(125) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>value - goto cx16.r3 - goto skip4b -lbl4b: fail_word(126) -skip4b: - ; no else - if x>value - fail_word(127) - - ; with else - if x>value - fail_word(128) - else - success++ - - value=170 - ; direct jump - if x>value - goto lbl5a - goto skip5a -lbl5a: fail_word(129) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>value - goto cx16.r3 - goto skip5b -lbl5b: fail_word(130) -skip5b: - ; no else - if x>value - fail_word(131) - - ; with else - if x>value - fail_word(132) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl6a - goto skip6a -lbl6a: fail_word(133) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>value - goto cx16.r3 - goto skip6b -lbl6b: fail_word(134) -skip6b: - ; no else - if x>value - fail_word(135) - - ; with else - if x>value - fail_word(136) - else - success++ - - value=32767 - ; direct jump - if x>value - goto lbl7a - goto skip7a -lbl7a: fail_word(137) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>value - goto cx16.r3 - goto skip7b -lbl7b: fail_word(138) -skip7b: - ; no else - if x>value - fail_word(139) - - ; with else - if x>value - fail_word(140) - else - success++ - - x=-1 - value=-21829 - ; direct jump - if x>value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>value - goto lbl9a - goto skip9a -lbl9a: fail_word(141) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>value - goto cx16.r3 - goto skip9b -lbl9b: fail_word(142) -skip9b: - ; no else - if x>value - fail_word(143) - - ; with else - if x>value - fail_word(144) - else - success++ - - value=0 - ; direct jump - if x>value - goto lbl10a - goto skip10a -lbl10a: fail_word(145) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>value - goto cx16.r3 - goto skip10b -lbl10b: fail_word(146) -skip10b: - ; no else - if x>value - fail_word(147) - - ; with else - if x>value - fail_word(148) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl11a - goto skip11a -lbl11a: fail_word(149) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>value - goto cx16.r3 - goto skip11b -lbl11b: fail_word(150) -skip11b: - ; no else - if x>value - fail_word(151) - - ; with else - if x>value - fail_word(152) - else - success++ - - value=170 - ; direct jump - if x>value - goto lbl12a - goto skip12a -lbl12a: fail_word(153) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>value - goto cx16.r3 - goto skip12b -lbl12b: fail_word(154) -skip12b: - ; no else - if x>value - fail_word(155) - - ; with else - if x>value - fail_word(156) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl13a - goto skip13a -lbl13a: fail_word(157) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>value - goto cx16.r3 - goto skip13b -lbl13b: fail_word(158) -skip13b: - ; no else - if x>value - fail_word(159) - - ; with else - if x>value - fail_word(160) - else - success++ - - value=32767 - ; direct jump - if x>value - goto lbl14a - goto skip14a -lbl14a: fail_word(161) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>value - goto cx16.r3 - goto skip14b -lbl14b: fail_word(162) -skip14b: - ; no else - if x>value - fail_word(163) - - ; with else - if x>value - fail_word(164) - else - success++ - - x=0 - value=-21829 - ; direct jump - if x>value - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>value - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>value - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>value - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl17a - goto skip17a -lbl17a: fail_word(165) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>value - goto cx16.r3 - goto skip17b -lbl17b: fail_word(166) -skip17b: - ; no else - if x>value - fail_word(167) - - ; with else - if x>value - fail_word(168) - else - success++ - - value=1 - ; direct jump - if x>value - goto lbl18a - goto skip18a -lbl18a: fail_word(169) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>value - goto cx16.r3 - goto skip18b -lbl18b: fail_word(170) -skip18b: - ; no else - if x>value - fail_word(171) - - ; with else - if x>value - fail_word(172) - else - success++ - - value=170 - ; direct jump - if x>value - goto lbl19a - goto skip19a -lbl19a: fail_word(173) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>value - goto cx16.r3 - goto skip19b -lbl19b: fail_word(174) -skip19b: - ; no else - if x>value - fail_word(175) - - ; with else - if x>value - fail_word(176) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl20a - goto skip20a -lbl20a: fail_word(177) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>value - goto cx16.r3 - goto skip20b -lbl20b: fail_word(178) -skip20b: - ; no else - if x>value - fail_word(179) - - ; with else - if x>value - fail_word(180) - else - success++ - - value=32767 - ; direct jump - if x>value - goto lbl21a - goto skip21a -lbl21a: fail_word(181) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>value - goto cx16.r3 - goto skip21b -lbl21b: fail_word(182) -skip21b: - ; no else - if x>value - fail_word(183) - - ; with else - if x>value - fail_word(184) - else - success++ - - x=1 - value=-21829 - ; direct jump - if x>value - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>value - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>value - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>value - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>value - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl25a - goto skip25a -lbl25a: fail_word(185) -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>value - goto cx16.r3 - goto skip25b -lbl25b: fail_word(186) -skip25b: - ; no else - if x>value - fail_word(187) - - ; with else - if x>value - fail_word(188) - else - success++ - - value=170 - ; direct jump - if x>value - goto lbl26a - goto skip26a -lbl26a: fail_word(189) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>value - goto cx16.r3 - goto skip26b -lbl26b: fail_word(190) -skip26b: - ; no else - if x>value - fail_word(191) - - ; with else - if x>value - fail_word(192) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl27a - goto skip27a -lbl27a: fail_word(193) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>value - goto cx16.r3 - goto skip27b -lbl27b: fail_word(194) -skip27b: - ; no else - if x>value - fail_word(195) - - ; with else - if x>value - fail_word(196) - else - success++ - - value=32767 - ; direct jump - if x>value - goto lbl28a - goto skip28a -lbl28a: fail_word(197) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>value - goto cx16.r3 - goto skip28b -lbl28b: fail_word(198) -skip28b: - ; no else - if x>value - fail_word(199) - - ; with else - if x>value - fail_word(200) - else - success++ - - x=170 - value=-21829 - ; direct jump - if x>value - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>value - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>value - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>value - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>value - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>value - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>value - goto lbl33a - goto skip33a -lbl33a: fail_word(201) -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>value - goto cx16.r3 - goto skip33b -lbl33b: fail_word(202) -skip33b: - ; no else - if x>value - fail_word(203) - - ; with else - if x>value - fail_word(204) - else - success++ - - value=30464 - ; direct jump - if x>value - goto lbl34a - goto skip34a -lbl34a: fail_word(205) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>value - goto cx16.r3 - goto skip34b -lbl34b: fail_word(206) -skip34b: - ; no else - if x>value - fail_word(207) - - ; with else - if x>value - fail_word(208) - else - success++ - - value=32767 - ; direct jump - if x>value - goto lbl35a - goto skip35a -lbl35a: fail_word(209) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>value - goto cx16.r3 - goto skip35b -lbl35b: fail_word(210) -skip35b: - ; no else - if x>value - fail_word(211) - - ; with else - if x>value - fail_word(212) - else - success++ - - x=30464 - value=-21829 - ; direct jump - if x>value - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>value - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>value - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>value - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>value - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>value - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>value - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>value - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>value - goto lbl41a - goto skip41a -lbl41a: fail_word(213) -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>value - goto cx16.r3 - goto skip41b -lbl41b: fail_word(214) -skip41b: - ; no else - if x>value - fail_word(215) - - ; with else - if x>value - fail_word(216) - else - success++ - - value=32767 - ; direct jump - if x>value - goto lbl42a - goto skip42a -lbl42a: fail_word(217) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>value - goto cx16.r3 - goto skip42b -lbl42b: fail_word(218) -skip42b: - ; no else - if x>value - fail_word(219) - - ; with else - if x>value - fail_word(220) - else - success++ - - x=32767 - value=-21829 - ; direct jump - if x>value - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>value - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>value - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>value - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>value - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>value - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>value - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>value - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>value - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>value - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>value - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>value - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>value - success++ - - ; with else - if x>value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x>value - goto lbl49a - goto skip49a -lbl49a: fail_word(221) -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>value - goto cx16.r3 - goto skip49b -lbl49b: fail_word(222) -skip49b: - ; no else - if x>value - fail_word(223) - - ; with else - if x>value - fail_word(224) - else - success++ - - verify_success(112) -} - sub test_cmp_array() { - word @shared x - word[] values = [0, 0] - success = 0 - x=-21829 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_word(225) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_word(226) -skip1b: - ; no else - if x>values[1] - fail_word(227) - - ; with else - if x>values[1] - fail_word(228) - else - success++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(229) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(230) -skip2b: - ; no else - if x>values[1] - fail_word(231) - - ; with else - if x>values[1] - fail_word(232) - else - success++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(233) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(234) -skip3b: - ; no else - if x>values[1] - fail_word(235) - - ; with else - if x>values[1] - fail_word(236) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(237) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(238) -skip4b: - ; no else - if x>values[1] - fail_word(239) - - ; with else - if x>values[1] - fail_word(240) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(241) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(242) -skip5b: - ; no else - if x>values[1] - fail_word(243) - - ; with else - if x>values[1] - fail_word(244) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(245) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(246) -skip6b: - ; no else - if x>values[1] - fail_word(247) - - ; with else - if x>values[1] - fail_word(248) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(249) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(250) -skip7b: - ; no else - if x>values[1] - fail_word(251) - - ; with else - if x>values[1] - fail_word(252) - else - success++ - - x=-1 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl9a - goto skip9a -lbl9a: fail_word(253) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_word(254) -skip9b: - ; no else - if x>values[1] - fail_word(255) - - ; with else - if x>values[1] - fail_word(256) - else - success++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(257) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(258) -skip10b: - ; no else - if x>values[1] - fail_word(259) - - ; with else - if x>values[1] - fail_word(260) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(261) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(262) -skip11b: - ; no else - if x>values[1] - fail_word(263) - - ; with else - if x>values[1] - fail_word(264) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(265) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(266) -skip12b: - ; no else - if x>values[1] - fail_word(267) - - ; with else - if x>values[1] - fail_word(268) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(269) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(270) -skip13b: - ; no else - if x>values[1] - fail_word(271) - - ; with else - if x>values[1] - fail_word(272) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(273) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(274) -skip14b: - ; no else - if x>values[1] - fail_word(275) - - ; with else - if x>values[1] - fail_word(276) - else - success++ - - x=0 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl17a - goto skip17a -lbl17a: fail_word(277) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>values[1] - goto cx16.r3 - goto skip17b -lbl17b: fail_word(278) -skip17b: - ; no else - if x>values[1] - fail_word(279) - - ; with else - if x>values[1] - fail_word(280) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(281) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(282) -skip18b: - ; no else - if x>values[1] - fail_word(283) - - ; with else - if x>values[1] - fail_word(284) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(285) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(286) -skip19b: - ; no else - if x>values[1] - fail_word(287) - - ; with else - if x>values[1] - fail_word(288) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(289) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(290) -skip20b: - ; no else - if x>values[1] - fail_word(291) - - ; with else - if x>values[1] - fail_word(292) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl21a - goto skip21a -lbl21a: fail_word(293) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>values[1] - goto cx16.r3 - goto skip21b -lbl21b: fail_word(294) -skip21b: - ; no else - if x>values[1] - fail_word(295) - - ; with else - if x>values[1] - fail_word(296) - else - success++ - - x=1 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>values[1] - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>values[1] - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>values[1] - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl25a - goto skip25a -lbl25a: fail_word(297) -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>values[1] - goto cx16.r3 - goto skip25b -lbl25b: fail_word(298) -skip25b: - ; no else - if x>values[1] - fail_word(299) - - ; with else - if x>values[1] - fail_word(300) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl26a - goto skip26a -lbl26a: fail_word(301) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>values[1] - goto cx16.r3 - goto skip26b -lbl26b: fail_word(302) -skip26b: - ; no else - if x>values[1] - fail_word(303) - - ; with else - if x>values[1] - fail_word(304) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl27a - goto skip27a -lbl27a: fail_word(305) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>values[1] - goto cx16.r3 - goto skip27b -lbl27b: fail_word(306) -skip27b: - ; no else - if x>values[1] - fail_word(307) - - ; with else - if x>values[1] - fail_word(308) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl28a - goto skip28a -lbl28a: fail_word(309) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>values[1] - goto cx16.r3 - goto skip28b -lbl28b: fail_word(310) -skip28b: - ; no else - if x>values[1] - fail_word(311) - - ; with else - if x>values[1] - fail_word(312) - else - success++ - - x=170 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>values[1] - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>values[1] - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>values[1] - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>values[1] - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl33a - goto skip33a -lbl33a: fail_word(313) -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>values[1] - goto cx16.r3 - goto skip33b -lbl33b: fail_word(314) -skip33b: - ; no else - if x>values[1] - fail_word(315) - - ; with else - if x>values[1] - fail_word(316) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl34a - goto skip34a -lbl34a: fail_word(317) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>values[1] - goto cx16.r3 - goto skip34b -lbl34b: fail_word(318) -skip34b: - ; no else - if x>values[1] - fail_word(319) - - ; with else - if x>values[1] - fail_word(320) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl35a - goto skip35a -lbl35a: fail_word(321) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>values[1] - goto cx16.r3 - goto skip35b -lbl35b: fail_word(322) -skip35b: - ; no else - if x>values[1] - fail_word(323) - - ; with else - if x>values[1] - fail_word(324) - else - success++ - - x=30464 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>values[1] - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>values[1] - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>values[1] - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>values[1] - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>values[1] - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl41a - goto skip41a -lbl41a: fail_word(325) -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>values[1] - goto cx16.r3 - goto skip41b -lbl41b: fail_word(326) -skip41b: - ; no else - if x>values[1] - fail_word(327) - - ; with else - if x>values[1] - fail_word(328) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl42a - goto skip42a -lbl42a: fail_word(329) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>values[1] - goto cx16.r3 - goto skip42b -lbl42b: fail_word(330) -skip42b: - ; no else - if x>values[1] - fail_word(331) - - ; with else - if x>values[1] - fail_word(332) - else - success++ - - x=32767 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>values[1] - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>values[1] - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>values[1] - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>values[1] - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>values[1] - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>values[1] - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl49a - goto skip49a -lbl49a: fail_word(333) -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>values[1] - goto cx16.r3 - goto skip49b -lbl49b: fail_word(334) -skip49b: - ; no else - if x>values[1] - fail_word(335) - - ; with else - if x>values[1] - fail_word(336) - else - success++ - - verify_success(112) -} - sub test_cmp_expr() { - word @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-21829 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: fail_word(337) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: fail_word(338) -skip1b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - fail_word(339) - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - fail_word(340) - else - success++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: fail_word(341) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: fail_word(342) -skip2b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - fail_word(343) - - ; with else - if x>cx16.r4s+-1-cx16.r5s - fail_word(344) - else - success++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: fail_word(345) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: fail_word(346) -skip3b: - ; no else - if x>cx16.r4s+0-cx16.r5s - fail_word(347) - - ; with else - if x>cx16.r4s+0-cx16.r5s - fail_word(348) - else - success++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: fail_word(349) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: fail_word(350) -skip4b: - ; no else - if x>cx16.r4s+1-cx16.r5s - fail_word(351) - - ; with else - if x>cx16.r4s+1-cx16.r5s - fail_word(352) - else - success++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: fail_word(353) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: fail_word(354) -skip5b: - ; no else - if x>cx16.r4s+170-cx16.r5s - fail_word(355) - - ; with else - if x>cx16.r4s+170-cx16.r5s - fail_word(356) - else - success++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: fail_word(357) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: fail_word(358) -skip6b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - fail_word(359) - - ; with else - if x>cx16.r4s+30464-cx16.r5s - fail_word(360) - else - success++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: fail_word(361) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: fail_word(362) -skip7b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(363) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(364) - else - success++ - - x=-1 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: fail_word(365) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: fail_word(366) -skip9b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - fail_word(367) - - ; with else - if x>cx16.r4s+-1-cx16.r5s - fail_word(368) - else - success++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: fail_word(369) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: fail_word(370) -skip10b: - ; no else - if x>cx16.r4s+0-cx16.r5s - fail_word(371) - - ; with else - if x>cx16.r4s+0-cx16.r5s - fail_word(372) - else - success++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: fail_word(373) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: fail_word(374) -skip11b: - ; no else - if x>cx16.r4s+1-cx16.r5s - fail_word(375) - - ; with else - if x>cx16.r4s+1-cx16.r5s - fail_word(376) - else - success++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: fail_word(377) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: fail_word(378) -skip12b: - ; no else - if x>cx16.r4s+170-cx16.r5s - fail_word(379) - - ; with else - if x>cx16.r4s+170-cx16.r5s - fail_word(380) - else - success++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: fail_word(381) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: fail_word(382) -skip13b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - fail_word(383) - - ; with else - if x>cx16.r4s+30464-cx16.r5s - fail_word(384) - else - success++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: fail_word(385) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: fail_word(386) -skip14b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(387) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(388) - else - success++ - - x=0 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: fail_word(389) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: fail_word(390) -skip17b: - ; no else - if x>cx16.r4s+0-cx16.r5s - fail_word(391) - - ; with else - if x>cx16.r4s+0-cx16.r5s - fail_word(392) - else - success++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: fail_word(393) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: fail_word(394) -skip18b: - ; no else - if x>cx16.r4s+1-cx16.r5s - fail_word(395) - - ; with else - if x>cx16.r4s+1-cx16.r5s - fail_word(396) - else - success++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: fail_word(397) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: fail_word(398) -skip19b: - ; no else - if x>cx16.r4s+170-cx16.r5s - fail_word(399) - - ; with else - if x>cx16.r4s+170-cx16.r5s - fail_word(400) - else - success++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: fail_word(401) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: fail_word(402) -skip20b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - fail_word(403) - - ; with else - if x>cx16.r4s+30464-cx16.r5s - fail_word(404) - else - success++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl21a - goto skip21a -lbl21a: fail_word(405) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip21b -lbl21b: fail_word(406) -skip21b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(407) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(408) - else - success++ - - x=1 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl25a - goto skip25a -lbl25a: fail_word(409) -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip25b -lbl25b: fail_word(410) -skip25b: - ; no else - if x>cx16.r4s+1-cx16.r5s - fail_word(411) - - ; with else - if x>cx16.r4s+1-cx16.r5s - fail_word(412) - else - success++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl26a - goto skip26a -lbl26a: fail_word(413) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip26b -lbl26b: fail_word(414) -skip26b: - ; no else - if x>cx16.r4s+170-cx16.r5s - fail_word(415) - - ; with else - if x>cx16.r4s+170-cx16.r5s - fail_word(416) - else - success++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl27a - goto skip27a -lbl27a: fail_word(417) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip27b -lbl27b: fail_word(418) -skip27b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - fail_word(419) - - ; with else - if x>cx16.r4s+30464-cx16.r5s - fail_word(420) - else - success++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl28a - goto skip28a -lbl28a: fail_word(421) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip28b -lbl28b: fail_word(422) -skip28b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(423) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(424) - else - success++ - - x=170 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl33a - goto skip33a -lbl33a: fail_word(425) -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip33b -lbl33b: fail_word(426) -skip33b: - ; no else - if x>cx16.r4s+170-cx16.r5s - fail_word(427) - - ; with else - if x>cx16.r4s+170-cx16.r5s - fail_word(428) - else - success++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl34a - goto skip34a -lbl34a: fail_word(429) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip34b -lbl34b: fail_word(430) -skip34b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - fail_word(431) - - ; with else - if x>cx16.r4s+30464-cx16.r5s - fail_word(432) - else - success++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl35a - goto skip35a -lbl35a: fail_word(433) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip35b -lbl35b: fail_word(434) -skip35b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(435) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(436) - else - success++ - - x=30464 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl41a - goto skip41a -lbl41a: fail_word(437) -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip41b -lbl41b: fail_word(438) -skip41b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - fail_word(439) - - ; with else - if x>cx16.r4s+30464-cx16.r5s - fail_word(440) - else - success++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl42a - goto skip42a -lbl42a: fail_word(441) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip42b -lbl42b: fail_word(442) -skip42b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(443) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(444) - else - success++ - - x=32767 - ; direct jump - if x>cx16.r4s+-21829-cx16.r5s - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+-1-cx16.r5s - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+0-cx16.r5s - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+1-cx16.r5s - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+170-cx16.r5s - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+30464-cx16.r5s - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x>cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>cx16.r4s+32767-cx16.r5s - goto lbl49a - goto skip49a -lbl49a: fail_word(445) -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip49b -lbl49b: fail_word(446) -skip49b: - ; no else - if x>cx16.r4s+32767-cx16.r5s - fail_word(447) - - ; with else - if x>cx16.r4s+32767-cx16.r5s - fail_word(448) - else - success++ - - verify_success(112) -} - -} - diff --git a/compiler/test/comparisons/test_word_gte.asm b/compiler/test/comparisons/test_word_gte.asm deleted file mode 100644 index a31a6d386..000000000 --- a/compiler/test/comparisons/test_word_gte.asm +++ /dev/null @@ -1,25549 +0,0 @@ -; w65c02 assembly code for 'test_word_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:46 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_gte.p8:9 ubyte success = 0 - ; source: test_word_gte.p8:10 str datatype = "word" - ; source: test_word_gte.p8:11 uword @shared comparison - ; source: test_word_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=number: ") - ldy #>prog8_interned_strings.string_2 - lda #=var: ") - ldy #>prog8_interned_strings.string_3 - lda #=array[]: ") - ldy #>prog8_interned_strings.string_4 - lda #=expr: ") - ldy #>prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:76 if x>=-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gte.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_word_gte.p8:79 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:80 skip1a: -p8l_skip1a - ; source: test_word_gte.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:83 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_word_gte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:87 skip1b: -p8l_skip1b - ; source: test_word_gte.p8:89 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_gte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_word_gte.p8:93 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_gte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_gte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_word_gte.p8:99 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_word_gte.p8:102 lbl2a: fail_word(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:103 skip2a: -p8l_skip2a - ; source: test_word_gte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:106 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_word_gte.p8:109 lbl2b: fail_word(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:110 skip2b: -p8l_skip2b - ; source: test_word_gte.p8:112 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_6_afterif - ; source: test_word_gte.p8:113 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_6_afterif - ; source: test_word_gte.p8:116 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_8_else - ; source: test_word_gte.p8:117 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_gte.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_word_gte.p8:122 if x>=0 - lda p8v_x+1 - bpl p8l_lbl3a - ; source: test_word_gte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_word_gte.p8:125 lbl3a: fail_word(5) -p8l_lbl3a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:126 skip3a: -p8l_skip3a - ; source: test_word_gte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:129 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_word_gte.p8:132 lbl3b: fail_word(6) -p8l_lbl3b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:133 skip3b: -p8l_skip3b - ; source: test_word_gte.p8:135 if x>=0 - lda p8v_x+1 - bmi label_asm_9_afterif - ; source: test_word_gte.p8:136 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_9_afterif - ; source: test_word_gte.p8:139 if x>=0 - lda p8v_x+1 - bmi label_asm_11_else - ; source: test_word_gte.p8:140 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_gte.p8:142 success++ - inc p8b_main.p8v_success -label_asm_10_afterif - ; source: test_word_gte.p8:145 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl4a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl4a -+ - ; source: test_word_gte.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_word_gte.p8:148 lbl4a: fail_word(9) -p8l_lbl4a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:149 skip4a: -p8l_skip4a - ; source: test_word_gte.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:152 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_word_gte.p8:155 lbl4b: fail_word(10) -p8l_lbl4b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:156 skip4b: -p8l_skip4b - ; source: test_word_gte.p8:158 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_12_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_12_afterif -+ - ; source: test_word_gte.p8:159 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_12_afterif - ; source: test_word_gte.p8:162 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_14_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_14_else -+ - ; source: test_word_gte.p8:163 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_gte.p8:165 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_word_gte.p8:168 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gte.p8:170 goto skip5a - bra p8l_skip5a - ; source: test_word_gte.p8:171 lbl5a: fail_word(13) -p8l_lbl5a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:172 skip5a: -p8l_skip5a - ; source: test_word_gte.p8:174 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:175 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:177 goto skip5b - bra p8l_skip5b - ; source: test_word_gte.p8:178 lbl5b: fail_word(14) -p8l_lbl5b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:179 skip5b: -p8l_skip5b - ; source: test_word_gte.p8:181 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_gte.p8:182 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_15_afterif - ; source: test_word_gte.p8:185 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_gte.p8:186 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_gte.p8:188 success++ - inc p8b_main.p8v_success -label_asm_16_afterif - ; source: test_word_gte.p8:191 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gte.p8:193 goto skip6a - bra p8l_skip6a - ; source: test_word_gte.p8:194 lbl6a: fail_word(17) -p8l_lbl6a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:195 skip6a: -p8l_skip6a - ; source: test_word_gte.p8:197 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:198 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:200 goto skip6b - bra p8l_skip6b - ; source: test_word_gte.p8:201 lbl6b: fail_word(18) -p8l_lbl6b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:202 skip6b: -p8l_skip6b - ; source: test_word_gte.p8:204 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_gte.p8:205 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_18_afterif - ; source: test_word_gte.p8:208 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_gte.p8:209 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_gte.p8:211 success++ - inc p8b_main.p8v_success -label_asm_19_afterif - ; source: test_word_gte.p8:214 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gte.p8:216 goto skip7a - bra p8l_skip7a - ; source: test_word_gte.p8:217 lbl7a: fail_word(21) -p8l_lbl7a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:218 skip7a: -p8l_skip7a - ; source: test_word_gte.p8:220 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:221 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:223 goto skip7b - bra p8l_skip7b - ; source: test_word_gte.p8:224 lbl7b: fail_word(22) -p8l_lbl7b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:225 skip7b: -p8l_skip7b - ; source: test_word_gte.p8:227 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_gte.p8:228 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_21_afterif - ; source: test_word_gte.p8:231 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_gte.p8:232 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_gte.p8:234 success++ - inc p8b_main.p8v_success -label_asm_22_afterif - ; source: test_word_gte.p8:236 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:238 if x>=-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gte.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_word_gte.p8:241 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:242 skip8a: -p8l_skip8a - ; source: test_word_gte.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:245 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_word_gte.p8:248 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:249 skip8b: -p8l_skip8b - ; source: test_word_gte.p8:251 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_gte.p8:252 success++ - inc p8b_main.p8v_success -label_asm_24_afterif - ; source: test_word_gte.p8:255 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_gte.p8:256 success++ - inc p8b_main.p8v_success - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_gte.p8:258 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_word_gte.p8:261 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gte.p8:263 goto skip9a - bra p8l_skip9a - ; source: test_word_gte.p8:264 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:265 skip9a: -p8l_skip9a - ; source: test_word_gte.p8:267 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:268 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:270 goto skip9b - bra p8l_skip9b - ; source: test_word_gte.p8:271 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:272 skip9b: -p8l_skip9b - ; source: test_word_gte.p8:274 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_27_afterif - ; source: test_word_gte.p8:275 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_word_gte.p8:278 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_29_else - ; source: test_word_gte.p8:279 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_gte.p8:281 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_word_gte.p8:284 if x>=0 - lda p8v_x+1 - bpl p8l_lbl10a - ; source: test_word_gte.p8:286 goto skip10a - bra p8l_skip10a - ; source: test_word_gte.p8:287 lbl10a: fail_word(25) -p8l_lbl10a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:288 skip10a: -p8l_skip10a - ; source: test_word_gte.p8:290 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:291 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:293 goto skip10b - bra p8l_skip10b - ; source: test_word_gte.p8:294 lbl10b: fail_word(26) -p8l_lbl10b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:295 skip10b: -p8l_skip10b - ; source: test_word_gte.p8:297 if x>=0 - lda p8v_x+1 - bmi label_asm_30_afterif - ; source: test_word_gte.p8:298 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_30_afterif - ; source: test_word_gte.p8:301 if x>=0 - lda p8v_x+1 - bmi label_asm_32_else - ; source: test_word_gte.p8:302 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_gte.p8:304 success++ - inc p8b_main.p8v_success -label_asm_31_afterif - ; source: test_word_gte.p8:307 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl11a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl11a -+ - ; source: test_word_gte.p8:309 goto skip11a - bra p8l_skip11a - ; source: test_word_gte.p8:310 lbl11a: fail_word(29) -p8l_lbl11a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:311 skip11a: -p8l_skip11a - ; source: test_word_gte.p8:313 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:314 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:316 goto skip11b - bra p8l_skip11b - ; source: test_word_gte.p8:317 lbl11b: fail_word(30) -p8l_lbl11b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:318 skip11b: -p8l_skip11b - ; source: test_word_gte.p8:320 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_33_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_33_afterif -+ - ; source: test_word_gte.p8:321 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_33_afterif - ; source: test_word_gte.p8:324 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_35_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_35_else -+ - ; source: test_word_gte.p8:325 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_gte.p8:327 success++ - inc p8b_main.p8v_success -label_asm_34_afterif - ; source: test_word_gte.p8:330 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gte.p8:332 goto skip12a - bra p8l_skip12a - ; source: test_word_gte.p8:333 lbl12a: fail_word(33) -p8l_lbl12a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:334 skip12a: -p8l_skip12a - ; source: test_word_gte.p8:336 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:337 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:339 goto skip12b - bra p8l_skip12b - ; source: test_word_gte.p8:340 lbl12b: fail_word(34) -p8l_lbl12b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:341 skip12b: -p8l_skip12b - ; source: test_word_gte.p8:343 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_gte.p8:344 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_36_afterif - ; source: test_word_gte.p8:347 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_gte.p8:348 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_gte.p8:350 success++ - inc p8b_main.p8v_success -label_asm_37_afterif - ; source: test_word_gte.p8:353 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gte.p8:355 goto skip13a - bra p8l_skip13a - ; source: test_word_gte.p8:356 lbl13a: fail_word(37) -p8l_lbl13a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:357 skip13a: -p8l_skip13a - ; source: test_word_gte.p8:359 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:360 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:362 goto skip13b - bra p8l_skip13b - ; source: test_word_gte.p8:363 lbl13b: fail_word(38) -p8l_lbl13b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:364 skip13b: -p8l_skip13b - ; source: test_word_gte.p8:366 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_gte.p8:367 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_39_afterif - ; source: test_word_gte.p8:370 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_gte.p8:371 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_gte.p8:373 success++ - inc p8b_main.p8v_success -label_asm_40_afterif - ; source: test_word_gte.p8:376 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gte.p8:378 goto skip14a - bra p8l_skip14a - ; source: test_word_gte.p8:379 lbl14a: fail_word(41) -p8l_lbl14a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:380 skip14a: -p8l_skip14a - ; source: test_word_gte.p8:382 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:383 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:385 goto skip14b - bra p8l_skip14b - ; source: test_word_gte.p8:386 lbl14b: fail_word(42) -p8l_lbl14b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:387 skip14b: -p8l_skip14b - ; source: test_word_gte.p8:389 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_gte.p8:390 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_42_afterif - ; source: test_word_gte.p8:393 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_gte.p8:394 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_gte.p8:396 success++ - inc p8b_main.p8v_success -label_asm_43_afterif - ; source: test_word_gte.p8:398 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gte.p8:400 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gte.p8:402 goto skip15a - bra p8l_skip15a - ; source: test_word_gte.p8:403 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:404 skip15a: -p8l_skip15a - ; source: test_word_gte.p8:406 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:407 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:409 goto skip15b - bra p8l_skip15b - ; source: test_word_gte.p8:410 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:411 skip15b: -p8l_skip15b - ; source: test_word_gte.p8:413 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_gte.p8:414 success++ - inc p8b_main.p8v_success -label_asm_45_afterif - ; source: test_word_gte.p8:417 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_gte.p8:418 success++ - inc p8b_main.p8v_success - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_gte.p8:420 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_word_gte.p8:423 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gte.p8:425 goto skip16a - bra p8l_skip16a - ; source: test_word_gte.p8:426 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:427 skip16a: -p8l_skip16a - ; source: test_word_gte.p8:429 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:430 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:432 goto skip16b - bra p8l_skip16b - ; source: test_word_gte.p8:433 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:434 skip16b: -p8l_skip16b - ; source: test_word_gte.p8:436 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_48_afterif - ; source: test_word_gte.p8:437 success++ - inc p8b_main.p8v_success -label_asm_48_afterif - ; source: test_word_gte.p8:440 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_50_else - ; source: test_word_gte.p8:441 success++ - inc p8b_main.p8v_success - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_gte.p8:443 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_word_gte.p8:446 if x>=0 - lda p8v_x+1 - bpl p8l_lbl17a - ; source: test_word_gte.p8:448 goto skip17a - bra p8l_skip17a - ; source: test_word_gte.p8:449 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:450 skip17a: -p8l_skip17a - ; source: test_word_gte.p8:452 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:453 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:455 goto skip17b - bra p8l_skip17b - ; source: test_word_gte.p8:456 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:457 skip17b: -p8l_skip17b - ; source: test_word_gte.p8:459 if x>=0 - lda p8v_x+1 - bmi label_asm_51_afterif - ; source: test_word_gte.p8:460 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_word_gte.p8:463 if x>=0 - lda p8v_x+1 - bmi label_asm_53_else - ; source: test_word_gte.p8:464 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_gte.p8:466 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_word_gte.p8:469 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl18a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl18a -+ - ; source: test_word_gte.p8:471 goto skip18a - bra p8l_skip18a - ; source: test_word_gte.p8:472 lbl18a: fail_word(45) -p8l_lbl18a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:473 skip18a: -p8l_skip18a - ; source: test_word_gte.p8:475 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:476 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:478 goto skip18b - bra p8l_skip18b - ; source: test_word_gte.p8:479 lbl18b: fail_word(46) -p8l_lbl18b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:480 skip18b: -p8l_skip18b - ; source: test_word_gte.p8:482 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_54_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_54_afterif -+ - ; source: test_word_gte.p8:483 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_54_afterif - ; source: test_word_gte.p8:486 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_56_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_56_else -+ - ; source: test_word_gte.p8:487 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_gte.p8:489 success++ - inc p8b_main.p8v_success -label_asm_55_afterif - ; source: test_word_gte.p8:492 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gte.p8:494 goto skip19a - bra p8l_skip19a - ; source: test_word_gte.p8:495 lbl19a: fail_word(49) -p8l_lbl19a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:496 skip19a: -p8l_skip19a - ; source: test_word_gte.p8:498 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:499 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:501 goto skip19b - bra p8l_skip19b - ; source: test_word_gte.p8:502 lbl19b: fail_word(50) -p8l_lbl19b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:503 skip19b: -p8l_skip19b - ; source: test_word_gte.p8:505 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_gte.p8:506 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_57_afterif - ; source: test_word_gte.p8:509 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_gte.p8:510 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_gte.p8:512 success++ - inc p8b_main.p8v_success -label_asm_58_afterif - ; source: test_word_gte.p8:515 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gte.p8:517 goto skip20a - bra p8l_skip20a - ; source: test_word_gte.p8:518 lbl20a: fail_word(53) -p8l_lbl20a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:519 skip20a: -p8l_skip20a - ; source: test_word_gte.p8:521 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:522 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:524 goto skip20b - bra p8l_skip20b - ; source: test_word_gte.p8:525 lbl20b: fail_word(54) -p8l_lbl20b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:526 skip20b: -p8l_skip20b - ; source: test_word_gte.p8:528 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_gte.p8:529 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_60_afterif - ; source: test_word_gte.p8:532 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_gte.p8:533 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_gte.p8:535 success++ - inc p8b_main.p8v_success -label_asm_61_afterif - ; source: test_word_gte.p8:538 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gte.p8:540 goto skip21a - bra p8l_skip21a - ; source: test_word_gte.p8:541 lbl21a: fail_word(57) -p8l_lbl21a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:542 skip21a: -p8l_skip21a - ; source: test_word_gte.p8:544 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:545 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:547 goto skip21b - bra p8l_skip21b - ; source: test_word_gte.p8:548 lbl21b: fail_word(58) -p8l_lbl21b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:549 skip21b: -p8l_skip21b - ; source: test_word_gte.p8:551 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_gte.p8:552 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_63_afterif - ; source: test_word_gte.p8:555 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_gte.p8:556 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_gte.p8:558 success++ - inc p8b_main.p8v_success -label_asm_64_afterif - ; source: test_word_gte.p8:560 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:562 if x>=-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gte.p8:564 goto skip22a - bra p8l_skip22a - ; source: test_word_gte.p8:565 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:566 skip22a: -p8l_skip22a - ; source: test_word_gte.p8:568 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:569 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:571 goto skip22b - bra p8l_skip22b - ; source: test_word_gte.p8:572 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:573 skip22b: -p8l_skip22b - ; source: test_word_gte.p8:575 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_gte.p8:576 success++ - inc p8b_main.p8v_success -label_asm_66_afterif - ; source: test_word_gte.p8:579 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_gte.p8:580 success++ - inc p8b_main.p8v_success - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_gte.p8:582 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_word_gte.p8:585 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gte.p8:587 goto skip23a - bra p8l_skip23a - ; source: test_word_gte.p8:588 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:589 skip23a: -p8l_skip23a - ; source: test_word_gte.p8:591 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:592 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:594 goto skip23b - bra p8l_skip23b - ; source: test_word_gte.p8:595 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:596 skip23b: -p8l_skip23b - ; source: test_word_gte.p8:598 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_69_afterif - ; source: test_word_gte.p8:599 success++ - inc p8b_main.p8v_success -label_asm_69_afterif - ; source: test_word_gte.p8:602 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_71_else - ; source: test_word_gte.p8:603 success++ - inc p8b_main.p8v_success - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_gte.p8:605 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_word_gte.p8:608 if x>=0 - lda p8v_x+1 - bpl p8l_lbl24a - ; source: test_word_gte.p8:610 goto skip24a - bra p8l_skip24a - ; source: test_word_gte.p8:611 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:612 skip24a: -p8l_skip24a - ; source: test_word_gte.p8:614 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:615 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:617 goto skip24b - bra p8l_skip24b - ; source: test_word_gte.p8:618 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:619 skip24b: -p8l_skip24b - ; source: test_word_gte.p8:621 if x>=0 - lda p8v_x+1 - bmi label_asm_72_afterif - ; source: test_word_gte.p8:622 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_word_gte.p8:625 if x>=0 - lda p8v_x+1 - bmi label_asm_74_else - ; source: test_word_gte.p8:626 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_gte.p8:628 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_word_gte.p8:631 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl25a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl25a -+ - ; source: test_word_gte.p8:633 goto skip25a - bra p8l_skip25a - ; source: test_word_gte.p8:634 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:635 skip25a: -p8l_skip25a - ; source: test_word_gte.p8:637 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:638 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:640 goto skip25b - bra p8l_skip25b - ; source: test_word_gte.p8:641 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:642 skip25b: -p8l_skip25b - ; source: test_word_gte.p8:644 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_75_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_75_afterif -+ - ; source: test_word_gte.p8:645 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_word_gte.p8:648 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_77_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_77_else -+ - ; source: test_word_gte.p8:649 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_gte.p8:651 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_word_gte.p8:654 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gte.p8:656 goto skip26a - bra p8l_skip26a - ; source: test_word_gte.p8:657 lbl26a: fail_word(61) -p8l_lbl26a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:658 skip26a: -p8l_skip26a - ; source: test_word_gte.p8:660 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:661 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:663 goto skip26b - bra p8l_skip26b - ; source: test_word_gte.p8:664 lbl26b: fail_word(62) -p8l_lbl26b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:665 skip26b: -p8l_skip26b - ; source: test_word_gte.p8:667 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_gte.p8:668 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_78_afterif - ; source: test_word_gte.p8:671 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_gte.p8:672 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_gte.p8:674 success++ - inc p8b_main.p8v_success -label_asm_79_afterif - ; source: test_word_gte.p8:677 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gte.p8:679 goto skip27a - bra p8l_skip27a - ; source: test_word_gte.p8:680 lbl27a: fail_word(65) -p8l_lbl27a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:681 skip27a: -p8l_skip27a - ; source: test_word_gte.p8:683 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:684 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:686 goto skip27b - bra p8l_skip27b - ; source: test_word_gte.p8:687 lbl27b: fail_word(66) -p8l_lbl27b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:688 skip27b: -p8l_skip27b - ; source: test_word_gte.p8:690 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_gte.p8:691 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_81_afterif - ; source: test_word_gte.p8:694 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_gte.p8:695 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_gte.p8:697 success++ - inc p8b_main.p8v_success -label_asm_82_afterif - ; source: test_word_gte.p8:700 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gte.p8:702 goto skip28a - bra p8l_skip28a - ; source: test_word_gte.p8:703 lbl28a: fail_word(69) -p8l_lbl28a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:704 skip28a: -p8l_skip28a - ; source: test_word_gte.p8:706 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:707 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:709 goto skip28b - bra p8l_skip28b - ; source: test_word_gte.p8:710 lbl28b: fail_word(70) -p8l_lbl28b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:711 skip28b: -p8l_skip28b - ; source: test_word_gte.p8:713 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_gte.p8:714 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_84_afterif - ; source: test_word_gte.p8:717 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_gte.p8:718 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_gte.p8:720 success++ - inc p8b_main.p8v_success -label_asm_85_afterif - ; source: test_word_gte.p8:722 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:724 if x>=-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gte.p8:726 goto skip29a - bra p8l_skip29a - ; source: test_word_gte.p8:727 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:728 skip29a: -p8l_skip29a - ; source: test_word_gte.p8:730 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:731 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:733 goto skip29b - bra p8l_skip29b - ; source: test_word_gte.p8:734 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:735 skip29b: -p8l_skip29b - ; source: test_word_gte.p8:737 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_gte.p8:738 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_word_gte.p8:741 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_gte.p8:742 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_gte.p8:744 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_word_gte.p8:747 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gte.p8:749 goto skip30a - bra p8l_skip30a - ; source: test_word_gte.p8:750 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:751 skip30a: -p8l_skip30a - ; source: test_word_gte.p8:753 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:754 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:756 goto skip30b - bra p8l_skip30b - ; source: test_word_gte.p8:757 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:758 skip30b: -p8l_skip30b - ; source: test_word_gte.p8:760 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_90_afterif - ; source: test_word_gte.p8:761 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_word_gte.p8:764 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_92_else - ; source: test_word_gte.p8:765 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_gte.p8:767 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_word_gte.p8:770 if x>=0 - lda p8v_x+1 - bpl p8l_lbl31a - ; source: test_word_gte.p8:772 goto skip31a - bra p8l_skip31a - ; source: test_word_gte.p8:773 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:774 skip31a: -p8l_skip31a - ; source: test_word_gte.p8:776 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:777 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:779 goto skip31b - bra p8l_skip31b - ; source: test_word_gte.p8:780 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:781 skip31b: -p8l_skip31b - ; source: test_word_gte.p8:783 if x>=0 - lda p8v_x+1 - bmi label_asm_93_afterif - ; source: test_word_gte.p8:784 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_word_gte.p8:787 if x>=0 - lda p8v_x+1 - bmi label_asm_95_else - ; source: test_word_gte.p8:788 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_gte.p8:790 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_word_gte.p8:793 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl32a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl32a -+ - ; source: test_word_gte.p8:795 goto skip32a - bra p8l_skip32a - ; source: test_word_gte.p8:796 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:797 skip32a: -p8l_skip32a - ; source: test_word_gte.p8:799 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:800 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:802 goto skip32b - bra p8l_skip32b - ; source: test_word_gte.p8:803 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:804 skip32b: -p8l_skip32b - ; source: test_word_gte.p8:806 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_96_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_96_afterif -+ - ; source: test_word_gte.p8:807 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_word_gte.p8:810 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_98_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_98_else -+ - ; source: test_word_gte.p8:811 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_gte.p8:813 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_word_gte.p8:816 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gte.p8:818 goto skip33a - bra p8l_skip33a - ; source: test_word_gte.p8:819 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:820 skip33a: -p8l_skip33a - ; source: test_word_gte.p8:822 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:823 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:825 goto skip33b - bra p8l_skip33b - ; source: test_word_gte.p8:826 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:827 skip33b: -p8l_skip33b - ; source: test_word_gte.p8:829 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_gte.p8:830 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_word_gte.p8:833 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_gte.p8:834 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_gte.p8:836 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_word_gte.p8:839 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gte.p8:841 goto skip34a - bra p8l_skip34a - ; source: test_word_gte.p8:842 lbl34a: fail_word(73) -p8l_lbl34a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:843 skip34a: -p8l_skip34a - ; source: test_word_gte.p8:845 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:846 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:848 goto skip34b - bra p8l_skip34b - ; source: test_word_gte.p8:849 lbl34b: fail_word(74) -p8l_lbl34b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:850 skip34b: -p8l_skip34b - ; source: test_word_gte.p8:852 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_gte.p8:853 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_102_afterif - ; source: test_word_gte.p8:856 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_gte.p8:857 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_gte.p8:859 success++ - inc p8b_main.p8v_success -label_asm_103_afterif - ; source: test_word_gte.p8:862 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gte.p8:864 goto skip35a - bra p8l_skip35a - ; source: test_word_gte.p8:865 lbl35a: fail_word(77) -p8l_lbl35a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:866 skip35a: -p8l_skip35a - ; source: test_word_gte.p8:868 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:869 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:871 goto skip35b - bra p8l_skip35b - ; source: test_word_gte.p8:872 lbl35b: fail_word(78) -p8l_lbl35b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:873 skip35b: -p8l_skip35b - ; source: test_word_gte.p8:875 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_gte.p8:876 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_105_afterif - ; source: test_word_gte.p8:879 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_gte.p8:880 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_gte.p8:882 success++ - inc p8b_main.p8v_success -label_asm_106_afterif - ; source: test_word_gte.p8:884 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:886 if x>=-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gte.p8:888 goto skip36a - bra p8l_skip36a - ; source: test_word_gte.p8:889 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:890 skip36a: -p8l_skip36a - ; source: test_word_gte.p8:892 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:893 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:895 goto skip36b - bra p8l_skip36b - ; source: test_word_gte.p8:896 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:897 skip36b: -p8l_skip36b - ; source: test_word_gte.p8:899 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_gte.p8:900 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_word_gte.p8:903 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_gte.p8:904 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_gte.p8:906 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_word_gte.p8:909 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gte.p8:911 goto skip37a - bra p8l_skip37a - ; source: test_word_gte.p8:912 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:913 skip37a: -p8l_skip37a - ; source: test_word_gte.p8:915 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:916 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:918 goto skip37b - bra p8l_skip37b - ; source: test_word_gte.p8:919 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:920 skip37b: -p8l_skip37b - ; source: test_word_gte.p8:922 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_111_afterif - ; source: test_word_gte.p8:923 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_word_gte.p8:926 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_113_else - ; source: test_word_gte.p8:927 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_gte.p8:929 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_word_gte.p8:932 if x>=0 - lda p8v_x+1 - bpl p8l_lbl38a - ; source: test_word_gte.p8:934 goto skip38a - bra p8l_skip38a - ; source: test_word_gte.p8:935 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:936 skip38a: -p8l_skip38a - ; source: test_word_gte.p8:938 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:939 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:941 goto skip38b - bra p8l_skip38b - ; source: test_word_gte.p8:942 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:943 skip38b: -p8l_skip38b - ; source: test_word_gte.p8:945 if x>=0 - lda p8v_x+1 - bmi label_asm_114_afterif - ; source: test_word_gte.p8:946 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_word_gte.p8:949 if x>=0 - lda p8v_x+1 - bmi label_asm_116_else - ; source: test_word_gte.p8:950 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_gte.p8:952 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_word_gte.p8:955 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl39a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl39a -+ - ; source: test_word_gte.p8:957 goto skip39a - bra p8l_skip39a - ; source: test_word_gte.p8:958 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:959 skip39a: -p8l_skip39a - ; source: test_word_gte.p8:961 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:962 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:964 goto skip39b - bra p8l_skip39b - ; source: test_word_gte.p8:965 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:966 skip39b: -p8l_skip39b - ; source: test_word_gte.p8:968 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_117_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_117_afterif -+ - ; source: test_word_gte.p8:969 success++ - inc p8b_main.p8v_success -label_asm_117_afterif - ; source: test_word_gte.p8:972 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_119_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_119_else -+ - ; source: test_word_gte.p8:973 success++ - inc p8b_main.p8v_success - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_gte.p8:975 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_word_gte.p8:978 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gte.p8:980 goto skip40a - bra p8l_skip40a - ; source: test_word_gte.p8:981 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:982 skip40a: -p8l_skip40a - ; source: test_word_gte.p8:984 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:985 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:987 goto skip40b - bra p8l_skip40b - ; source: test_word_gte.p8:988 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:989 skip40b: -p8l_skip40b - ; source: test_word_gte.p8:991 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_gte.p8:992 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_word_gte.p8:995 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_gte.p8:996 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_gte.p8:998 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_word_gte.p8:1001 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gte.p8:1003 goto skip41a - bra p8l_skip41a - ; source: test_word_gte.p8:1004 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1005 skip41a: -p8l_skip41a - ; source: test_word_gte.p8:1007 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1008 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1010 goto skip41b - bra p8l_skip41b - ; source: test_word_gte.p8:1011 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1012 skip41b: -p8l_skip41b - ; source: test_word_gte.p8:1014 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_gte.p8:1015 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_word_gte.p8:1018 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_gte.p8:1019 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_gte.p8:1021 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_word_gte.p8:1024 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gte.p8:1026 goto skip42a - bra p8l_skip42a - ; source: test_word_gte.p8:1027 lbl42a: fail_word(81) -p8l_lbl42a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1028 skip42a: -p8l_skip42a - ; source: test_word_gte.p8:1030 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1031 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1033 goto skip42b - bra p8l_skip42b - ; source: test_word_gte.p8:1034 lbl42b: fail_word(82) -p8l_lbl42b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1035 skip42b: -p8l_skip42b - ; source: test_word_gte.p8:1037 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_gte.p8:1038 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_126_afterif - ; source: test_word_gte.p8:1041 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_gte.p8:1042 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_gte.p8:1044 success++ - inc p8b_main.p8v_success -label_asm_127_afterif - ; source: test_word_gte.p8:1046 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:1048 if x>=-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gte.p8:1050 goto skip43a - bra p8l_skip43a - ; source: test_word_gte.p8:1051 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1052 skip43a: -p8l_skip43a - ; source: test_word_gte.p8:1054 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1055 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1057 goto skip43b - bra p8l_skip43b - ; source: test_word_gte.p8:1058 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1059 skip43b: -p8l_skip43b - ; source: test_word_gte.p8:1061 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_gte.p8:1062 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_word_gte.p8:1065 if x>=-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_gte.p8:1066 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_gte.p8:1068 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_word_gte.p8:1071 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gte.p8:1073 goto skip44a - bra p8l_skip44a - ; source: test_word_gte.p8:1074 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1075 skip44a: -p8l_skip44a - ; source: test_word_gte.p8:1077 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1078 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1080 goto skip44b - bra p8l_skip44b - ; source: test_word_gte.p8:1081 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1082 skip44b: -p8l_skip44b - ; source: test_word_gte.p8:1084 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_132_afterif - ; source: test_word_gte.p8:1085 success++ - inc p8b_main.p8v_success -label_asm_132_afterif - ; source: test_word_gte.p8:1088 if x>=-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi label_asm_134_else - ; source: test_word_gte.p8:1089 success++ - inc p8b_main.p8v_success - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_gte.p8:1091 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_word_gte.p8:1094 if x>=0 - lda p8v_x+1 - bpl p8l_lbl45a - ; source: test_word_gte.p8:1096 goto skip45a - bra p8l_skip45a - ; source: test_word_gte.p8:1097 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1098 skip45a: -p8l_skip45a - ; source: test_word_gte.p8:1100 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1101 if x>=0 - lda p8v_x+1 - bmi + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1103 goto skip45b - bra p8l_skip45b - ; source: test_word_gte.p8:1104 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1105 skip45b: -p8l_skip45b - ; source: test_word_gte.p8:1107 if x>=0 - lda p8v_x+1 - bmi label_asm_135_afterif - ; source: test_word_gte.p8:1108 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_word_gte.p8:1111 if x>=0 - lda p8v_x+1 - bmi label_asm_137_else - ; source: test_word_gte.p8:1112 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_gte.p8:1114 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_word_gte.p8:1117 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne p8l_lbl46a - lda p8b_main.p8s_test_cmp_number.p8v_x - bne p8l_lbl46a -+ - ; source: test_word_gte.p8:1119 goto skip46a - bra p8l_skip46a - ; source: test_word_gte.p8:1120 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1121 skip46a: -p8l_skip46a - ; source: test_word_gte.p8:1123 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1124 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi ++ - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1126 goto skip46b - bra p8l_skip46b - ; source: test_word_gte.p8:1127 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1128 skip46b: -p8l_skip46b - ; source: test_word_gte.p8:1130 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_138_afterif - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_138_afterif -+ - ; source: test_word_gte.p8:1131 success++ - inc p8b_main.p8v_success -label_asm_138_afterif - ; source: test_word_gte.p8:1134 if x>=1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi label_asm_140_else - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq label_asm_140_else -+ - ; source: test_word_gte.p8:1135 success++ - inc p8b_main.p8v_success - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_gte.p8:1137 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_word_gte.p8:1140 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gte.p8:1142 goto skip47a - bra p8l_skip47a - ; source: test_word_gte.p8:1143 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1144 skip47a: -p8l_skip47a - ; source: test_word_gte.p8:1146 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1147 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1149 goto skip47b - bra p8l_skip47b - ; source: test_word_gte.p8:1150 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1151 skip47b: -p8l_skip47b - ; source: test_word_gte.p8:1153 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_gte.p8:1154 success++ - inc p8b_main.p8v_success -label_asm_141_afterif - ; source: test_word_gte.p8:1157 if x>=170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_gte.p8:1158 success++ - inc p8b_main.p8v_success - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_gte.p8:1160 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_word_gte.p8:1163 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gte.p8:1165 goto skip48a - bra p8l_skip48a - ; source: test_word_gte.p8:1166 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1167 skip48a: -p8l_skip48a - ; source: test_word_gte.p8:1169 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1170 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1172 goto skip48b - bra p8l_skip48b - ; source: test_word_gte.p8:1173 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1174 skip48b: -p8l_skip48b - ; source: test_word_gte.p8:1176 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_gte.p8:1177 success++ - inc p8b_main.p8v_success -label_asm_144_afterif - ; source: test_word_gte.p8:1180 if x>=30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_gte.p8:1181 success++ - inc p8b_main.p8v_success - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_gte.p8:1183 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_word_gte.p8:1186 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gte.p8:1188 goto skip49a - bra p8l_skip49a - ; source: test_word_gte.p8:1189 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1190 skip49a: -p8l_skip49a - ; source: test_word_gte.p8:1192 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1193 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1195 goto skip49b - bra p8l_skip49b - ; source: test_word_gte.p8:1196 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1197 skip49b: -p8l_skip49b - ; source: test_word_gte.p8:1199 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_gte.p8:1200 success++ - inc p8b_main.p8v_success -label_asm_147_afterif - ; source: test_word_gte.p8:1203 if x>=32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_gte.p8:1204 success++ - inc p8b_main.p8v_success - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_gte.p8:1206 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_word_gte.p8:1208 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_gte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_gte.p8:1210 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_word_gte.p8:1211 word @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_word_gte.p8:1212 success = 0 - stz p8b_main.p8v_success - ; source: test_word_gte.p8:1213 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:1214 value=-21829 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1216 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gte.p8:1218 goto skip1a - bra p8l_skip1a - ; source: test_word_gte.p8:1219 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1220 skip1a: -p8l_skip1a - ; source: test_word_gte.p8:1222 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1223 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1225 goto skip1b - bra p8l_skip1b - ; source: test_word_gte.p8:1226 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1227 skip1b: -p8l_skip1b - ; source: test_word_gte.p8:1229 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_150_afterif - ; source: test_word_gte.p8:1230 success++ - inc p8b_main.p8v_success -label_asm_150_afterif - ; source: test_word_gte.p8:1233 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_152_else - ; source: test_word_gte.p8:1234 success++ - inc p8b_main.p8v_success - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_gte.p8:1236 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_word_gte.p8:1238 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1240 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gte.p8:1242 goto skip2a - bra p8l_skip2a - ; source: test_word_gte.p8:1243 lbl2a: fail_word(85) -p8l_lbl2a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1244 skip2a: -p8l_skip2a - ; source: test_word_gte.p8:1246 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1247 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1249 goto skip2b - bra p8l_skip2b - ; source: test_word_gte.p8:1250 lbl2b: fail_word(86) -p8l_lbl2b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1251 skip2b: -p8l_skip2b - ; source: test_word_gte.p8:1253 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_153_afterif - ; source: test_word_gte.p8:1254 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_153_afterif - ; source: test_word_gte.p8:1257 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_155_else - ; source: test_word_gte.p8:1258 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_gte.p8:1260 success++ - inc p8b_main.p8v_success -label_asm_154_afterif - ; source: test_word_gte.p8:1262 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:1264 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_gte.p8:1266 goto skip3a - bra p8l_skip3a - ; source: test_word_gte.p8:1267 lbl3a: fail_word(89) -p8l_lbl3a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1268 skip3a: -p8l_skip3a - ; source: test_word_gte.p8:1270 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1271 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1273 goto skip3b - bra p8l_skip3b - ; source: test_word_gte.p8:1274 lbl3b: fail_word(90) -p8l_lbl3b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1275 skip3b: -p8l_skip3b - ; source: test_word_gte.p8:1277 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_156_afterif - ; source: test_word_gte.p8:1278 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_156_afterif - ; source: test_word_gte.p8:1281 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_158_else - ; source: test_word_gte.p8:1282 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_gte.p8:1284 success++ - inc p8b_main.p8v_success -label_asm_157_afterif - ; source: test_word_gte.p8:1286 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1288 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gte.p8:1290 goto skip4a - bra p8l_skip4a - ; source: test_word_gte.p8:1291 lbl4a: fail_word(93) -p8l_lbl4a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1292 skip4a: -p8l_skip4a - ; source: test_word_gte.p8:1294 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1295 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1297 goto skip4b - bra p8l_skip4b - ; source: test_word_gte.p8:1298 lbl4b: fail_word(94) -p8l_lbl4b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1299 skip4b: -p8l_skip4b - ; source: test_word_gte.p8:1301 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_159_afterif - ; source: test_word_gte.p8:1302 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_159_afterif - ; source: test_word_gte.p8:1305 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_161_else - ; source: test_word_gte.p8:1306 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_gte.p8:1308 success++ - inc p8b_main.p8v_success -label_asm_160_afterif - ; source: test_word_gte.p8:1310 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1312 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gte.p8:1314 goto skip5a - bra p8l_skip5a - ; source: test_word_gte.p8:1315 lbl5a: fail_word(97) -p8l_lbl5a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1316 skip5a: -p8l_skip5a - ; source: test_word_gte.p8:1318 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1319 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1321 goto skip5b - bra p8l_skip5b - ; source: test_word_gte.p8:1322 lbl5b: fail_word(98) -p8l_lbl5b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1323 skip5b: -p8l_skip5b - ; source: test_word_gte.p8:1325 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_162_afterif - ; source: test_word_gte.p8:1326 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_162_afterif - ; source: test_word_gte.p8:1329 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_164_else - ; source: test_word_gte.p8:1330 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_gte.p8:1332 success++ - inc p8b_main.p8v_success -label_asm_163_afterif - ; source: test_word_gte.p8:1334 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1336 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gte.p8:1338 goto skip6a - bra p8l_skip6a - ; source: test_word_gte.p8:1339 lbl6a: fail_word(101) -p8l_lbl6a - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1340 skip6a: -p8l_skip6a - ; source: test_word_gte.p8:1342 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1343 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1345 goto skip6b - bra p8l_skip6b - ; source: test_word_gte.p8:1346 lbl6b: fail_word(102) -p8l_lbl6b - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1347 skip6b: -p8l_skip6b - ; source: test_word_gte.p8:1349 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_165_afterif - ; source: test_word_gte.p8:1350 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_165_afterif - ; source: test_word_gte.p8:1353 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_167_else - ; source: test_word_gte.p8:1354 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_gte.p8:1356 success++ - inc p8b_main.p8v_success -label_asm_166_afterif - ; source: test_word_gte.p8:1358 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1360 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gte.p8:1362 goto skip7a - bra p8l_skip7a - ; source: test_word_gte.p8:1363 lbl7a: fail_word(105) -p8l_lbl7a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1364 skip7a: -p8l_skip7a - ; source: test_word_gte.p8:1366 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1367 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1369 goto skip7b - bra p8l_skip7b - ; source: test_word_gte.p8:1370 lbl7b: fail_word(106) -p8l_lbl7b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1371 skip7b: -p8l_skip7b - ; source: test_word_gte.p8:1373 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_168_afterif - ; source: test_word_gte.p8:1374 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_168_afterif - ; source: test_word_gte.p8:1377 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_170_else - ; source: test_word_gte.p8:1378 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_gte.p8:1380 success++ - inc p8b_main.p8v_success -label_asm_169_afterif - ; source: test_word_gte.p8:1382 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:1383 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1385 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gte.p8:1387 goto skip8a - bra p8l_skip8a - ; source: test_word_gte.p8:1388 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1389 skip8a: -p8l_skip8a - ; source: test_word_gte.p8:1391 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1392 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1394 goto skip8b - bra p8l_skip8b - ; source: test_word_gte.p8:1395 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1396 skip8b: -p8l_skip8b - ; source: test_word_gte.p8:1398 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_171_afterif - ; source: test_word_gte.p8:1399 success++ - inc p8b_main.p8v_success -label_asm_171_afterif - ; source: test_word_gte.p8:1402 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_173_else - ; source: test_word_gte.p8:1403 success++ - inc p8b_main.p8v_success - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_gte.p8:1405 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_word_gte.p8:1407 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1409 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gte.p8:1411 goto skip9a - bra p8l_skip9a - ; source: test_word_gte.p8:1412 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1413 skip9a: -p8l_skip9a - ; source: test_word_gte.p8:1415 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1416 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1418 goto skip9b - bra p8l_skip9b - ; source: test_word_gte.p8:1419 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1420 skip9b: -p8l_skip9b - ; source: test_word_gte.p8:1422 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_174_afterif - ; source: test_word_gte.p8:1423 success++ - inc p8b_main.p8v_success -label_asm_174_afterif - ; source: test_word_gte.p8:1426 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_176_else - ; source: test_word_gte.p8:1427 success++ - inc p8b_main.p8v_success - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_gte.p8:1429 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_word_gte.p8:1431 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:1433 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_gte.p8:1435 goto skip10a - bra p8l_skip10a - ; source: test_word_gte.p8:1436 lbl10a: fail_word(109) -p8l_lbl10a - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1437 skip10a: -p8l_skip10a - ; source: test_word_gte.p8:1439 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1440 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1442 goto skip10b - bra p8l_skip10b - ; source: test_word_gte.p8:1443 lbl10b: fail_word(110) -p8l_lbl10b - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1444 skip10b: -p8l_skip10b - ; source: test_word_gte.p8:1446 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_177_afterif - ; source: test_word_gte.p8:1447 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_177_afterif - ; source: test_word_gte.p8:1450 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_179_else - ; source: test_word_gte.p8:1451 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_gte.p8:1453 success++ - inc p8b_main.p8v_success -label_asm_178_afterif - ; source: test_word_gte.p8:1455 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1457 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gte.p8:1459 goto skip11a - bra p8l_skip11a - ; source: test_word_gte.p8:1460 lbl11a: fail_word(113) -p8l_lbl11a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1461 skip11a: -p8l_skip11a - ; source: test_word_gte.p8:1463 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1464 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1466 goto skip11b - bra p8l_skip11b - ; source: test_word_gte.p8:1467 lbl11b: fail_word(114) -p8l_lbl11b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1468 skip11b: -p8l_skip11b - ; source: test_word_gte.p8:1470 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_180_afterif - ; source: test_word_gte.p8:1471 fail_word(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_180_afterif - ; source: test_word_gte.p8:1474 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_182_else - ; source: test_word_gte.p8:1475 fail_word(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_gte.p8:1477 success++ - inc p8b_main.p8v_success -label_asm_181_afterif - ; source: test_word_gte.p8:1479 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1481 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gte.p8:1483 goto skip12a - bra p8l_skip12a - ; source: test_word_gte.p8:1484 lbl12a: fail_word(117) -p8l_lbl12a - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1485 skip12a: -p8l_skip12a - ; source: test_word_gte.p8:1487 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1488 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1490 goto skip12b - bra p8l_skip12b - ; source: test_word_gte.p8:1491 lbl12b: fail_word(118) -p8l_lbl12b - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1492 skip12b: -p8l_skip12b - ; source: test_word_gte.p8:1494 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_183_afterif - ; source: test_word_gte.p8:1495 fail_word(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_183_afterif - ; source: test_word_gte.p8:1498 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_185_else - ; source: test_word_gte.p8:1499 fail_word(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_gte.p8:1501 success++ - inc p8b_main.p8v_success -label_asm_184_afterif - ; source: test_word_gte.p8:1503 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1505 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gte.p8:1507 goto skip13a - bra p8l_skip13a - ; source: test_word_gte.p8:1508 lbl13a: fail_word(121) -p8l_lbl13a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1509 skip13a: -p8l_skip13a - ; source: test_word_gte.p8:1511 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1512 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1514 goto skip13b - bra p8l_skip13b - ; source: test_word_gte.p8:1515 lbl13b: fail_word(122) -p8l_lbl13b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1516 skip13b: -p8l_skip13b - ; source: test_word_gte.p8:1518 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_186_afterif - ; source: test_word_gte.p8:1519 fail_word(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_186_afterif - ; source: test_word_gte.p8:1522 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_188_else - ; source: test_word_gte.p8:1523 fail_word(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_gte.p8:1525 success++ - inc p8b_main.p8v_success -label_asm_187_afterif - ; source: test_word_gte.p8:1527 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1529 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gte.p8:1531 goto skip14a - bra p8l_skip14a - ; source: test_word_gte.p8:1532 lbl14a: fail_word(125) -p8l_lbl14a - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1533 skip14a: -p8l_skip14a - ; source: test_word_gte.p8:1535 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1536 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1538 goto skip14b - bra p8l_skip14b - ; source: test_word_gte.p8:1539 lbl14b: fail_word(126) -p8l_lbl14b - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1540 skip14b: -p8l_skip14b - ; source: test_word_gte.p8:1542 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_189_afterif - ; source: test_word_gte.p8:1543 fail_word(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_189_afterif - ; source: test_word_gte.p8:1546 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_191_else - ; source: test_word_gte.p8:1547 fail_word(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_gte.p8:1549 success++ - inc p8b_main.p8v_success -label_asm_190_afterif - ; source: test_word_gte.p8:1551 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gte.p8:1552 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1554 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gte.p8:1556 goto skip15a - bra p8l_skip15a - ; source: test_word_gte.p8:1557 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1558 skip15a: -p8l_skip15a - ; source: test_word_gte.p8:1560 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1561 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1563 goto skip15b - bra p8l_skip15b - ; source: test_word_gte.p8:1564 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1565 skip15b: -p8l_skip15b - ; source: test_word_gte.p8:1567 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_192_afterif - ; source: test_word_gte.p8:1568 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_word_gte.p8:1571 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_194_else - ; source: test_word_gte.p8:1572 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_gte.p8:1574 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_word_gte.p8:1576 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1578 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gte.p8:1580 goto skip16a - bra p8l_skip16a - ; source: test_word_gte.p8:1581 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1582 skip16a: -p8l_skip16a - ; source: test_word_gte.p8:1584 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1585 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1587 goto skip16b - bra p8l_skip16b - ; source: test_word_gte.p8:1588 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1589 skip16b: -p8l_skip16b - ; source: test_word_gte.p8:1591 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_195_afterif - ; source: test_word_gte.p8:1592 success++ - inc p8b_main.p8v_success -label_asm_195_afterif - ; source: test_word_gte.p8:1595 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_197_else - ; source: test_word_gte.p8:1596 success++ - inc p8b_main.p8v_success - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_gte.p8:1598 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_word_gte.p8:1600 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:1602 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_gte.p8:1604 goto skip17a - bra p8l_skip17a - ; source: test_word_gte.p8:1605 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1606 skip17a: -p8l_skip17a - ; source: test_word_gte.p8:1608 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1609 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1611 goto skip17b - bra p8l_skip17b - ; source: test_word_gte.p8:1612 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1613 skip17b: -p8l_skip17b - ; source: test_word_gte.p8:1615 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_198_afterif - ; source: test_word_gte.p8:1616 success++ - inc p8b_main.p8v_success -label_asm_198_afterif - ; source: test_word_gte.p8:1619 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_200_else - ; source: test_word_gte.p8:1620 success++ - inc p8b_main.p8v_success - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_gte.p8:1622 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_word_gte.p8:1624 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1626 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gte.p8:1628 goto skip18a - bra p8l_skip18a - ; source: test_word_gte.p8:1629 lbl18a: fail_word(129) -p8l_lbl18a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1630 skip18a: -p8l_skip18a - ; source: test_word_gte.p8:1632 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1633 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1635 goto skip18b - bra p8l_skip18b - ; source: test_word_gte.p8:1636 lbl18b: fail_word(130) -p8l_lbl18b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1637 skip18b: -p8l_skip18b - ; source: test_word_gte.p8:1639 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_201_afterif - ; source: test_word_gte.p8:1640 fail_word(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_201_afterif - ; source: test_word_gte.p8:1643 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_203_else - ; source: test_word_gte.p8:1644 fail_word(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_gte.p8:1646 success++ - inc p8b_main.p8v_success -label_asm_202_afterif - ; source: test_word_gte.p8:1648 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1650 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gte.p8:1652 goto skip19a - bra p8l_skip19a - ; source: test_word_gte.p8:1653 lbl19a: fail_word(133) -p8l_lbl19a - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1654 skip19a: -p8l_skip19a - ; source: test_word_gte.p8:1656 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1657 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1659 goto skip19b - bra p8l_skip19b - ; source: test_word_gte.p8:1660 lbl19b: fail_word(134) -p8l_lbl19b - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1661 skip19b: -p8l_skip19b - ; source: test_word_gte.p8:1663 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_204_afterif - ; source: test_word_gte.p8:1664 fail_word(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_204_afterif - ; source: test_word_gte.p8:1667 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_206_else - ; source: test_word_gte.p8:1668 fail_word(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_gte.p8:1670 success++ - inc p8b_main.p8v_success -label_asm_205_afterif - ; source: test_word_gte.p8:1672 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1674 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gte.p8:1676 goto skip20a - bra p8l_skip20a - ; source: test_word_gte.p8:1677 lbl20a: fail_word(137) -p8l_lbl20a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1678 skip20a: -p8l_skip20a - ; source: test_word_gte.p8:1680 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1681 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1683 goto skip20b - bra p8l_skip20b - ; source: test_word_gte.p8:1684 lbl20b: fail_word(138) -p8l_lbl20b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1685 skip20b: -p8l_skip20b - ; source: test_word_gte.p8:1687 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_207_afterif - ; source: test_word_gte.p8:1688 fail_word(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_207_afterif - ; source: test_word_gte.p8:1691 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_209_else - ; source: test_word_gte.p8:1692 fail_word(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_gte.p8:1694 success++ - inc p8b_main.p8v_success -label_asm_208_afterif - ; source: test_word_gte.p8:1696 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1698 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gte.p8:1700 goto skip21a - bra p8l_skip21a - ; source: test_word_gte.p8:1701 lbl21a: fail_word(141) -p8l_lbl21a - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1702 skip21a: -p8l_skip21a - ; source: test_word_gte.p8:1704 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1705 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1707 goto skip21b - bra p8l_skip21b - ; source: test_word_gte.p8:1708 lbl21b: fail_word(142) -p8l_lbl21b - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1709 skip21b: -p8l_skip21b - ; source: test_word_gte.p8:1711 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_210_afterif - ; source: test_word_gte.p8:1712 fail_word(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_210_afterif - ; source: test_word_gte.p8:1715 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_212_else - ; source: test_word_gte.p8:1716 fail_word(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_gte.p8:1718 success++ - inc p8b_main.p8v_success -label_asm_211_afterif - ; source: test_word_gte.p8:1720 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:1721 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1723 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gte.p8:1725 goto skip22a - bra p8l_skip22a - ; source: test_word_gte.p8:1726 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1727 skip22a: -p8l_skip22a - ; source: test_word_gte.p8:1729 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1730 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1732 goto skip22b - bra p8l_skip22b - ; source: test_word_gte.p8:1733 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1734 skip22b: -p8l_skip22b - ; source: test_word_gte.p8:1736 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_213_afterif - ; source: test_word_gte.p8:1737 success++ - inc p8b_main.p8v_success -label_asm_213_afterif - ; source: test_word_gte.p8:1740 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_215_else - ; source: test_word_gte.p8:1741 success++ - inc p8b_main.p8v_success - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_gte.p8:1743 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_word_gte.p8:1745 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1747 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gte.p8:1749 goto skip23a - bra p8l_skip23a - ; source: test_word_gte.p8:1750 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1751 skip23a: -p8l_skip23a - ; source: test_word_gte.p8:1753 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1754 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1756 goto skip23b - bra p8l_skip23b - ; source: test_word_gte.p8:1757 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1758 skip23b: -p8l_skip23b - ; source: test_word_gte.p8:1760 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_216_afterif - ; source: test_word_gte.p8:1761 success++ - inc p8b_main.p8v_success -label_asm_216_afterif - ; source: test_word_gte.p8:1764 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_218_else - ; source: test_word_gte.p8:1765 success++ - inc p8b_main.p8v_success - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_gte.p8:1767 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_word_gte.p8:1769 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:1771 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_gte.p8:1773 goto skip24a - bra p8l_skip24a - ; source: test_word_gte.p8:1774 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1775 skip24a: -p8l_skip24a - ; source: test_word_gte.p8:1777 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1778 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1780 goto skip24b - bra p8l_skip24b - ; source: test_word_gte.p8:1781 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1782 skip24b: -p8l_skip24b - ; source: test_word_gte.p8:1784 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_219_afterif - ; source: test_word_gte.p8:1785 success++ - inc p8b_main.p8v_success -label_asm_219_afterif - ; source: test_word_gte.p8:1788 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_221_else - ; source: test_word_gte.p8:1789 success++ - inc p8b_main.p8v_success - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_gte.p8:1791 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_word_gte.p8:1793 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1795 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gte.p8:1797 goto skip25a - bra p8l_skip25a - ; source: test_word_gte.p8:1798 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1799 skip25a: -p8l_skip25a - ; source: test_word_gte.p8:1801 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1802 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1804 goto skip25b - bra p8l_skip25b - ; source: test_word_gte.p8:1805 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1806 skip25b: -p8l_skip25b - ; source: test_word_gte.p8:1808 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_222_afterif - ; source: test_word_gte.p8:1809 success++ - inc p8b_main.p8v_success -label_asm_222_afterif - ; source: test_word_gte.p8:1812 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_224_else - ; source: test_word_gte.p8:1813 success++ - inc p8b_main.p8v_success - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_gte.p8:1815 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_word_gte.p8:1817 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1819 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gte.p8:1821 goto skip26a - bra p8l_skip26a - ; source: test_word_gte.p8:1822 lbl26a: fail_word(145) -p8l_lbl26a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1823 skip26a: -p8l_skip26a - ; source: test_word_gte.p8:1825 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1826 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1828 goto skip26b - bra p8l_skip26b - ; source: test_word_gte.p8:1829 lbl26b: fail_word(146) -p8l_lbl26b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1830 skip26b: -p8l_skip26b - ; source: test_word_gte.p8:1832 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_225_afterif - ; source: test_word_gte.p8:1833 fail_word(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_225_afterif - ; source: test_word_gte.p8:1836 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_227_else - ; source: test_word_gte.p8:1837 fail_word(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_gte.p8:1839 success++ - inc p8b_main.p8v_success -label_asm_226_afterif - ; source: test_word_gte.p8:1841 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1843 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gte.p8:1845 goto skip27a - bra p8l_skip27a - ; source: test_word_gte.p8:1846 lbl27a: fail_word(149) -p8l_lbl27a - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1847 skip27a: -p8l_skip27a - ; source: test_word_gte.p8:1849 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1850 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1852 goto skip27b - bra p8l_skip27b - ; source: test_word_gte.p8:1853 lbl27b: fail_word(150) -p8l_lbl27b - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1854 skip27b: -p8l_skip27b - ; source: test_word_gte.p8:1856 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_228_afterif - ; source: test_word_gte.p8:1857 fail_word(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_228_afterif - ; source: test_word_gte.p8:1860 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_230_else - ; source: test_word_gte.p8:1861 fail_word(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_gte.p8:1863 success++ - inc p8b_main.p8v_success -label_asm_229_afterif - ; source: test_word_gte.p8:1865 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1867 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gte.p8:1869 goto skip28a - bra p8l_skip28a - ; source: test_word_gte.p8:1870 lbl28a: fail_word(153) -p8l_lbl28a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1871 skip28a: -p8l_skip28a - ; source: test_word_gte.p8:1873 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1874 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1876 goto skip28b - bra p8l_skip28b - ; source: test_word_gte.p8:1877 lbl28b: fail_word(154) -p8l_lbl28b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:1878 skip28b: -p8l_skip28b - ; source: test_word_gte.p8:1880 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_231_afterif - ; source: test_word_gte.p8:1881 fail_word(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_231_afterif - ; source: test_word_gte.p8:1884 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_233_else - ; source: test_word_gte.p8:1885 fail_word(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_gte.p8:1887 success++ - inc p8b_main.p8v_success -label_asm_232_afterif - ; source: test_word_gte.p8:1889 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:1890 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1892 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gte.p8:1894 goto skip29a - bra p8l_skip29a - ; source: test_word_gte.p8:1895 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1896 skip29a: -p8l_skip29a - ; source: test_word_gte.p8:1898 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1899 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1901 goto skip29b - bra p8l_skip29b - ; source: test_word_gte.p8:1902 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1903 skip29b: -p8l_skip29b - ; source: test_word_gte.p8:1905 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_234_afterif - ; source: test_word_gte.p8:1906 success++ - inc p8b_main.p8v_success -label_asm_234_afterif - ; source: test_word_gte.p8:1909 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_236_else - ; source: test_word_gte.p8:1910 success++ - inc p8b_main.p8v_success - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_gte.p8:1912 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_word_gte.p8:1914 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1916 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gte.p8:1918 goto skip30a - bra p8l_skip30a - ; source: test_word_gte.p8:1919 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1920 skip30a: -p8l_skip30a - ; source: test_word_gte.p8:1922 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1923 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1925 goto skip30b - bra p8l_skip30b - ; source: test_word_gte.p8:1926 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1927 skip30b: -p8l_skip30b - ; source: test_word_gte.p8:1929 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_237_afterif - ; source: test_word_gte.p8:1930 success++ - inc p8b_main.p8v_success -label_asm_237_afterif - ; source: test_word_gte.p8:1933 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_239_else - ; source: test_word_gte.p8:1934 success++ - inc p8b_main.p8v_success - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_gte.p8:1936 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_word_gte.p8:1938 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:1940 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_gte.p8:1942 goto skip31a - bra p8l_skip31a - ; source: test_word_gte.p8:1943 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1944 skip31a: -p8l_skip31a - ; source: test_word_gte.p8:1946 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1947 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1949 goto skip31b - bra p8l_skip31b - ; source: test_word_gte.p8:1950 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1951 skip31b: -p8l_skip31b - ; source: test_word_gte.p8:1953 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_240_afterif - ; source: test_word_gte.p8:1954 success++ - inc p8b_main.p8v_success -label_asm_240_afterif - ; source: test_word_gte.p8:1957 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_242_else - ; source: test_word_gte.p8:1958 success++ - inc p8b_main.p8v_success - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_gte.p8:1960 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_word_gte.p8:1962 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1964 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gte.p8:1966 goto skip32a - bra p8l_skip32a - ; source: test_word_gte.p8:1967 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1968 skip32a: -p8l_skip32a - ; source: test_word_gte.p8:1970 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1971 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1973 goto skip32b - bra p8l_skip32b - ; source: test_word_gte.p8:1974 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1975 skip32b: -p8l_skip32b - ; source: test_word_gte.p8:1977 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_243_afterif - ; source: test_word_gte.p8:1978 success++ - inc p8b_main.p8v_success -label_asm_243_afterif - ; source: test_word_gte.p8:1981 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_245_else - ; source: test_word_gte.p8:1982 success++ - inc p8b_main.p8v_success - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_gte.p8:1984 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_word_gte.p8:1986 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:1988 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gte.p8:1990 goto skip33a - bra p8l_skip33a - ; source: test_word_gte.p8:1991 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1992 skip33a: -p8l_skip33a - ; source: test_word_gte.p8:1994 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:1995 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:1997 goto skip33b - bra p8l_skip33b - ; source: test_word_gte.p8:1998 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:1999 skip33b: -p8l_skip33b - ; source: test_word_gte.p8:2001 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_246_afterif - ; source: test_word_gte.p8:2002 success++ - inc p8b_main.p8v_success -label_asm_246_afterif - ; source: test_word_gte.p8:2005 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_248_else - ; source: test_word_gte.p8:2006 success++ - inc p8b_main.p8v_success - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_gte.p8:2008 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_word_gte.p8:2010 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2012 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gte.p8:2014 goto skip34a - bra p8l_skip34a - ; source: test_word_gte.p8:2015 lbl34a: fail_word(157) -p8l_lbl34a - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2016 skip34a: -p8l_skip34a - ; source: test_word_gte.p8:2018 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2019 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2021 goto skip34b - bra p8l_skip34b - ; source: test_word_gte.p8:2022 lbl34b: fail_word(158) -p8l_lbl34b - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2023 skip34b: -p8l_skip34b - ; source: test_word_gte.p8:2025 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_249_afterif - ; source: test_word_gte.p8:2026 fail_word(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_249_afterif - ; source: test_word_gte.p8:2029 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_251_else - ; source: test_word_gte.p8:2030 fail_word(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_gte.p8:2032 success++ - inc p8b_main.p8v_success -label_asm_250_afterif - ; source: test_word_gte.p8:2034 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2036 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gte.p8:2038 goto skip35a - bra p8l_skip35a - ; source: test_word_gte.p8:2039 lbl35a: fail_word(161) -p8l_lbl35a - ldy #>$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2040 skip35a: -p8l_skip35a - ; source: test_word_gte.p8:2042 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2043 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2045 goto skip35b - bra p8l_skip35b - ; source: test_word_gte.p8:2046 lbl35b: fail_word(162) -p8l_lbl35b - ldy #>$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2047 skip35b: -p8l_skip35b - ; source: test_word_gte.p8:2049 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_252_afterif - ; source: test_word_gte.p8:2050 fail_word(163) - ldy #>$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_252_afterif - ; source: test_word_gte.p8:2053 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_254_else - ; source: test_word_gte.p8:2054 fail_word(164) - ldy #>$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_gte.p8:2056 success++ - inc p8b_main.p8v_success -label_asm_253_afterif - ; source: test_word_gte.p8:2058 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:2059 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2061 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gte.p8:2063 goto skip36a - bra p8l_skip36a - ; source: test_word_gte.p8:2064 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2065 skip36a: -p8l_skip36a - ; source: test_word_gte.p8:2067 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2068 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2070 goto skip36b - bra p8l_skip36b - ; source: test_word_gte.p8:2071 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2072 skip36b: -p8l_skip36b - ; source: test_word_gte.p8:2074 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_255_afterif - ; source: test_word_gte.p8:2075 success++ - inc p8b_main.p8v_success -label_asm_255_afterif - ; source: test_word_gte.p8:2078 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_257_else - ; source: test_word_gte.p8:2079 success++ - inc p8b_main.p8v_success - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_gte.p8:2081 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_word_gte.p8:2083 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2085 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gte.p8:2087 goto skip37a - bra p8l_skip37a - ; source: test_word_gte.p8:2088 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2089 skip37a: -p8l_skip37a - ; source: test_word_gte.p8:2091 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2092 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2094 goto skip37b - bra p8l_skip37b - ; source: test_word_gte.p8:2095 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2096 skip37b: -p8l_skip37b - ; source: test_word_gte.p8:2098 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_258_afterif - ; source: test_word_gte.p8:2099 success++ - inc p8b_main.p8v_success -label_asm_258_afterif - ; source: test_word_gte.p8:2102 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_260_else - ; source: test_word_gte.p8:2103 success++ - inc p8b_main.p8v_success - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_gte.p8:2105 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_word_gte.p8:2107 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:2109 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_gte.p8:2111 goto skip38a - bra p8l_skip38a - ; source: test_word_gte.p8:2112 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2113 skip38a: -p8l_skip38a - ; source: test_word_gte.p8:2115 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2116 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2118 goto skip38b - bra p8l_skip38b - ; source: test_word_gte.p8:2119 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2120 skip38b: -p8l_skip38b - ; source: test_word_gte.p8:2122 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_261_afterif - ; source: test_word_gte.p8:2123 success++ - inc p8b_main.p8v_success -label_asm_261_afterif - ; source: test_word_gte.p8:2126 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_263_else - ; source: test_word_gte.p8:2127 success++ - inc p8b_main.p8v_success - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_gte.p8:2129 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_word_gte.p8:2131 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2133 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gte.p8:2135 goto skip39a - bra p8l_skip39a - ; source: test_word_gte.p8:2136 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2137 skip39a: -p8l_skip39a - ; source: test_word_gte.p8:2139 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2140 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2142 goto skip39b - bra p8l_skip39b - ; source: test_word_gte.p8:2143 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2144 skip39b: -p8l_skip39b - ; source: test_word_gte.p8:2146 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_264_afterif - ; source: test_word_gte.p8:2147 success++ - inc p8b_main.p8v_success -label_asm_264_afterif - ; source: test_word_gte.p8:2150 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_266_else - ; source: test_word_gte.p8:2151 success++ - inc p8b_main.p8v_success - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_gte.p8:2153 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_word_gte.p8:2155 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2157 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gte.p8:2159 goto skip40a - bra p8l_skip40a - ; source: test_word_gte.p8:2160 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2161 skip40a: -p8l_skip40a - ; source: test_word_gte.p8:2163 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2164 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2166 goto skip40b - bra p8l_skip40b - ; source: test_word_gte.p8:2167 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2168 skip40b: -p8l_skip40b - ; source: test_word_gte.p8:2170 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_267_afterif - ; source: test_word_gte.p8:2171 success++ - inc p8b_main.p8v_success -label_asm_267_afterif - ; source: test_word_gte.p8:2174 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_269_else - ; source: test_word_gte.p8:2175 success++ - inc p8b_main.p8v_success - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_gte.p8:2177 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_word_gte.p8:2179 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2181 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gte.p8:2183 goto skip41a - bra p8l_skip41a - ; source: test_word_gte.p8:2184 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2185 skip41a: -p8l_skip41a - ; source: test_word_gte.p8:2187 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2188 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2190 goto skip41b - bra p8l_skip41b - ; source: test_word_gte.p8:2191 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2192 skip41b: -p8l_skip41b - ; source: test_word_gte.p8:2194 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_270_afterif - ; source: test_word_gte.p8:2195 success++ - inc p8b_main.p8v_success -label_asm_270_afterif - ; source: test_word_gte.p8:2198 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_272_else - ; source: test_word_gte.p8:2199 success++ - inc p8b_main.p8v_success - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_gte.p8:2201 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_word_gte.p8:2203 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2205 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gte.p8:2207 goto skip42a - bra p8l_skip42a - ; source: test_word_gte.p8:2208 lbl42a: fail_word(165) -p8l_lbl42a - ldy #>$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2209 skip42a: -p8l_skip42a - ; source: test_word_gte.p8:2211 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2212 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2214 goto skip42b - bra p8l_skip42b - ; source: test_word_gte.p8:2215 lbl42b: fail_word(166) -p8l_lbl42b - ldy #>$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2216 skip42b: -p8l_skip42b - ; source: test_word_gte.p8:2218 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_273_afterif - ; source: test_word_gte.p8:2219 fail_word(167) - ldy #>$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_273_afterif - ; source: test_word_gte.p8:2222 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_275_else - ; source: test_word_gte.p8:2223 fail_word(168) - ldy #>$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_gte.p8:2225 success++ - inc p8b_main.p8v_success -label_asm_274_afterif - ; source: test_word_gte.p8:2227 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:2228 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2230 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gte.p8:2232 goto skip43a - bra p8l_skip43a - ; source: test_word_gte.p8:2233 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2234 skip43a: -p8l_skip43a - ; source: test_word_gte.p8:2236 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2237 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2239 goto skip43b - bra p8l_skip43b - ; source: test_word_gte.p8:2240 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2241 skip43b: -p8l_skip43b - ; source: test_word_gte.p8:2243 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_276_afterif - ; source: test_word_gte.p8:2244 success++ - inc p8b_main.p8v_success -label_asm_276_afterif - ; source: test_word_gte.p8:2247 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_278_else - ; source: test_word_gte.p8:2248 success++ - inc p8b_main.p8v_success - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_gte.p8:2250 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_word_gte.p8:2252 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2254 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gte.p8:2256 goto skip44a - bra p8l_skip44a - ; source: test_word_gte.p8:2257 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2258 skip44a: -p8l_skip44a - ; source: test_word_gte.p8:2260 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2261 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2263 goto skip44b - bra p8l_skip44b - ; source: test_word_gte.p8:2264 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2265 skip44b: -p8l_skip44b - ; source: test_word_gte.p8:2267 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_279_afterif - ; source: test_word_gte.p8:2268 success++ - inc p8b_main.p8v_success -label_asm_279_afterif - ; source: test_word_gte.p8:2271 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_281_else - ; source: test_word_gte.p8:2272 success++ - inc p8b_main.p8v_success - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_gte.p8:2274 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_word_gte.p8:2276 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_gte.p8:2278 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_gte.p8:2280 goto skip45a - bra p8l_skip45a - ; source: test_word_gte.p8:2281 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2282 skip45a: -p8l_skip45a - ; source: test_word_gte.p8:2284 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2285 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2287 goto skip45b - bra p8l_skip45b - ; source: test_word_gte.p8:2288 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2289 skip45b: -p8l_skip45b - ; source: test_word_gte.p8:2291 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_282_afterif - ; source: test_word_gte.p8:2292 success++ - inc p8b_main.p8v_success -label_asm_282_afterif - ; source: test_word_gte.p8:2295 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_284_else - ; source: test_word_gte.p8:2296 success++ - inc p8b_main.p8v_success - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_gte.p8:2298 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_word_gte.p8:2300 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2302 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gte.p8:2304 goto skip46a - bra p8l_skip46a - ; source: test_word_gte.p8:2305 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2306 skip46a: -p8l_skip46a - ; source: test_word_gte.p8:2308 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2309 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2311 goto skip46b - bra p8l_skip46b - ; source: test_word_gte.p8:2312 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2313 skip46b: -p8l_skip46b - ; source: test_word_gte.p8:2315 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_285_afterif - ; source: test_word_gte.p8:2316 success++ - inc p8b_main.p8v_success -label_asm_285_afterif - ; source: test_word_gte.p8:2319 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_287_else - ; source: test_word_gte.p8:2320 success++ - inc p8b_main.p8v_success - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_gte.p8:2322 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_word_gte.p8:2324 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2326 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gte.p8:2328 goto skip47a - bra p8l_skip47a - ; source: test_word_gte.p8:2329 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2330 skip47a: -p8l_skip47a - ; source: test_word_gte.p8:2332 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2333 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2335 goto skip47b - bra p8l_skip47b - ; source: test_word_gte.p8:2336 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2337 skip47b: -p8l_skip47b - ; source: test_word_gte.p8:2339 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_288_afterif - ; source: test_word_gte.p8:2340 success++ - inc p8b_main.p8v_success -label_asm_288_afterif - ; source: test_word_gte.p8:2343 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_290_else - ; source: test_word_gte.p8:2344 success++ - inc p8b_main.p8v_success - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_gte.p8:2346 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_word_gte.p8:2348 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2350 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gte.p8:2352 goto skip48a - bra p8l_skip48a - ; source: test_word_gte.p8:2353 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2354 skip48a: -p8l_skip48a - ; source: test_word_gte.p8:2356 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2357 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2359 goto skip48b - bra p8l_skip48b - ; source: test_word_gte.p8:2360 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2361 skip48b: -p8l_skip48b - ; source: test_word_gte.p8:2363 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_291_afterif - ; source: test_word_gte.p8:2364 success++ - inc p8b_main.p8v_success -label_asm_291_afterif - ; source: test_word_gte.p8:2367 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_293_else - ; source: test_word_gte.p8:2368 success++ - inc p8b_main.p8v_success - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_gte.p8:2370 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_word_gte.p8:2372 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_gte.p8:2374 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gte.p8:2376 goto skip49a - bra p8l_skip49a - ; source: test_word_gte.p8:2377 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2378 skip49a: -p8l_skip49a - ; source: test_word_gte.p8:2380 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2381 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2383 goto skip49b - bra p8l_skip49b - ; source: test_word_gte.p8:2384 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2385 skip49b: -p8l_skip49b - ; source: test_word_gte.p8:2387 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_294_afterif - ; source: test_word_gte.p8:2388 success++ - inc p8b_main.p8v_success -label_asm_294_afterif - ; source: test_word_gte.p8:2391 if x>=value - ldy p8v_x+1 - lda p8v_x - cmp p8v_value - tya - sbc p8v_value+1 - bvc + - eor #128 -+ bmi label_asm_296_else - ; source: test_word_gte.p8:2392 success++ - inc p8b_main.p8v_success - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_gte.p8:2394 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_word_gte.p8:2396 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_gte.p8:1210 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .sint ? -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_gte.p8:2398 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_word_gte.p8:2399 word @shared x - ; source: test_word_gte.p8:2400 word[] values = [0, 0] - ; source: test_word_gte.p8:2399 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_gte.p8:2401 success = 0 - stz p8b_main.p8v_success - ; source: test_word_gte.p8:2402 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:2403 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:2405 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gte.p8:2407 goto skip1a - bra p8l_skip1a - ; source: test_word_gte.p8:2408 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2409 skip1a: -p8l_skip1a - ; source: test_word_gte.p8:2411 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2412 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2414 goto skip1b - bra p8l_skip1b - ; source: test_word_gte.p8:2415 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2416 skip1b: -p8l_skip1b - ; source: test_word_gte.p8:2418 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_297_afterif - ; source: test_word_gte.p8:2419 success++ - inc p8b_main.p8v_success -label_asm_297_afterif - ; source: test_word_gte.p8:2422 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_299_else - ; source: test_word_gte.p8:2423 success++ - inc p8b_main.p8v_success - bra label_asm_298_afterif -label_asm_299_else - ; source: test_word_gte.p8:2425 cx16.r0L++ - inc cx16.r0L -label_asm_298_afterif - ; source: test_word_gte.p8:2427 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2429 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gte.p8:2431 goto skip2a - bra p8l_skip2a - ; source: test_word_gte.p8:2432 lbl2a: fail_word(169) -p8l_lbl2a - ldy #>$a9 - lda #<$a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2433 skip2a: -p8l_skip2a - ; source: test_word_gte.p8:2435 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2436 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2438 goto skip2b - bra p8l_skip2b - ; source: test_word_gte.p8:2439 lbl2b: fail_word(170) -p8l_lbl2b - ldy #>$aa - lda #<$aa - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2440 skip2b: -p8l_skip2b - ; source: test_word_gte.p8:2442 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_300_afterif - ; source: test_word_gte.p8:2443 fail_word(171) - ldy #>$ab - lda #<$ab - jsr p8b_main.p8s_fail_word -label_asm_300_afterif - ; source: test_word_gte.p8:2446 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_302_else - ; source: test_word_gte.p8:2447 fail_word(172) - ldy #>$ac - lda #<$ac - jsr p8b_main.p8s_fail_word - bra label_asm_301_afterif -label_asm_302_else - ; source: test_word_gte.p8:2449 success++ - inc p8b_main.p8v_success -label_asm_301_afterif - ; source: test_word_gte.p8:2451 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:2453 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_gte.p8:2455 goto skip3a - bra p8l_skip3a - ; source: test_word_gte.p8:2456 lbl3a: fail_word(173) -p8l_lbl3a - ldy #>$ad - lda #<$ad - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2457 skip3a: -p8l_skip3a - ; source: test_word_gte.p8:2459 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2460 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2462 goto skip3b - bra p8l_skip3b - ; source: test_word_gte.p8:2463 lbl3b: fail_word(174) -p8l_lbl3b - ldy #>$ae - lda #<$ae - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2464 skip3b: -p8l_skip3b - ; source: test_word_gte.p8:2466 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_303_afterif - ; source: test_word_gte.p8:2467 fail_word(175) - ldy #>$af - lda #<$af - jsr p8b_main.p8s_fail_word -label_asm_303_afterif - ; source: test_word_gte.p8:2470 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_305_else - ; source: test_word_gte.p8:2471 fail_word(176) - ldy #>$b0 - lda #<$b0 - jsr p8b_main.p8s_fail_word - bra label_asm_304_afterif -label_asm_305_else - ; source: test_word_gte.p8:2473 success++ - inc p8b_main.p8v_success -label_asm_304_afterif - ; source: test_word_gte.p8:2475 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2477 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gte.p8:2479 goto skip4a - bra p8l_skip4a - ; source: test_word_gte.p8:2480 lbl4a: fail_word(177) -p8l_lbl4a - ldy #>$b1 - lda #<$b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2481 skip4a: -p8l_skip4a - ; source: test_word_gte.p8:2483 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2484 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2486 goto skip4b - bra p8l_skip4b - ; source: test_word_gte.p8:2487 lbl4b: fail_word(178) -p8l_lbl4b - ldy #>$b2 - lda #<$b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2488 skip4b: -p8l_skip4b - ; source: test_word_gte.p8:2490 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_306_afterif - ; source: test_word_gte.p8:2491 fail_word(179) - ldy #>$b3 - lda #<$b3 - jsr p8b_main.p8s_fail_word -label_asm_306_afterif - ; source: test_word_gte.p8:2494 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_308_else - ; source: test_word_gte.p8:2495 fail_word(180) - ldy #>$b4 - lda #<$b4 - jsr p8b_main.p8s_fail_word - bra label_asm_307_afterif -label_asm_308_else - ; source: test_word_gte.p8:2497 success++ - inc p8b_main.p8v_success -label_asm_307_afterif - ; source: test_word_gte.p8:2499 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:2501 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gte.p8:2503 goto skip5a - bra p8l_skip5a - ; source: test_word_gte.p8:2504 lbl5a: fail_word(181) -p8l_lbl5a - ldy #>$b5 - lda #<$b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2505 skip5a: -p8l_skip5a - ; source: test_word_gte.p8:2507 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2508 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2510 goto skip5b - bra p8l_skip5b - ; source: test_word_gte.p8:2511 lbl5b: fail_word(182) -p8l_lbl5b - ldy #>$b6 - lda #<$b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2512 skip5b: -p8l_skip5b - ; source: test_word_gte.p8:2514 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_309_afterif - ; source: test_word_gte.p8:2515 fail_word(183) - ldy #>$b7 - lda #<$b7 - jsr p8b_main.p8s_fail_word -label_asm_309_afterif - ; source: test_word_gte.p8:2518 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_311_else - ; source: test_word_gte.p8:2519 fail_word(184) - ldy #>$b8 - lda #<$b8 - jsr p8b_main.p8s_fail_word - bra label_asm_310_afterif -label_asm_311_else - ; source: test_word_gte.p8:2521 success++ - inc p8b_main.p8v_success -label_asm_310_afterif - ; source: test_word_gte.p8:2523 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:2525 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gte.p8:2527 goto skip6a - bra p8l_skip6a - ; source: test_word_gte.p8:2528 lbl6a: fail_word(185) -p8l_lbl6a - ldy #>$b9 - lda #<$b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2529 skip6a: -p8l_skip6a - ; source: test_word_gte.p8:2531 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2532 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2534 goto skip6b - bra p8l_skip6b - ; source: test_word_gte.p8:2535 lbl6b: fail_word(186) -p8l_lbl6b - ldy #>$ba - lda #<$ba - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2536 skip6b: -p8l_skip6b - ; source: test_word_gte.p8:2538 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_312_afterif - ; source: test_word_gte.p8:2539 fail_word(187) - ldy #>$bb - lda #<$bb - jsr p8b_main.p8s_fail_word -label_asm_312_afterif - ; source: test_word_gte.p8:2542 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_314_else - ; source: test_word_gte.p8:2543 fail_word(188) - ldy #>$bc - lda #<$bc - jsr p8b_main.p8s_fail_word - bra label_asm_313_afterif -label_asm_314_else - ; source: test_word_gte.p8:2545 success++ - inc p8b_main.p8v_success -label_asm_313_afterif - ; source: test_word_gte.p8:2547 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:2549 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gte.p8:2551 goto skip7a - bra p8l_skip7a - ; source: test_word_gte.p8:2552 lbl7a: fail_word(189) -p8l_lbl7a - ldy #>$bd - lda #<$bd - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2553 skip7a: -p8l_skip7a - ; source: test_word_gte.p8:2555 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2556 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2558 goto skip7b - bra p8l_skip7b - ; source: test_word_gte.p8:2559 lbl7b: fail_word(190) -p8l_lbl7b - ldy #>$be - lda #<$be - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2560 skip7b: -p8l_skip7b - ; source: test_word_gte.p8:2562 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_315_afterif - ; source: test_word_gte.p8:2563 fail_word(191) - ldy #>$bf - lda #<$bf - jsr p8b_main.p8s_fail_word -label_asm_315_afterif - ; source: test_word_gte.p8:2566 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_317_else - ; source: test_word_gte.p8:2567 fail_word(192) - ldy #>$c0 - lda #<$c0 - jsr p8b_main.p8s_fail_word - bra label_asm_316_afterif -label_asm_317_else - ; source: test_word_gte.p8:2569 success++ - inc p8b_main.p8v_success -label_asm_316_afterif - ; source: test_word_gte.p8:2571 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:2572 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:2574 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gte.p8:2576 goto skip8a - bra p8l_skip8a - ; source: test_word_gte.p8:2577 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2578 skip8a: -p8l_skip8a - ; source: test_word_gte.p8:2580 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2581 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2583 goto skip8b - bra p8l_skip8b - ; source: test_word_gte.p8:2584 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2585 skip8b: -p8l_skip8b - ; source: test_word_gte.p8:2587 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_318_afterif - ; source: test_word_gte.p8:2588 success++ - inc p8b_main.p8v_success -label_asm_318_afterif - ; source: test_word_gte.p8:2591 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_320_else - ; source: test_word_gte.p8:2592 success++ - inc p8b_main.p8v_success - bra label_asm_319_afterif -label_asm_320_else - ; source: test_word_gte.p8:2594 cx16.r0L++ - inc cx16.r0L -label_asm_319_afterif - ; source: test_word_gte.p8:2596 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2598 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gte.p8:2600 goto skip9a - bra p8l_skip9a - ; source: test_word_gte.p8:2601 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2602 skip9a: -p8l_skip9a - ; source: test_word_gte.p8:2604 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2605 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2607 goto skip9b - bra p8l_skip9b - ; source: test_word_gte.p8:2608 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2609 skip9b: -p8l_skip9b - ; source: test_word_gte.p8:2611 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_321_afterif - ; source: test_word_gte.p8:2612 success++ - inc p8b_main.p8v_success -label_asm_321_afterif - ; source: test_word_gte.p8:2615 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_323_else - ; source: test_word_gte.p8:2616 success++ - inc p8b_main.p8v_success - bra label_asm_322_afterif -label_asm_323_else - ; source: test_word_gte.p8:2618 cx16.r0L++ - inc cx16.r0L -label_asm_322_afterif - ; source: test_word_gte.p8:2620 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:2622 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_gte.p8:2624 goto skip10a - bra p8l_skip10a - ; source: test_word_gte.p8:2625 lbl10a: fail_word(193) -p8l_lbl10a - ldy #>$c1 - lda #<$c1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2626 skip10a: -p8l_skip10a - ; source: test_word_gte.p8:2628 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2629 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2631 goto skip10b - bra p8l_skip10b - ; source: test_word_gte.p8:2632 lbl10b: fail_word(194) -p8l_lbl10b - ldy #>$c2 - lda #<$c2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2633 skip10b: -p8l_skip10b - ; source: test_word_gte.p8:2635 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_324_afterif - ; source: test_word_gte.p8:2636 fail_word(195) - ldy #>$c3 - lda #<$c3 - jsr p8b_main.p8s_fail_word -label_asm_324_afterif - ; source: test_word_gte.p8:2639 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_326_else - ; source: test_word_gte.p8:2640 fail_word(196) - ldy #>$c4 - lda #<$c4 - jsr p8b_main.p8s_fail_word - bra label_asm_325_afterif -label_asm_326_else - ; source: test_word_gte.p8:2642 success++ - inc p8b_main.p8v_success -label_asm_325_afterif - ; source: test_word_gte.p8:2644 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2646 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gte.p8:2648 goto skip11a - bra p8l_skip11a - ; source: test_word_gte.p8:2649 lbl11a: fail_word(197) -p8l_lbl11a - ldy #>$c5 - lda #<$c5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2650 skip11a: -p8l_skip11a - ; source: test_word_gte.p8:2652 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2653 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2655 goto skip11b - bra p8l_skip11b - ; source: test_word_gte.p8:2656 lbl11b: fail_word(198) -p8l_lbl11b - ldy #>$c6 - lda #<$c6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2657 skip11b: -p8l_skip11b - ; source: test_word_gte.p8:2659 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_327_afterif - ; source: test_word_gte.p8:2660 fail_word(199) - ldy #>$c7 - lda #<$c7 - jsr p8b_main.p8s_fail_word -label_asm_327_afterif - ; source: test_word_gte.p8:2663 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_329_else - ; source: test_word_gte.p8:2664 fail_word(200) - ldy #>$c8 - lda #<$c8 - jsr p8b_main.p8s_fail_word - bra label_asm_328_afterif -label_asm_329_else - ; source: test_word_gte.p8:2666 success++ - inc p8b_main.p8v_success -label_asm_328_afterif - ; source: test_word_gte.p8:2668 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:2670 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gte.p8:2672 goto skip12a - bra p8l_skip12a - ; source: test_word_gte.p8:2673 lbl12a: fail_word(201) -p8l_lbl12a - ldy #>$c9 - lda #<$c9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2674 skip12a: -p8l_skip12a - ; source: test_word_gte.p8:2676 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2677 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2679 goto skip12b - bra p8l_skip12b - ; source: test_word_gte.p8:2680 lbl12b: fail_word(202) -p8l_lbl12b - ldy #>$ca - lda #<$ca - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2681 skip12b: -p8l_skip12b - ; source: test_word_gte.p8:2683 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_330_afterif - ; source: test_word_gte.p8:2684 fail_word(203) - ldy #>$cb - lda #<$cb - jsr p8b_main.p8s_fail_word -label_asm_330_afterif - ; source: test_word_gte.p8:2687 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_332_else - ; source: test_word_gte.p8:2688 fail_word(204) - ldy #>$cc - lda #<$cc - jsr p8b_main.p8s_fail_word - bra label_asm_331_afterif -label_asm_332_else - ; source: test_word_gte.p8:2690 success++ - inc p8b_main.p8v_success -label_asm_331_afterif - ; source: test_word_gte.p8:2692 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:2694 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gte.p8:2696 goto skip13a - bra p8l_skip13a - ; source: test_word_gte.p8:2697 lbl13a: fail_word(205) -p8l_lbl13a - ldy #>$cd - lda #<$cd - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2698 skip13a: -p8l_skip13a - ; source: test_word_gte.p8:2700 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2701 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2703 goto skip13b - bra p8l_skip13b - ; source: test_word_gte.p8:2704 lbl13b: fail_word(206) -p8l_lbl13b - ldy #>$ce - lda #<$ce - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2705 skip13b: -p8l_skip13b - ; source: test_word_gte.p8:2707 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_333_afterif - ; source: test_word_gte.p8:2708 fail_word(207) - ldy #>$cf - lda #<$cf - jsr p8b_main.p8s_fail_word -label_asm_333_afterif - ; source: test_word_gte.p8:2711 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_335_else - ; source: test_word_gte.p8:2712 fail_word(208) - ldy #>$d0 - lda #<$d0 - jsr p8b_main.p8s_fail_word - bra label_asm_334_afterif -label_asm_335_else - ; source: test_word_gte.p8:2714 success++ - inc p8b_main.p8v_success -label_asm_334_afterif - ; source: test_word_gte.p8:2716 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:2718 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gte.p8:2720 goto skip14a - bra p8l_skip14a - ; source: test_word_gte.p8:2721 lbl14a: fail_word(209) -p8l_lbl14a - ldy #>$d1 - lda #<$d1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2722 skip14a: -p8l_skip14a - ; source: test_word_gte.p8:2724 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2725 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2727 goto skip14b - bra p8l_skip14b - ; source: test_word_gte.p8:2728 lbl14b: fail_word(210) -p8l_lbl14b - ldy #>$d2 - lda #<$d2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2729 skip14b: -p8l_skip14b - ; source: test_word_gte.p8:2731 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_336_afterif - ; source: test_word_gte.p8:2732 fail_word(211) - ldy #>$d3 - lda #<$d3 - jsr p8b_main.p8s_fail_word -label_asm_336_afterif - ; source: test_word_gte.p8:2735 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_338_else - ; source: test_word_gte.p8:2736 fail_word(212) - ldy #>$d4 - lda #<$d4 - jsr p8b_main.p8s_fail_word - bra label_asm_337_afterif -label_asm_338_else - ; source: test_word_gte.p8:2738 success++ - inc p8b_main.p8v_success -label_asm_337_afterif - ; source: test_word_gte.p8:2740 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gte.p8:2741 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:2743 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gte.p8:2745 goto skip15a - bra p8l_skip15a - ; source: test_word_gte.p8:2746 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2747 skip15a: -p8l_skip15a - ; source: test_word_gte.p8:2749 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2750 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2752 goto skip15b - bra p8l_skip15b - ; source: test_word_gte.p8:2753 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2754 skip15b: -p8l_skip15b - ; source: test_word_gte.p8:2756 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_339_afterif - ; source: test_word_gte.p8:2757 success++ - inc p8b_main.p8v_success -label_asm_339_afterif - ; source: test_word_gte.p8:2760 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_341_else - ; source: test_word_gte.p8:2761 success++ - inc p8b_main.p8v_success - bra label_asm_340_afterif -label_asm_341_else - ; source: test_word_gte.p8:2763 cx16.r0L++ - inc cx16.r0L -label_asm_340_afterif - ; source: test_word_gte.p8:2765 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2767 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gte.p8:2769 goto skip16a - bra p8l_skip16a - ; source: test_word_gte.p8:2770 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2771 skip16a: -p8l_skip16a - ; source: test_word_gte.p8:2773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2774 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2776 goto skip16b - bra p8l_skip16b - ; source: test_word_gte.p8:2777 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2778 skip16b: -p8l_skip16b - ; source: test_word_gte.p8:2780 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_342_afterif - ; source: test_word_gte.p8:2781 success++ - inc p8b_main.p8v_success -label_asm_342_afterif - ; source: test_word_gte.p8:2784 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_344_else - ; source: test_word_gte.p8:2785 success++ - inc p8b_main.p8v_success - bra label_asm_343_afterif -label_asm_344_else - ; source: test_word_gte.p8:2787 cx16.r0L++ - inc cx16.r0L -label_asm_343_afterif - ; source: test_word_gte.p8:2789 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:2791 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_gte.p8:2793 goto skip17a - bra p8l_skip17a - ; source: test_word_gte.p8:2794 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2795 skip17a: -p8l_skip17a - ; source: test_word_gte.p8:2797 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2798 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2800 goto skip17b - bra p8l_skip17b - ; source: test_word_gte.p8:2801 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2802 skip17b: -p8l_skip17b - ; source: test_word_gte.p8:2804 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_345_afterif - ; source: test_word_gte.p8:2805 success++ - inc p8b_main.p8v_success -label_asm_345_afterif - ; source: test_word_gte.p8:2808 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_347_else - ; source: test_word_gte.p8:2809 success++ - inc p8b_main.p8v_success - bra label_asm_346_afterif -label_asm_347_else - ; source: test_word_gte.p8:2811 cx16.r0L++ - inc cx16.r0L -label_asm_346_afterif - ; source: test_word_gte.p8:2813 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2815 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gte.p8:2817 goto skip18a - bra p8l_skip18a - ; source: test_word_gte.p8:2818 lbl18a: fail_word(213) -p8l_lbl18a - ldy #>$d5 - lda #<$d5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2819 skip18a: -p8l_skip18a - ; source: test_word_gte.p8:2821 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2822 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2824 goto skip18b - bra p8l_skip18b - ; source: test_word_gte.p8:2825 lbl18b: fail_word(214) -p8l_lbl18b - ldy #>$d6 - lda #<$d6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2826 skip18b: -p8l_skip18b - ; source: test_word_gte.p8:2828 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_348_afterif - ; source: test_word_gte.p8:2829 fail_word(215) - ldy #>$d7 - lda #<$d7 - jsr p8b_main.p8s_fail_word -label_asm_348_afterif - ; source: test_word_gte.p8:2832 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_350_else - ; source: test_word_gte.p8:2833 fail_word(216) - ldy #>$d8 - lda #<$d8 - jsr p8b_main.p8s_fail_word - bra label_asm_349_afterif -label_asm_350_else - ; source: test_word_gte.p8:2835 success++ - inc p8b_main.p8v_success -label_asm_349_afterif - ; source: test_word_gte.p8:2837 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:2839 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gte.p8:2841 goto skip19a - bra p8l_skip19a - ; source: test_word_gte.p8:2842 lbl19a: fail_word(217) -p8l_lbl19a - ldy #>$d9 - lda #<$d9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2843 skip19a: -p8l_skip19a - ; source: test_word_gte.p8:2845 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2846 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2848 goto skip19b - bra p8l_skip19b - ; source: test_word_gte.p8:2849 lbl19b: fail_word(218) -p8l_lbl19b - ldy #>$da - lda #<$da - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2850 skip19b: -p8l_skip19b - ; source: test_word_gte.p8:2852 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_351_afterif - ; source: test_word_gte.p8:2853 fail_word(219) - ldy #>$db - lda #<$db - jsr p8b_main.p8s_fail_word -label_asm_351_afterif - ; source: test_word_gte.p8:2856 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_353_else - ; source: test_word_gte.p8:2857 fail_word(220) - ldy #>$dc - lda #<$dc - jsr p8b_main.p8s_fail_word - bra label_asm_352_afterif -label_asm_353_else - ; source: test_word_gte.p8:2859 success++ - inc p8b_main.p8v_success -label_asm_352_afterif - ; source: test_word_gte.p8:2861 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:2863 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gte.p8:2865 goto skip20a - bra p8l_skip20a - ; source: test_word_gte.p8:2866 lbl20a: fail_word(221) -p8l_lbl20a - ldy #>$dd - lda #<$dd - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2867 skip20a: -p8l_skip20a - ; source: test_word_gte.p8:2869 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2870 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2872 goto skip20b - bra p8l_skip20b - ; source: test_word_gte.p8:2873 lbl20b: fail_word(222) -p8l_lbl20b - ldy #>$de - lda #<$de - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2874 skip20b: -p8l_skip20b - ; source: test_word_gte.p8:2876 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_354_afterif - ; source: test_word_gte.p8:2877 fail_word(223) - ldy #>$df - lda #<$df - jsr p8b_main.p8s_fail_word -label_asm_354_afterif - ; source: test_word_gte.p8:2880 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_356_else - ; source: test_word_gte.p8:2881 fail_word(224) - ldy #>$e0 - lda #<$e0 - jsr p8b_main.p8s_fail_word - bra label_asm_355_afterif -label_asm_356_else - ; source: test_word_gte.p8:2883 success++ - inc p8b_main.p8v_success -label_asm_355_afterif - ; source: test_word_gte.p8:2885 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:2887 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gte.p8:2889 goto skip21a - bra p8l_skip21a - ; source: test_word_gte.p8:2890 lbl21a: fail_word(225) -p8l_lbl21a - ldy #>$e1 - lda #<$e1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2891 skip21a: -p8l_skip21a - ; source: test_word_gte.p8:2893 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2894 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2896 goto skip21b - bra p8l_skip21b - ; source: test_word_gte.p8:2897 lbl21b: fail_word(226) -p8l_lbl21b - ldy #>$e2 - lda #<$e2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:2898 skip21b: -p8l_skip21b - ; source: test_word_gte.p8:2900 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_357_afterif - ; source: test_word_gte.p8:2901 fail_word(227) - ldy #>$e3 - lda #<$e3 - jsr p8b_main.p8s_fail_word -label_asm_357_afterif - ; source: test_word_gte.p8:2904 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_359_else - ; source: test_word_gte.p8:2905 fail_word(228) - ldy #>$e4 - lda #<$e4 - jsr p8b_main.p8s_fail_word - bra label_asm_358_afterif -label_asm_359_else - ; source: test_word_gte.p8:2907 success++ - inc p8b_main.p8v_success -label_asm_358_afterif - ; source: test_word_gte.p8:2909 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:2910 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:2912 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gte.p8:2914 goto skip22a - bra p8l_skip22a - ; source: test_word_gte.p8:2915 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2916 skip22a: -p8l_skip22a - ; source: test_word_gte.p8:2918 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2919 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2921 goto skip22b - bra p8l_skip22b - ; source: test_word_gte.p8:2922 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2923 skip22b: -p8l_skip22b - ; source: test_word_gte.p8:2925 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_360_afterif - ; source: test_word_gte.p8:2926 success++ - inc p8b_main.p8v_success -label_asm_360_afterif - ; source: test_word_gte.p8:2929 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_362_else - ; source: test_word_gte.p8:2930 success++ - inc p8b_main.p8v_success - bra label_asm_361_afterif -label_asm_362_else - ; source: test_word_gte.p8:2932 cx16.r0L++ - inc cx16.r0L -label_asm_361_afterif - ; source: test_word_gte.p8:2934 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2936 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gte.p8:2938 goto skip23a - bra p8l_skip23a - ; source: test_word_gte.p8:2939 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2940 skip23a: -p8l_skip23a - ; source: test_word_gte.p8:2942 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2943 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2945 goto skip23b - bra p8l_skip23b - ; source: test_word_gte.p8:2946 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2947 skip23b: -p8l_skip23b - ; source: test_word_gte.p8:2949 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_363_afterif - ; source: test_word_gte.p8:2950 success++ - inc p8b_main.p8v_success -label_asm_363_afterif - ; source: test_word_gte.p8:2953 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_365_else - ; source: test_word_gte.p8:2954 success++ - inc p8b_main.p8v_success - bra label_asm_364_afterif -label_asm_365_else - ; source: test_word_gte.p8:2956 cx16.r0L++ - inc cx16.r0L -label_asm_364_afterif - ; source: test_word_gte.p8:2958 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:2960 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_gte.p8:2962 goto skip24a - bra p8l_skip24a - ; source: test_word_gte.p8:2963 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2964 skip24a: -p8l_skip24a - ; source: test_word_gte.p8:2966 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2967 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2969 goto skip24b - bra p8l_skip24b - ; source: test_word_gte.p8:2970 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2971 skip24b: -p8l_skip24b - ; source: test_word_gte.p8:2973 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_366_afterif - ; source: test_word_gte.p8:2974 success++ - inc p8b_main.p8v_success -label_asm_366_afterif - ; source: test_word_gte.p8:2977 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_368_else - ; source: test_word_gte.p8:2978 success++ - inc p8b_main.p8v_success - bra label_asm_367_afterif -label_asm_368_else - ; source: test_word_gte.p8:2980 cx16.r0L++ - inc cx16.r0L -label_asm_367_afterif - ; source: test_word_gte.p8:2982 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:2984 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gte.p8:2986 goto skip25a - bra p8l_skip25a - ; source: test_word_gte.p8:2987 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2988 skip25a: -p8l_skip25a - ; source: test_word_gte.p8:2990 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:2991 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:2993 goto skip25b - bra p8l_skip25b - ; source: test_word_gte.p8:2994 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:2995 skip25b: -p8l_skip25b - ; source: test_word_gte.p8:2997 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_369_afterif - ; source: test_word_gte.p8:2998 success++ - inc p8b_main.p8v_success -label_asm_369_afterif - ; source: test_word_gte.p8:3001 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_371_else - ; source: test_word_gte.p8:3002 success++ - inc p8b_main.p8v_success - bra label_asm_370_afterif -label_asm_371_else - ; source: test_word_gte.p8:3004 cx16.r0L++ - inc cx16.r0L -label_asm_370_afterif - ; source: test_word_gte.p8:3006 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:3008 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gte.p8:3010 goto skip26a - bra p8l_skip26a - ; source: test_word_gte.p8:3011 lbl26a: fail_word(229) -p8l_lbl26a - ldy #>$e5 - lda #<$e5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3012 skip26a: -p8l_skip26a - ; source: test_word_gte.p8:3014 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3015 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3017 goto skip26b - bra p8l_skip26b - ; source: test_word_gte.p8:3018 lbl26b: fail_word(230) -p8l_lbl26b - ldy #>$e6 - lda #<$e6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3019 skip26b: -p8l_skip26b - ; source: test_word_gte.p8:3021 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_372_afterif - ; source: test_word_gte.p8:3022 fail_word(231) - ldy #>$e7 - lda #<$e7 - jsr p8b_main.p8s_fail_word -label_asm_372_afterif - ; source: test_word_gte.p8:3025 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_374_else - ; source: test_word_gte.p8:3026 fail_word(232) - ldy #>$e8 - lda #<$e8 - jsr p8b_main.p8s_fail_word - bra label_asm_373_afterif -label_asm_374_else - ; source: test_word_gte.p8:3028 success++ - inc p8b_main.p8v_success -label_asm_373_afterif - ; source: test_word_gte.p8:3030 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:3032 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gte.p8:3034 goto skip27a - bra p8l_skip27a - ; source: test_word_gte.p8:3035 lbl27a: fail_word(233) -p8l_lbl27a - ldy #>$e9 - lda #<$e9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3036 skip27a: -p8l_skip27a - ; source: test_word_gte.p8:3038 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3039 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3041 goto skip27b - bra p8l_skip27b - ; source: test_word_gte.p8:3042 lbl27b: fail_word(234) -p8l_lbl27b - ldy #>$ea - lda #<$ea - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3043 skip27b: -p8l_skip27b - ; source: test_word_gte.p8:3045 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_375_afterif - ; source: test_word_gte.p8:3046 fail_word(235) - ldy #>$eb - lda #<$eb - jsr p8b_main.p8s_fail_word -label_asm_375_afterif - ; source: test_word_gte.p8:3049 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_377_else - ; source: test_word_gte.p8:3050 fail_word(236) - ldy #>$ec - lda #<$ec - jsr p8b_main.p8s_fail_word - bra label_asm_376_afterif -label_asm_377_else - ; source: test_word_gte.p8:3052 success++ - inc p8b_main.p8v_success -label_asm_376_afterif - ; source: test_word_gte.p8:3054 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:3056 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gte.p8:3058 goto skip28a - bra p8l_skip28a - ; source: test_word_gte.p8:3059 lbl28a: fail_word(237) -p8l_lbl28a - ldy #>$ed - lda #<$ed - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3060 skip28a: -p8l_skip28a - ; source: test_word_gte.p8:3062 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3063 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3065 goto skip28b - bra p8l_skip28b - ; source: test_word_gte.p8:3066 lbl28b: fail_word(238) -p8l_lbl28b - ldy #>$ee - lda #<$ee - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3067 skip28b: -p8l_skip28b - ; source: test_word_gte.p8:3069 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_378_afterif - ; source: test_word_gte.p8:3070 fail_word(239) - ldy #>$ef - lda #<$ef - jsr p8b_main.p8s_fail_word -label_asm_378_afterif - ; source: test_word_gte.p8:3073 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_380_else - ; source: test_word_gte.p8:3074 fail_word(240) - ldy #>$f0 - lda #<$f0 - jsr p8b_main.p8s_fail_word - bra label_asm_379_afterif -label_asm_380_else - ; source: test_word_gte.p8:3076 success++ - inc p8b_main.p8v_success -label_asm_379_afterif - ; source: test_word_gte.p8:3078 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:3079 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:3081 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gte.p8:3083 goto skip29a - bra p8l_skip29a - ; source: test_word_gte.p8:3084 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3085 skip29a: -p8l_skip29a - ; source: test_word_gte.p8:3087 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3088 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3090 goto skip29b - bra p8l_skip29b - ; source: test_word_gte.p8:3091 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3092 skip29b: -p8l_skip29b - ; source: test_word_gte.p8:3094 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_381_afterif - ; source: test_word_gte.p8:3095 success++ - inc p8b_main.p8v_success -label_asm_381_afterif - ; source: test_word_gte.p8:3098 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_383_else - ; source: test_word_gte.p8:3099 success++ - inc p8b_main.p8v_success - bra label_asm_382_afterif -label_asm_383_else - ; source: test_word_gte.p8:3101 cx16.r0L++ - inc cx16.r0L -label_asm_382_afterif - ; source: test_word_gte.p8:3103 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:3105 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gte.p8:3107 goto skip30a - bra p8l_skip30a - ; source: test_word_gte.p8:3108 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3109 skip30a: -p8l_skip30a - ; source: test_word_gte.p8:3111 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3112 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3114 goto skip30b - bra p8l_skip30b - ; source: test_word_gte.p8:3115 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3116 skip30b: -p8l_skip30b - ; source: test_word_gte.p8:3118 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_384_afterif - ; source: test_word_gte.p8:3119 success++ - inc p8b_main.p8v_success -label_asm_384_afterif - ; source: test_word_gte.p8:3122 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_386_else - ; source: test_word_gte.p8:3123 success++ - inc p8b_main.p8v_success - bra label_asm_385_afterif -label_asm_386_else - ; source: test_word_gte.p8:3125 cx16.r0L++ - inc cx16.r0L -label_asm_385_afterif - ; source: test_word_gte.p8:3127 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:3129 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_gte.p8:3131 goto skip31a - bra p8l_skip31a - ; source: test_word_gte.p8:3132 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3133 skip31a: -p8l_skip31a - ; source: test_word_gte.p8:3135 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3136 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3138 goto skip31b - bra p8l_skip31b - ; source: test_word_gte.p8:3139 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3140 skip31b: -p8l_skip31b - ; source: test_word_gte.p8:3142 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_387_afterif - ; source: test_word_gte.p8:3143 success++ - inc p8b_main.p8v_success -label_asm_387_afterif - ; source: test_word_gte.p8:3146 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_389_else - ; source: test_word_gte.p8:3147 success++ - inc p8b_main.p8v_success - bra label_asm_388_afterif -label_asm_389_else - ; source: test_word_gte.p8:3149 cx16.r0L++ - inc cx16.r0L -label_asm_388_afterif - ; source: test_word_gte.p8:3151 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:3153 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gte.p8:3155 goto skip32a - bra p8l_skip32a - ; source: test_word_gte.p8:3156 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3157 skip32a: -p8l_skip32a - ; source: test_word_gte.p8:3159 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3160 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3162 goto skip32b - bra p8l_skip32b - ; source: test_word_gte.p8:3163 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3164 skip32b: -p8l_skip32b - ; source: test_word_gte.p8:3166 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_390_afterif - ; source: test_word_gte.p8:3167 success++ - inc p8b_main.p8v_success -label_asm_390_afterif - ; source: test_word_gte.p8:3170 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_392_else - ; source: test_word_gte.p8:3171 success++ - inc p8b_main.p8v_success - bra label_asm_391_afterif -label_asm_392_else - ; source: test_word_gte.p8:3173 cx16.r0L++ - inc cx16.r0L -label_asm_391_afterif - ; source: test_word_gte.p8:3175 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:3177 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gte.p8:3179 goto skip33a - bra p8l_skip33a - ; source: test_word_gte.p8:3180 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3181 skip33a: -p8l_skip33a - ; source: test_word_gte.p8:3183 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3184 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3186 goto skip33b - bra p8l_skip33b - ; source: test_word_gte.p8:3187 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3188 skip33b: -p8l_skip33b - ; source: test_word_gte.p8:3190 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_393_afterif - ; source: test_word_gte.p8:3191 success++ - inc p8b_main.p8v_success -label_asm_393_afterif - ; source: test_word_gte.p8:3194 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_395_else - ; source: test_word_gte.p8:3195 success++ - inc p8b_main.p8v_success - bra label_asm_394_afterif -label_asm_395_else - ; source: test_word_gte.p8:3197 cx16.r0L++ - inc cx16.r0L -label_asm_394_afterif - ; source: test_word_gte.p8:3199 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:3201 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gte.p8:3203 goto skip34a - bra p8l_skip34a - ; source: test_word_gte.p8:3204 lbl34a: fail_word(241) -p8l_lbl34a - ldy #>$f1 - lda #<$f1 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3205 skip34a: -p8l_skip34a - ; source: test_word_gte.p8:3207 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3208 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3210 goto skip34b - bra p8l_skip34b - ; source: test_word_gte.p8:3211 lbl34b: fail_word(242) -p8l_lbl34b - ldy #>$f2 - lda #<$f2 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3212 skip34b: -p8l_skip34b - ; source: test_word_gte.p8:3214 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_396_afterif - ; source: test_word_gte.p8:3215 fail_word(243) - ldy #>$f3 - lda #<$f3 - jsr p8b_main.p8s_fail_word -label_asm_396_afterif - ; source: test_word_gte.p8:3218 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_398_else - ; source: test_word_gte.p8:3219 fail_word(244) - ldy #>$f4 - lda #<$f4 - jsr p8b_main.p8s_fail_word - bra label_asm_397_afterif -label_asm_398_else - ; source: test_word_gte.p8:3221 success++ - inc p8b_main.p8v_success -label_asm_397_afterif - ; source: test_word_gte.p8:3223 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:3225 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gte.p8:3227 goto skip35a - bra p8l_skip35a - ; source: test_word_gte.p8:3228 lbl35a: fail_word(245) -p8l_lbl35a - ldy #>$f5 - lda #<$f5 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3229 skip35a: -p8l_skip35a - ; source: test_word_gte.p8:3231 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3232 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3234 goto skip35b - bra p8l_skip35b - ; source: test_word_gte.p8:3235 lbl35b: fail_word(246) -p8l_lbl35b - ldy #>$f6 - lda #<$f6 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3236 skip35b: -p8l_skip35b - ; source: test_word_gte.p8:3238 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_399_afterif - ; source: test_word_gte.p8:3239 fail_word(247) - ldy #>$f7 - lda #<$f7 - jsr p8b_main.p8s_fail_word -label_asm_399_afterif - ; source: test_word_gte.p8:3242 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_401_else - ; source: test_word_gte.p8:3243 fail_word(248) - ldy #>$f8 - lda #<$f8 - jsr p8b_main.p8s_fail_word - bra label_asm_400_afterif -label_asm_401_else - ; source: test_word_gte.p8:3245 success++ - inc p8b_main.p8v_success -label_asm_400_afterif - ; source: test_word_gte.p8:3247 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:3248 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:3250 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gte.p8:3252 goto skip36a - bra p8l_skip36a - ; source: test_word_gte.p8:3253 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3254 skip36a: -p8l_skip36a - ; source: test_word_gte.p8:3256 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3257 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3259 goto skip36b - bra p8l_skip36b - ; source: test_word_gte.p8:3260 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3261 skip36b: -p8l_skip36b - ; source: test_word_gte.p8:3263 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_402_afterif - ; source: test_word_gte.p8:3264 success++ - inc p8b_main.p8v_success -label_asm_402_afterif - ; source: test_word_gte.p8:3267 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_404_else - ; source: test_word_gte.p8:3268 success++ - inc p8b_main.p8v_success - bra label_asm_403_afterif -label_asm_404_else - ; source: test_word_gte.p8:3270 cx16.r0L++ - inc cx16.r0L -label_asm_403_afterif - ; source: test_word_gte.p8:3272 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:3274 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gte.p8:3276 goto skip37a - bra p8l_skip37a - ; source: test_word_gte.p8:3277 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3278 skip37a: -p8l_skip37a - ; source: test_word_gte.p8:3280 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3281 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3283 goto skip37b - bra p8l_skip37b - ; source: test_word_gte.p8:3284 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3285 skip37b: -p8l_skip37b - ; source: test_word_gte.p8:3287 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_405_afterif - ; source: test_word_gte.p8:3288 success++ - inc p8b_main.p8v_success -label_asm_405_afterif - ; source: test_word_gte.p8:3291 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_407_else - ; source: test_word_gte.p8:3292 success++ - inc p8b_main.p8v_success - bra label_asm_406_afterif -label_asm_407_else - ; source: test_word_gte.p8:3294 cx16.r0L++ - inc cx16.r0L -label_asm_406_afterif - ; source: test_word_gte.p8:3296 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:3298 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_gte.p8:3300 goto skip38a - bra p8l_skip38a - ; source: test_word_gte.p8:3301 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3302 skip38a: -p8l_skip38a - ; source: test_word_gte.p8:3304 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3305 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3307 goto skip38b - bra p8l_skip38b - ; source: test_word_gte.p8:3308 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3309 skip38b: -p8l_skip38b - ; source: test_word_gte.p8:3311 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_408_afterif - ; source: test_word_gte.p8:3312 success++ - inc p8b_main.p8v_success -label_asm_408_afterif - ; source: test_word_gte.p8:3315 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_410_else - ; source: test_word_gte.p8:3316 success++ - inc p8b_main.p8v_success - bra label_asm_409_afterif -label_asm_410_else - ; source: test_word_gte.p8:3318 cx16.r0L++ - inc cx16.r0L -label_asm_409_afterif - ; source: test_word_gte.p8:3320 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:3322 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gte.p8:3324 goto skip39a - bra p8l_skip39a - ; source: test_word_gte.p8:3325 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3326 skip39a: -p8l_skip39a - ; source: test_word_gte.p8:3328 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3329 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3331 goto skip39b - bra p8l_skip39b - ; source: test_word_gte.p8:3332 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3333 skip39b: -p8l_skip39b - ; source: test_word_gte.p8:3335 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_411_afterif - ; source: test_word_gte.p8:3336 success++ - inc p8b_main.p8v_success -label_asm_411_afterif - ; source: test_word_gte.p8:3339 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_413_else - ; source: test_word_gte.p8:3340 success++ - inc p8b_main.p8v_success - bra label_asm_412_afterif -label_asm_413_else - ; source: test_word_gte.p8:3342 cx16.r0L++ - inc cx16.r0L -label_asm_412_afterif - ; source: test_word_gte.p8:3344 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:3346 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gte.p8:3348 goto skip40a - bra p8l_skip40a - ; source: test_word_gte.p8:3349 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3350 skip40a: -p8l_skip40a - ; source: test_word_gte.p8:3352 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3353 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3355 goto skip40b - bra p8l_skip40b - ; source: test_word_gte.p8:3356 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3357 skip40b: -p8l_skip40b - ; source: test_word_gte.p8:3359 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_414_afterif - ; source: test_word_gte.p8:3360 success++ - inc p8b_main.p8v_success -label_asm_414_afterif - ; source: test_word_gte.p8:3363 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_416_else - ; source: test_word_gte.p8:3364 success++ - inc p8b_main.p8v_success - bra label_asm_415_afterif -label_asm_416_else - ; source: test_word_gte.p8:3366 cx16.r0L++ - inc cx16.r0L -label_asm_415_afterif - ; source: test_word_gte.p8:3368 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:3370 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gte.p8:3372 goto skip41a - bra p8l_skip41a - ; source: test_word_gte.p8:3373 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3374 skip41a: -p8l_skip41a - ; source: test_word_gte.p8:3376 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3377 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3379 goto skip41b - bra p8l_skip41b - ; source: test_word_gte.p8:3380 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3381 skip41b: -p8l_skip41b - ; source: test_word_gte.p8:3383 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_417_afterif - ; source: test_word_gte.p8:3384 success++ - inc p8b_main.p8v_success -label_asm_417_afterif - ; source: test_word_gte.p8:3387 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_419_else - ; source: test_word_gte.p8:3388 success++ - inc p8b_main.p8v_success - bra label_asm_418_afterif -label_asm_419_else - ; source: test_word_gte.p8:3390 cx16.r0L++ - inc cx16.r0L -label_asm_418_afterif - ; source: test_word_gte.p8:3392 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:3394 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gte.p8:3396 goto skip42a - bra p8l_skip42a - ; source: test_word_gte.p8:3397 lbl42a: fail_word(249) -p8l_lbl42a - ldy #>$f9 - lda #<$f9 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3398 skip42a: -p8l_skip42a - ; source: test_word_gte.p8:3400 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3401 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3403 goto skip42b - bra p8l_skip42b - ; source: test_word_gte.p8:3404 lbl42b: fail_word(250) -p8l_lbl42b - ldy #>$fa - lda #<$fa - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3405 skip42b: -p8l_skip42b - ; source: test_word_gte.p8:3407 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_420_afterif - ; source: test_word_gte.p8:3408 fail_word(251) - ldy #>$fb - lda #<$fb - jsr p8b_main.p8s_fail_word -label_asm_420_afterif - ; source: test_word_gte.p8:3411 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_422_else - ; source: test_word_gte.p8:3412 fail_word(252) - ldy #>$fc - lda #<$fc - jsr p8b_main.p8s_fail_word - bra label_asm_421_afterif -label_asm_422_else - ; source: test_word_gte.p8:3414 success++ - inc p8b_main.p8v_success -label_asm_421_afterif - ; source: test_word_gte.p8:3416 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:3417 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_gte.p8:3419 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gte.p8:3421 goto skip43a - bra p8l_skip43a - ; source: test_word_gte.p8:3422 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3423 skip43a: -p8l_skip43a - ; source: test_word_gte.p8:3425 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3426 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3428 goto skip43b - bra p8l_skip43b - ; source: test_word_gte.p8:3429 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3430 skip43b: -p8l_skip43b - ; source: test_word_gte.p8:3432 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_423_afterif - ; source: test_word_gte.p8:3433 success++ - inc p8b_main.p8v_success -label_asm_423_afterif - ; source: test_word_gte.p8:3436 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_425_else - ; source: test_word_gte.p8:3437 success++ - inc p8b_main.p8v_success - bra label_asm_424_afterif -label_asm_425_else - ; source: test_word_gte.p8:3439 cx16.r0L++ - inc cx16.r0L -label_asm_424_afterif - ; source: test_word_gte.p8:3441 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_gte.p8:3443 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gte.p8:3445 goto skip44a - bra p8l_skip44a - ; source: test_word_gte.p8:3446 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3447 skip44a: -p8l_skip44a - ; source: test_word_gte.p8:3449 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3450 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3452 goto skip44b - bra p8l_skip44b - ; source: test_word_gte.p8:3453 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3454 skip44b: -p8l_skip44b - ; source: test_word_gte.p8:3456 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_426_afterif - ; source: test_word_gte.p8:3457 success++ - inc p8b_main.p8v_success -label_asm_426_afterif - ; source: test_word_gte.p8:3460 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_428_else - ; source: test_word_gte.p8:3461 success++ - inc p8b_main.p8v_success - bra label_asm_427_afterif -label_asm_428_else - ; source: test_word_gte.p8:3463 cx16.r0L++ - inc cx16.r0L -label_asm_427_afterif - ; source: test_word_gte.p8:3465 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_gte.p8:3467 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_gte.p8:3469 goto skip45a - bra p8l_skip45a - ; source: test_word_gte.p8:3470 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3471 skip45a: -p8l_skip45a - ; source: test_word_gte.p8:3473 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3474 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3476 goto skip45b - bra p8l_skip45b - ; source: test_word_gte.p8:3477 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3478 skip45b: -p8l_skip45b - ; source: test_word_gte.p8:3480 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_429_afterif - ; source: test_word_gte.p8:3481 success++ - inc p8b_main.p8v_success -label_asm_429_afterif - ; source: test_word_gte.p8:3484 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_431_else - ; source: test_word_gte.p8:3485 success++ - inc p8b_main.p8v_success - bra label_asm_430_afterif -label_asm_431_else - ; source: test_word_gte.p8:3487 cx16.r0L++ - inc cx16.r0L -label_asm_430_afterif - ; source: test_word_gte.p8:3489 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_gte.p8:3491 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gte.p8:3493 goto skip46a - bra p8l_skip46a - ; source: test_word_gte.p8:3494 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3495 skip46a: -p8l_skip46a - ; source: test_word_gte.p8:3497 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3498 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3500 goto skip46b - bra p8l_skip46b - ; source: test_word_gte.p8:3501 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3502 skip46b: -p8l_skip46b - ; source: test_word_gte.p8:3504 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_432_afterif - ; source: test_word_gte.p8:3505 success++ - inc p8b_main.p8v_success -label_asm_432_afterif - ; source: test_word_gte.p8:3508 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_434_else - ; source: test_word_gte.p8:3509 success++ - inc p8b_main.p8v_success - bra label_asm_433_afterif -label_asm_434_else - ; source: test_word_gte.p8:3511 cx16.r0L++ - inc cx16.r0L -label_asm_433_afterif - ; source: test_word_gte.p8:3513 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_gte.p8:3515 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gte.p8:3517 goto skip47a - bra p8l_skip47a - ; source: test_word_gte.p8:3518 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3519 skip47a: -p8l_skip47a - ; source: test_word_gte.p8:3521 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3522 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3524 goto skip47b - bra p8l_skip47b - ; source: test_word_gte.p8:3525 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3526 skip47b: -p8l_skip47b - ; source: test_word_gte.p8:3528 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_435_afterif - ; source: test_word_gte.p8:3529 success++ - inc p8b_main.p8v_success -label_asm_435_afterif - ; source: test_word_gte.p8:3532 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_437_else - ; source: test_word_gte.p8:3533 success++ - inc p8b_main.p8v_success - bra label_asm_436_afterif -label_asm_437_else - ; source: test_word_gte.p8:3535 cx16.r0L++ - inc cx16.r0L -label_asm_436_afterif - ; source: test_word_gte.p8:3537 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_gte.p8:3539 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gte.p8:3541 goto skip48a - bra p8l_skip48a - ; source: test_word_gte.p8:3542 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3543 skip48a: -p8l_skip48a - ; source: test_word_gte.p8:3545 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3546 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3548 goto skip48b - bra p8l_skip48b - ; source: test_word_gte.p8:3549 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3550 skip48b: -p8l_skip48b - ; source: test_word_gte.p8:3552 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_438_afterif - ; source: test_word_gte.p8:3553 success++ - inc p8b_main.p8v_success -label_asm_438_afterif - ; source: test_word_gte.p8:3556 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_440_else - ; source: test_word_gte.p8:3557 success++ - inc p8b_main.p8v_success - bra label_asm_439_afterif -label_asm_440_else - ; source: test_word_gte.p8:3559 cx16.r0L++ - inc cx16.r0L -label_asm_439_afterif - ; source: test_word_gte.p8:3561 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_gte.p8:3563 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gte.p8:3565 goto skip49a - bra p8l_skip49a - ; source: test_word_gte.p8:3566 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3567 skip49a: -p8l_skip49a - ; source: test_word_gte.p8:3569 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3570 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3572 goto skip49b - bra p8l_skip49b - ; source: test_word_gte.p8:3573 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3574 skip49b: -p8l_skip49b - ; source: test_word_gte.p8:3576 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_441_afterif - ; source: test_word_gte.p8:3577 success++ - inc p8b_main.p8v_success -label_asm_441_afterif - ; source: test_word_gte.p8:3580 if x>=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_443_else - ; source: test_word_gte.p8:3581 success++ - inc p8b_main.p8v_success - bra label_asm_442_afterif -label_asm_443_else - ; source: test_word_gte.p8:3583 cx16.r0L++ - inc cx16.r0L -label_asm_442_afterif - ; source: test_word_gte.p8:3585 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_gte.p8:2398 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -p8v_values .sint $0000, $0000 - .pend - ; source: test_word_gte.p8:3587 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_word_gte.p8:3588 word @shared x - ; source: test_word_gte.p8:3591 float @shared f4 = 1.0 - ; source: test_word_gte.p8:3592 float @shared f5 = 1.0 - ; source: test_word_gte.p8:3588 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_gte.p8:3589 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_gte.p8:3590 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_gte.p8:3591 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_word_gte.p8:3592 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_word_gte.p8:3593 success = 0 - stz p8b_main.p8v_success - ; source: test_word_gte.p8:3594 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:3596 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_gte.p8:3598 goto skip1a - bra p8l_skip1a - ; source: test_word_gte.p8:3599 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3600 skip1a: -p8l_skip1a - ; source: test_word_gte.p8:3602 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3603 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3605 goto skip1b - bra p8l_skip1b - ; source: test_word_gte.p8:3606 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3607 skip1b: -p8l_skip1b - ; source: test_word_gte.p8:3609 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_444_afterif - ; source: test_word_gte.p8:3610 success++ - inc p8b_main.p8v_success -label_asm_444_afterif - ; source: test_word_gte.p8:3613 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_446_else - ; source: test_word_gte.p8:3614 success++ - inc p8b_main.p8v_success - bra label_asm_445_afterif -label_asm_446_else - ; source: test_word_gte.p8:3616 cx16.r0L++ - inc cx16.r0L -label_asm_445_afterif - ; source: test_word_gte.p8:3619 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_gte.p8:3621 goto skip2a - bra p8l_skip2a - ; source: test_word_gte.p8:3622 lbl2a: fail_word(253) -p8l_lbl2a - ldy #>$fd - lda #<$fd - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3623 skip2a: -p8l_skip2a - ; source: test_word_gte.p8:3625 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3626 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3628 goto skip2b - bra p8l_skip2b - ; source: test_word_gte.p8:3629 lbl2b: fail_word(254) -p8l_lbl2b - ldy #>$fe - lda #<$fe - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3630 skip2b: -p8l_skip2b - ; source: test_word_gte.p8:3632 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_447_afterif - ; source: test_word_gte.p8:3633 fail_word(255) - ldy #>$ff - lda #<$ff - jsr p8b_main.p8s_fail_word -label_asm_447_afterif - ; source: test_word_gte.p8:3636 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_449_else - ; source: test_word_gte.p8:3637 fail_word(256) - ldy #>$0100 - lda #<$0100 - jsr p8b_main.p8s_fail_word - bra label_asm_448_afterif -label_asm_449_else - ; source: test_word_gte.p8:3639 success++ - inc p8b_main.p8v_success -label_asm_448_afterif - ; source: test_word_gte.p8:3642 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_gte.p8:3644 goto skip3a - bra p8l_skip3a - ; source: test_word_gte.p8:3645 lbl3a: fail_word(257) -p8l_lbl3a - ldy #>$0101 - lda #<$0101 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3646 skip3a: -p8l_skip3a - ; source: test_word_gte.p8:3648 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3649 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3651 goto skip3b - bra p8l_skip3b - ; source: test_word_gte.p8:3652 lbl3b: fail_word(258) -p8l_lbl3b - ldy #>$0102 - lda #<$0102 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3653 skip3b: -p8l_skip3b - ; source: test_word_gte.p8:3655 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_450_afterif - ; source: test_word_gte.p8:3656 fail_word(259) - ldy #>$0103 - lda #<$0103 - jsr p8b_main.p8s_fail_word -label_asm_450_afterif - ; source: test_word_gte.p8:3659 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_452_else - ; source: test_word_gte.p8:3660 fail_word(260) - ldy #>$0104 - lda #<$0104 - jsr p8b_main.p8s_fail_word - bra label_asm_451_afterif -label_asm_452_else - ; source: test_word_gte.p8:3662 success++ - inc p8b_main.p8v_success -label_asm_451_afterif - ; source: test_word_gte.p8:3665 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_gte.p8:3667 goto skip4a - bra p8l_skip4a - ; source: test_word_gte.p8:3668 lbl4a: fail_word(261) -p8l_lbl4a - ldy #>$0105 - lda #<$0105 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3669 skip4a: -p8l_skip4a - ; source: test_word_gte.p8:3671 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3672 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3674 goto skip4b - bra p8l_skip4b - ; source: test_word_gte.p8:3675 lbl4b: fail_word(262) -p8l_lbl4b - ldy #>$0106 - lda #<$0106 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3676 skip4b: -p8l_skip4b - ; source: test_word_gte.p8:3678 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_453_afterif - ; source: test_word_gte.p8:3679 fail_word(263) - ldy #>$0107 - lda #<$0107 - jsr p8b_main.p8s_fail_word -label_asm_453_afterif - ; source: test_word_gte.p8:3682 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_455_else - ; source: test_word_gte.p8:3683 fail_word(264) - ldy #>$0108 - lda #<$0108 - jsr p8b_main.p8s_fail_word - bra label_asm_454_afterif -label_asm_455_else - ; source: test_word_gte.p8:3685 success++ - inc p8b_main.p8v_success -label_asm_454_afterif - ; source: test_word_gte.p8:3688 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_gte.p8:3690 goto skip5a - bra p8l_skip5a - ; source: test_word_gte.p8:3691 lbl5a: fail_word(265) -p8l_lbl5a - ldy #>$0109 - lda #<$0109 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3692 skip5a: -p8l_skip5a - ; source: test_word_gte.p8:3694 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3695 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3697 goto skip5b - bra p8l_skip5b - ; source: test_word_gte.p8:3698 lbl5b: fail_word(266) -p8l_lbl5b - ldy #>$010a - lda #<$010a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3699 skip5b: -p8l_skip5b - ; source: test_word_gte.p8:3701 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_456_afterif - ; source: test_word_gte.p8:3702 fail_word(267) - ldy #>$010b - lda #<$010b - jsr p8b_main.p8s_fail_word -label_asm_456_afterif - ; source: test_word_gte.p8:3705 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_458_else - ; source: test_word_gte.p8:3706 fail_word(268) - ldy #>$010c - lda #<$010c - jsr p8b_main.p8s_fail_word - bra label_asm_457_afterif -label_asm_458_else - ; source: test_word_gte.p8:3708 success++ - inc p8b_main.p8v_success -label_asm_457_afterif - ; source: test_word_gte.p8:3711 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_gte.p8:3713 goto skip6a - bra p8l_skip6a - ; source: test_word_gte.p8:3714 lbl6a: fail_word(269) -p8l_lbl6a - ldy #>$010d - lda #<$010d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3715 skip6a: -p8l_skip6a - ; source: test_word_gte.p8:3717 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3718 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3720 goto skip6b - bra p8l_skip6b - ; source: test_word_gte.p8:3721 lbl6b: fail_word(270) -p8l_lbl6b - ldy #>$010e - lda #<$010e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3722 skip6b: -p8l_skip6b - ; source: test_word_gte.p8:3724 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_459_afterif - ; source: test_word_gte.p8:3725 fail_word(271) - ldy #>$010f - lda #<$010f - jsr p8b_main.p8s_fail_word -label_asm_459_afterif - ; source: test_word_gte.p8:3728 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_461_else - ; source: test_word_gte.p8:3729 fail_word(272) - ldy #>$0110 - lda #<$0110 - jsr p8b_main.p8s_fail_word - bra label_asm_460_afterif -label_asm_461_else - ; source: test_word_gte.p8:3731 success++ - inc p8b_main.p8v_success -label_asm_460_afterif - ; source: test_word_gte.p8:3734 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_gte.p8:3736 goto skip7a - bra p8l_skip7a - ; source: test_word_gte.p8:3737 lbl7a: fail_word(273) -p8l_lbl7a - ldy #>$0111 - lda #<$0111 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3738 skip7a: -p8l_skip7a - ; source: test_word_gte.p8:3740 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3741 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3743 goto skip7b - bra p8l_skip7b - ; source: test_word_gte.p8:3744 lbl7b: fail_word(274) -p8l_lbl7b - ldy #>$0112 - lda #<$0112 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3745 skip7b: -p8l_skip7b - ; source: test_word_gte.p8:3747 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_462_afterif - ; source: test_word_gte.p8:3748 fail_word(275) - ldy #>$0113 - lda #<$0113 - jsr p8b_main.p8s_fail_word -label_asm_462_afterif - ; source: test_word_gte.p8:3751 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_464_else - ; source: test_word_gte.p8:3752 fail_word(276) - ldy #>$0114 - lda #<$0114 - jsr p8b_main.p8s_fail_word - bra label_asm_463_afterif -label_asm_464_else - ; source: test_word_gte.p8:3754 success++ - inc p8b_main.p8v_success -label_asm_463_afterif - ; source: test_word_gte.p8:3756 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:3758 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_gte.p8:3760 goto skip8a - bra p8l_skip8a - ; source: test_word_gte.p8:3761 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3762 skip8a: -p8l_skip8a - ; source: test_word_gte.p8:3764 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3765 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3767 goto skip8b - bra p8l_skip8b - ; source: test_word_gte.p8:3768 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3769 skip8b: -p8l_skip8b - ; source: test_word_gte.p8:3771 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_465_afterif - ; source: test_word_gte.p8:3772 success++ - inc p8b_main.p8v_success -label_asm_465_afterif - ; source: test_word_gte.p8:3775 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_467_else - ; source: test_word_gte.p8:3776 success++ - inc p8b_main.p8v_success - bra label_asm_466_afterif -label_asm_467_else - ; source: test_word_gte.p8:3778 cx16.r0L++ - inc cx16.r0L -label_asm_466_afterif - ; source: test_word_gte.p8:3781 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_gte.p8:3783 goto skip9a - bra p8l_skip9a - ; source: test_word_gte.p8:3784 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3785 skip9a: -p8l_skip9a - ; source: test_word_gte.p8:3787 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3788 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3790 goto skip9b - bra p8l_skip9b - ; source: test_word_gte.p8:3791 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3792 skip9b: -p8l_skip9b - ; source: test_word_gte.p8:3794 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_468_afterif - ; source: test_word_gte.p8:3795 success++ - inc p8b_main.p8v_success -label_asm_468_afterif - ; source: test_word_gte.p8:3798 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_470_else - ; source: test_word_gte.p8:3799 success++ - inc p8b_main.p8v_success - bra label_asm_469_afterif -label_asm_470_else - ; source: test_word_gte.p8:3801 cx16.r0L++ - inc cx16.r0L -label_asm_469_afterif - ; source: test_word_gte.p8:3804 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_gte.p8:3806 goto skip10a - bra p8l_skip10a - ; source: test_word_gte.p8:3807 lbl10a: fail_word(277) -p8l_lbl10a - ldy #>$0115 - lda #<$0115 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3808 skip10a: -p8l_skip10a - ; source: test_word_gte.p8:3810 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3811 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3813 goto skip10b - bra p8l_skip10b - ; source: test_word_gte.p8:3814 lbl10b: fail_word(278) -p8l_lbl10b - ldy #>$0116 - lda #<$0116 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3815 skip10b: -p8l_skip10b - ; source: test_word_gte.p8:3817 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_471_afterif - ; source: test_word_gte.p8:3818 fail_word(279) - ldy #>$0117 - lda #<$0117 - jsr p8b_main.p8s_fail_word -label_asm_471_afterif - ; source: test_word_gte.p8:3821 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_473_else - ; source: test_word_gte.p8:3822 fail_word(280) - ldy #>$0118 - lda #<$0118 - jsr p8b_main.p8s_fail_word - bra label_asm_472_afterif -label_asm_473_else - ; source: test_word_gte.p8:3824 success++ - inc p8b_main.p8v_success -label_asm_472_afterif - ; source: test_word_gte.p8:3827 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_gte.p8:3829 goto skip11a - bra p8l_skip11a - ; source: test_word_gte.p8:3830 lbl11a: fail_word(281) -p8l_lbl11a - ldy #>$0119 - lda #<$0119 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3831 skip11a: -p8l_skip11a - ; source: test_word_gte.p8:3833 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3834 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3836 goto skip11b - bra p8l_skip11b - ; source: test_word_gte.p8:3837 lbl11b: fail_word(282) -p8l_lbl11b - ldy #>$011a - lda #<$011a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3838 skip11b: -p8l_skip11b - ; source: test_word_gte.p8:3840 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_474_afterif - ; source: test_word_gte.p8:3841 fail_word(283) - ldy #>$011b - lda #<$011b - jsr p8b_main.p8s_fail_word -label_asm_474_afterif - ; source: test_word_gte.p8:3844 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_476_else - ; source: test_word_gte.p8:3845 fail_word(284) - ldy #>$011c - lda #<$011c - jsr p8b_main.p8s_fail_word - bra label_asm_475_afterif -label_asm_476_else - ; source: test_word_gte.p8:3847 success++ - inc p8b_main.p8v_success -label_asm_475_afterif - ; source: test_word_gte.p8:3850 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_gte.p8:3852 goto skip12a - bra p8l_skip12a - ; source: test_word_gte.p8:3853 lbl12a: fail_word(285) -p8l_lbl12a - ldy #>$011d - lda #<$011d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3854 skip12a: -p8l_skip12a - ; source: test_word_gte.p8:3856 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3857 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3859 goto skip12b - bra p8l_skip12b - ; source: test_word_gte.p8:3860 lbl12b: fail_word(286) -p8l_lbl12b - ldy #>$011e - lda #<$011e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3861 skip12b: -p8l_skip12b - ; source: test_word_gte.p8:3863 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_477_afterif - ; source: test_word_gte.p8:3864 fail_word(287) - ldy #>$011f - lda #<$011f - jsr p8b_main.p8s_fail_word -label_asm_477_afterif - ; source: test_word_gte.p8:3867 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_479_else - ; source: test_word_gte.p8:3868 fail_word(288) - ldy #>$0120 - lda #<$0120 - jsr p8b_main.p8s_fail_word - bra label_asm_478_afterif -label_asm_479_else - ; source: test_word_gte.p8:3870 success++ - inc p8b_main.p8v_success -label_asm_478_afterif - ; source: test_word_gte.p8:3873 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_gte.p8:3875 goto skip13a - bra p8l_skip13a - ; source: test_word_gte.p8:3876 lbl13a: fail_word(289) -p8l_lbl13a - ldy #>$0121 - lda #<$0121 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3877 skip13a: -p8l_skip13a - ; source: test_word_gte.p8:3879 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3880 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3882 goto skip13b - bra p8l_skip13b - ; source: test_word_gte.p8:3883 lbl13b: fail_word(290) -p8l_lbl13b - ldy #>$0122 - lda #<$0122 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3884 skip13b: -p8l_skip13b - ; source: test_word_gte.p8:3886 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_480_afterif - ; source: test_word_gte.p8:3887 fail_word(291) - ldy #>$0123 - lda #<$0123 - jsr p8b_main.p8s_fail_word -label_asm_480_afterif - ; source: test_word_gte.p8:3890 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_482_else - ; source: test_word_gte.p8:3891 fail_word(292) - ldy #>$0124 - lda #<$0124 - jsr p8b_main.p8s_fail_word - bra label_asm_481_afterif -label_asm_482_else - ; source: test_word_gte.p8:3893 success++ - inc p8b_main.p8v_success -label_asm_481_afterif - ; source: test_word_gte.p8:3896 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_gte.p8:3898 goto skip14a - bra p8l_skip14a - ; source: test_word_gte.p8:3899 lbl14a: fail_word(293) -p8l_lbl14a - ldy #>$0125 - lda #<$0125 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3900 skip14a: -p8l_skip14a - ; source: test_word_gte.p8:3902 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3903 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3905 goto skip14b - bra p8l_skip14b - ; source: test_word_gte.p8:3906 lbl14b: fail_word(294) -p8l_lbl14b - ldy #>$0126 - lda #<$0126 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3907 skip14b: -p8l_skip14b - ; source: test_word_gte.p8:3909 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_483_afterif - ; source: test_word_gte.p8:3910 fail_word(295) - ldy #>$0127 - lda #<$0127 - jsr p8b_main.p8s_fail_word -label_asm_483_afterif - ; source: test_word_gte.p8:3913 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_485_else - ; source: test_word_gte.p8:3914 fail_word(296) - ldy #>$0128 - lda #<$0128 - jsr p8b_main.p8s_fail_word - bra label_asm_484_afterif -label_asm_485_else - ; source: test_word_gte.p8:3916 success++ - inc p8b_main.p8v_success -label_asm_484_afterif - ; source: test_word_gte.p8:3918 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_gte.p8:3920 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_gte.p8:3922 goto skip15a - bra p8l_skip15a - ; source: test_word_gte.p8:3923 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3924 skip15a: -p8l_skip15a - ; source: test_word_gte.p8:3926 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3927 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3929 goto skip15b - bra p8l_skip15b - ; source: test_word_gte.p8:3930 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3931 skip15b: -p8l_skip15b - ; source: test_word_gte.p8:3933 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_486_afterif - ; source: test_word_gte.p8:3934 success++ - inc p8b_main.p8v_success -label_asm_486_afterif - ; source: test_word_gte.p8:3937 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_488_else - ; source: test_word_gte.p8:3938 success++ - inc p8b_main.p8v_success - bra label_asm_487_afterif -label_asm_488_else - ; source: test_word_gte.p8:3940 cx16.r0L++ - inc cx16.r0L -label_asm_487_afterif - ; source: test_word_gte.p8:3943 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_gte.p8:3945 goto skip16a - bra p8l_skip16a - ; source: test_word_gte.p8:3946 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3947 skip16a: -p8l_skip16a - ; source: test_word_gte.p8:3949 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3950 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3952 goto skip16b - bra p8l_skip16b - ; source: test_word_gte.p8:3953 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3954 skip16b: -p8l_skip16b - ; source: test_word_gte.p8:3956 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_489_afterif - ; source: test_word_gte.p8:3957 success++ - inc p8b_main.p8v_success -label_asm_489_afterif - ; source: test_word_gte.p8:3960 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_491_else - ; source: test_word_gte.p8:3961 success++ - inc p8b_main.p8v_success - bra label_asm_490_afterif -label_asm_491_else - ; source: test_word_gte.p8:3963 cx16.r0L++ - inc cx16.r0L -label_asm_490_afterif - ; source: test_word_gte.p8:3966 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_gte.p8:3968 goto skip17a - bra p8l_skip17a - ; source: test_word_gte.p8:3969 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3970 skip17a: -p8l_skip17a - ; source: test_word_gte.p8:3972 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3973 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3975 goto skip17b - bra p8l_skip17b - ; source: test_word_gte.p8:3976 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:3977 skip17b: -p8l_skip17b - ; source: test_word_gte.p8:3979 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_492_afterif - ; source: test_word_gte.p8:3980 success++ - inc p8b_main.p8v_success -label_asm_492_afterif - ; source: test_word_gte.p8:3983 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_494_else - ; source: test_word_gte.p8:3984 success++ - inc p8b_main.p8v_success - bra label_asm_493_afterif -label_asm_494_else - ; source: test_word_gte.p8:3986 cx16.r0L++ - inc cx16.r0L -label_asm_493_afterif - ; source: test_word_gte.p8:3989 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_gte.p8:3991 goto skip18a - bra p8l_skip18a - ; source: test_word_gte.p8:3992 lbl18a: fail_word(297) -p8l_lbl18a - ldy #>$0129 - lda #<$0129 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:3993 skip18a: -p8l_skip18a - ; source: test_word_gte.p8:3995 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:3996 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:3998 goto skip18b - bra p8l_skip18b - ; source: test_word_gte.p8:3999 lbl18b: fail_word(298) -p8l_lbl18b - ldy #>$012a - lda #<$012a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4000 skip18b: -p8l_skip18b - ; source: test_word_gte.p8:4002 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_495_afterif - ; source: test_word_gte.p8:4003 fail_word(299) - ldy #>$012b - lda #<$012b - jsr p8b_main.p8s_fail_word -label_asm_495_afterif - ; source: test_word_gte.p8:4006 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_497_else - ; source: test_word_gte.p8:4007 fail_word(300) - ldy #>$012c - lda #<$012c - jsr p8b_main.p8s_fail_word - bra label_asm_496_afterif -label_asm_497_else - ; source: test_word_gte.p8:4009 success++ - inc p8b_main.p8v_success -label_asm_496_afterif - ; source: test_word_gte.p8:4012 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_gte.p8:4014 goto skip19a - bra p8l_skip19a - ; source: test_word_gte.p8:4015 lbl19a: fail_word(301) -p8l_lbl19a - ldy #>$012d - lda #<$012d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4016 skip19a: -p8l_skip19a - ; source: test_word_gte.p8:4018 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4019 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4021 goto skip19b - bra p8l_skip19b - ; source: test_word_gte.p8:4022 lbl19b: fail_word(302) -p8l_lbl19b - ldy #>$012e - lda #<$012e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4023 skip19b: -p8l_skip19b - ; source: test_word_gte.p8:4025 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_498_afterif - ; source: test_word_gte.p8:4026 fail_word(303) - ldy #>$012f - lda #<$012f - jsr p8b_main.p8s_fail_word -label_asm_498_afterif - ; source: test_word_gte.p8:4029 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_500_else - ; source: test_word_gte.p8:4030 fail_word(304) - ldy #>$0130 - lda #<$0130 - jsr p8b_main.p8s_fail_word - bra label_asm_499_afterif -label_asm_500_else - ; source: test_word_gte.p8:4032 success++ - inc p8b_main.p8v_success -label_asm_499_afterif - ; source: test_word_gte.p8:4035 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_gte.p8:4037 goto skip20a - bra p8l_skip20a - ; source: test_word_gte.p8:4038 lbl20a: fail_word(305) -p8l_lbl20a - ldy #>$0131 - lda #<$0131 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4039 skip20a: -p8l_skip20a - ; source: test_word_gte.p8:4041 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4042 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4044 goto skip20b - bra p8l_skip20b - ; source: test_word_gte.p8:4045 lbl20b: fail_word(306) -p8l_lbl20b - ldy #>$0132 - lda #<$0132 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4046 skip20b: -p8l_skip20b - ; source: test_word_gte.p8:4048 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_501_afterif - ; source: test_word_gte.p8:4049 fail_word(307) - ldy #>$0133 - lda #<$0133 - jsr p8b_main.p8s_fail_word -label_asm_501_afterif - ; source: test_word_gte.p8:4052 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_503_else - ; source: test_word_gte.p8:4053 fail_word(308) - ldy #>$0134 - lda #<$0134 - jsr p8b_main.p8s_fail_word - bra label_asm_502_afterif -label_asm_503_else - ; source: test_word_gte.p8:4055 success++ - inc p8b_main.p8v_success -label_asm_502_afterif - ; source: test_word_gte.p8:4058 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_gte.p8:4060 goto skip21a - bra p8l_skip21a - ; source: test_word_gte.p8:4061 lbl21a: fail_word(309) -p8l_lbl21a - ldy #>$0135 - lda #<$0135 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4062 skip21a: -p8l_skip21a - ; source: test_word_gte.p8:4064 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4065 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4067 goto skip21b - bra p8l_skip21b - ; source: test_word_gte.p8:4068 lbl21b: fail_word(310) -p8l_lbl21b - ldy #>$0136 - lda #<$0136 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4069 skip21b: -p8l_skip21b - ; source: test_word_gte.p8:4071 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_504_afterif - ; source: test_word_gte.p8:4072 fail_word(311) - ldy #>$0137 - lda #<$0137 - jsr p8b_main.p8s_fail_word -label_asm_504_afterif - ; source: test_word_gte.p8:4075 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_506_else - ; source: test_word_gte.p8:4076 fail_word(312) - ldy #>$0138 - lda #<$0138 - jsr p8b_main.p8s_fail_word - bra label_asm_505_afterif -label_asm_506_else - ; source: test_word_gte.p8:4078 success++ - inc p8b_main.p8v_success -label_asm_505_afterif - ; source: test_word_gte.p8:4080 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:4082 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_gte.p8:4084 goto skip22a - bra p8l_skip22a - ; source: test_word_gte.p8:4085 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4086 skip22a: -p8l_skip22a - ; source: test_word_gte.p8:4088 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4089 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4091 goto skip22b - bra p8l_skip22b - ; source: test_word_gte.p8:4092 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4093 skip22b: -p8l_skip22b - ; source: test_word_gte.p8:4095 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_507_afterif - ; source: test_word_gte.p8:4096 success++ - inc p8b_main.p8v_success -label_asm_507_afterif - ; source: test_word_gte.p8:4099 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_509_else - ; source: test_word_gte.p8:4100 success++ - inc p8b_main.p8v_success - bra label_asm_508_afterif -label_asm_509_else - ; source: test_word_gte.p8:4102 cx16.r0L++ - inc cx16.r0L -label_asm_508_afterif - ; source: test_word_gte.p8:4105 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_gte.p8:4107 goto skip23a - bra p8l_skip23a - ; source: test_word_gte.p8:4108 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4109 skip23a: -p8l_skip23a - ; source: test_word_gte.p8:4111 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4112 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4114 goto skip23b - bra p8l_skip23b - ; source: test_word_gte.p8:4115 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4116 skip23b: -p8l_skip23b - ; source: test_word_gte.p8:4118 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_510_afterif - ; source: test_word_gte.p8:4119 success++ - inc p8b_main.p8v_success -label_asm_510_afterif - ; source: test_word_gte.p8:4122 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_512_else - ; source: test_word_gte.p8:4123 success++ - inc p8b_main.p8v_success - bra label_asm_511_afterif -label_asm_512_else - ; source: test_word_gte.p8:4125 cx16.r0L++ - inc cx16.r0L -label_asm_511_afterif - ; source: test_word_gte.p8:4128 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_gte.p8:4130 goto skip24a - bra p8l_skip24a - ; source: test_word_gte.p8:4131 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4132 skip24a: -p8l_skip24a - ; source: test_word_gte.p8:4134 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4135 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4137 goto skip24b - bra p8l_skip24b - ; source: test_word_gte.p8:4138 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4139 skip24b: -p8l_skip24b - ; source: test_word_gte.p8:4141 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_513_afterif - ; source: test_word_gte.p8:4142 success++ - inc p8b_main.p8v_success -label_asm_513_afterif - ; source: test_word_gte.p8:4145 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_515_else - ; source: test_word_gte.p8:4146 success++ - inc p8b_main.p8v_success - bra label_asm_514_afterif -label_asm_515_else - ; source: test_word_gte.p8:4148 cx16.r0L++ - inc cx16.r0L -label_asm_514_afterif - ; source: test_word_gte.p8:4151 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_gte.p8:4153 goto skip25a - bra p8l_skip25a - ; source: test_word_gte.p8:4154 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4155 skip25a: -p8l_skip25a - ; source: test_word_gte.p8:4157 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4158 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4160 goto skip25b - bra p8l_skip25b - ; source: test_word_gte.p8:4161 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4162 skip25b: -p8l_skip25b - ; source: test_word_gte.p8:4164 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_516_afterif - ; source: test_word_gte.p8:4165 success++ - inc p8b_main.p8v_success -label_asm_516_afterif - ; source: test_word_gte.p8:4168 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_518_else - ; source: test_word_gte.p8:4169 success++ - inc p8b_main.p8v_success - bra label_asm_517_afterif -label_asm_518_else - ; source: test_word_gte.p8:4171 cx16.r0L++ - inc cx16.r0L -label_asm_517_afterif - ; source: test_word_gte.p8:4174 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_gte.p8:4176 goto skip26a - bra p8l_skip26a - ; source: test_word_gte.p8:4177 lbl26a: fail_word(313) -p8l_lbl26a - ldy #>$0139 - lda #<$0139 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4178 skip26a: -p8l_skip26a - ; source: test_word_gte.p8:4180 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4181 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4183 goto skip26b - bra p8l_skip26b - ; source: test_word_gte.p8:4184 lbl26b: fail_word(314) -p8l_lbl26b - ldy #>$013a - lda #<$013a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4185 skip26b: -p8l_skip26b - ; source: test_word_gte.p8:4187 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_519_afterif - ; source: test_word_gte.p8:4188 fail_word(315) - ldy #>$013b - lda #<$013b - jsr p8b_main.p8s_fail_word -label_asm_519_afterif - ; source: test_word_gte.p8:4191 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_521_else - ; source: test_word_gte.p8:4192 fail_word(316) - ldy #>$013c - lda #<$013c - jsr p8b_main.p8s_fail_word - bra label_asm_520_afterif -label_asm_521_else - ; source: test_word_gte.p8:4194 success++ - inc p8b_main.p8v_success -label_asm_520_afterif - ; source: test_word_gte.p8:4197 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_gte.p8:4199 goto skip27a - bra p8l_skip27a - ; source: test_word_gte.p8:4200 lbl27a: fail_word(317) -p8l_lbl27a - ldy #>$013d - lda #<$013d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4201 skip27a: -p8l_skip27a - ; source: test_word_gte.p8:4203 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4204 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4206 goto skip27b - bra p8l_skip27b - ; source: test_word_gte.p8:4207 lbl27b: fail_word(318) -p8l_lbl27b - ldy #>$013e - lda #<$013e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4208 skip27b: -p8l_skip27b - ; source: test_word_gte.p8:4210 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_522_afterif - ; source: test_word_gte.p8:4211 fail_word(319) - ldy #>$013f - lda #<$013f - jsr p8b_main.p8s_fail_word -label_asm_522_afterif - ; source: test_word_gte.p8:4214 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_524_else - ; source: test_word_gte.p8:4215 fail_word(320) - ldy #>$0140 - lda #<$0140 - jsr p8b_main.p8s_fail_word - bra label_asm_523_afterif -label_asm_524_else - ; source: test_word_gte.p8:4217 success++ - inc p8b_main.p8v_success -label_asm_523_afterif - ; source: test_word_gte.p8:4220 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_gte.p8:4222 goto skip28a - bra p8l_skip28a - ; source: test_word_gte.p8:4223 lbl28a: fail_word(321) -p8l_lbl28a - ldy #>$0141 - lda #<$0141 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4224 skip28a: -p8l_skip28a - ; source: test_word_gte.p8:4226 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4227 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4229 goto skip28b - bra p8l_skip28b - ; source: test_word_gte.p8:4230 lbl28b: fail_word(322) -p8l_lbl28b - ldy #>$0142 - lda #<$0142 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4231 skip28b: -p8l_skip28b - ; source: test_word_gte.p8:4233 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_525_afterif - ; source: test_word_gte.p8:4234 fail_word(323) - ldy #>$0143 - lda #<$0143 - jsr p8b_main.p8s_fail_word -label_asm_525_afterif - ; source: test_word_gte.p8:4237 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_527_else - ; source: test_word_gte.p8:4238 fail_word(324) - ldy #>$0144 - lda #<$0144 - jsr p8b_main.p8s_fail_word - bra label_asm_526_afterif -label_asm_527_else - ; source: test_word_gte.p8:4240 success++ - inc p8b_main.p8v_success -label_asm_526_afterif - ; source: test_word_gte.p8:4242 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:4244 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_gte.p8:4246 goto skip29a - bra p8l_skip29a - ; source: test_word_gte.p8:4247 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4248 skip29a: -p8l_skip29a - ; source: test_word_gte.p8:4250 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4251 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4253 goto skip29b - bra p8l_skip29b - ; source: test_word_gte.p8:4254 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4255 skip29b: -p8l_skip29b - ; source: test_word_gte.p8:4257 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_528_afterif - ; source: test_word_gte.p8:4258 success++ - inc p8b_main.p8v_success -label_asm_528_afterif - ; source: test_word_gte.p8:4261 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_530_else - ; source: test_word_gte.p8:4262 success++ - inc p8b_main.p8v_success - bra label_asm_529_afterif -label_asm_530_else - ; source: test_word_gte.p8:4264 cx16.r0L++ - inc cx16.r0L -label_asm_529_afterif - ; source: test_word_gte.p8:4267 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_gte.p8:4269 goto skip30a - bra p8l_skip30a - ; source: test_word_gte.p8:4270 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4271 skip30a: -p8l_skip30a - ; source: test_word_gte.p8:4273 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4274 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4276 goto skip30b - bra p8l_skip30b - ; source: test_word_gte.p8:4277 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4278 skip30b: -p8l_skip30b - ; source: test_word_gte.p8:4280 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_531_afterif - ; source: test_word_gte.p8:4281 success++ - inc p8b_main.p8v_success -label_asm_531_afterif - ; source: test_word_gte.p8:4284 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_533_else - ; source: test_word_gte.p8:4285 success++ - inc p8b_main.p8v_success - bra label_asm_532_afterif -label_asm_533_else - ; source: test_word_gte.p8:4287 cx16.r0L++ - inc cx16.r0L -label_asm_532_afterif - ; source: test_word_gte.p8:4290 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_gte.p8:4292 goto skip31a - bra p8l_skip31a - ; source: test_word_gte.p8:4293 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4294 skip31a: -p8l_skip31a - ; source: test_word_gte.p8:4296 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4297 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4299 goto skip31b - bra p8l_skip31b - ; source: test_word_gte.p8:4300 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4301 skip31b: -p8l_skip31b - ; source: test_word_gte.p8:4303 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_534_afterif - ; source: test_word_gte.p8:4304 success++ - inc p8b_main.p8v_success -label_asm_534_afterif - ; source: test_word_gte.p8:4307 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_536_else - ; source: test_word_gte.p8:4308 success++ - inc p8b_main.p8v_success - bra label_asm_535_afterif -label_asm_536_else - ; source: test_word_gte.p8:4310 cx16.r0L++ - inc cx16.r0L -label_asm_535_afterif - ; source: test_word_gte.p8:4313 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_gte.p8:4315 goto skip32a - bra p8l_skip32a - ; source: test_word_gte.p8:4316 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4317 skip32a: -p8l_skip32a - ; source: test_word_gte.p8:4319 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4320 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4322 goto skip32b - bra p8l_skip32b - ; source: test_word_gte.p8:4323 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4324 skip32b: -p8l_skip32b - ; source: test_word_gte.p8:4326 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_537_afterif - ; source: test_word_gte.p8:4327 success++ - inc p8b_main.p8v_success -label_asm_537_afterif - ; source: test_word_gte.p8:4330 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_539_else - ; source: test_word_gte.p8:4331 success++ - inc p8b_main.p8v_success - bra label_asm_538_afterif -label_asm_539_else - ; source: test_word_gte.p8:4333 cx16.r0L++ - inc cx16.r0L -label_asm_538_afterif - ; source: test_word_gte.p8:4336 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_gte.p8:4338 goto skip33a - bra p8l_skip33a - ; source: test_word_gte.p8:4339 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4340 skip33a: -p8l_skip33a - ; source: test_word_gte.p8:4342 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4343 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4345 goto skip33b - bra p8l_skip33b - ; source: test_word_gte.p8:4346 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4347 skip33b: -p8l_skip33b - ; source: test_word_gte.p8:4349 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_540_afterif - ; source: test_word_gte.p8:4350 success++ - inc p8b_main.p8v_success -label_asm_540_afterif - ; source: test_word_gte.p8:4353 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_542_else - ; source: test_word_gte.p8:4354 success++ - inc p8b_main.p8v_success - bra label_asm_541_afterif -label_asm_542_else - ; source: test_word_gte.p8:4356 cx16.r0L++ - inc cx16.r0L -label_asm_541_afterif - ; source: test_word_gte.p8:4359 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_gte.p8:4361 goto skip34a - bra p8l_skip34a - ; source: test_word_gte.p8:4362 lbl34a: fail_word(325) -p8l_lbl34a - ldy #>$0145 - lda #<$0145 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4363 skip34a: -p8l_skip34a - ; source: test_word_gte.p8:4365 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4366 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4368 goto skip34b - bra p8l_skip34b - ; source: test_word_gte.p8:4369 lbl34b: fail_word(326) -p8l_lbl34b - ldy #>$0146 - lda #<$0146 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4370 skip34b: -p8l_skip34b - ; source: test_word_gte.p8:4372 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_543_afterif - ; source: test_word_gte.p8:4373 fail_word(327) - ldy #>$0147 - lda #<$0147 - jsr p8b_main.p8s_fail_word -label_asm_543_afterif - ; source: test_word_gte.p8:4376 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_545_else - ; source: test_word_gte.p8:4377 fail_word(328) - ldy #>$0148 - lda #<$0148 - jsr p8b_main.p8s_fail_word - bra label_asm_544_afterif -label_asm_545_else - ; source: test_word_gte.p8:4379 success++ - inc p8b_main.p8v_success -label_asm_544_afterif - ; source: test_word_gte.p8:4382 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_gte.p8:4384 goto skip35a - bra p8l_skip35a - ; source: test_word_gte.p8:4385 lbl35a: fail_word(329) -p8l_lbl35a - ldy #>$0149 - lda #<$0149 - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4386 skip35a: -p8l_skip35a - ; source: test_word_gte.p8:4388 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4389 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4391 goto skip35b - bra p8l_skip35b - ; source: test_word_gte.p8:4392 lbl35b: fail_word(330) -p8l_lbl35b - ldy #>$014a - lda #<$014a - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4393 skip35b: -p8l_skip35b - ; source: test_word_gte.p8:4395 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_546_afterif - ; source: test_word_gte.p8:4396 fail_word(331) - ldy #>$014b - lda #<$014b - jsr p8b_main.p8s_fail_word -label_asm_546_afterif - ; source: test_word_gte.p8:4399 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_548_else - ; source: test_word_gte.p8:4400 fail_word(332) - ldy #>$014c - lda #<$014c - jsr p8b_main.p8s_fail_word - bra label_asm_547_afterif -label_asm_548_else - ; source: test_word_gte.p8:4402 success++ - inc p8b_main.p8v_success -label_asm_547_afterif - ; source: test_word_gte.p8:4404 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:4406 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_gte.p8:4408 goto skip36a - bra p8l_skip36a - ; source: test_word_gte.p8:4409 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4410 skip36a: -p8l_skip36a - ; source: test_word_gte.p8:4412 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4413 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4415 goto skip36b - bra p8l_skip36b - ; source: test_word_gte.p8:4416 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4417 skip36b: -p8l_skip36b - ; source: test_word_gte.p8:4419 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_549_afterif - ; source: test_word_gte.p8:4420 success++ - inc p8b_main.p8v_success -label_asm_549_afterif - ; source: test_word_gte.p8:4423 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_551_else - ; source: test_word_gte.p8:4424 success++ - inc p8b_main.p8v_success - bra label_asm_550_afterif -label_asm_551_else - ; source: test_word_gte.p8:4426 cx16.r0L++ - inc cx16.r0L -label_asm_550_afterif - ; source: test_word_gte.p8:4429 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_gte.p8:4431 goto skip37a - bra p8l_skip37a - ; source: test_word_gte.p8:4432 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4433 skip37a: -p8l_skip37a - ; source: test_word_gte.p8:4435 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4436 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4438 goto skip37b - bra p8l_skip37b - ; source: test_word_gte.p8:4439 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4440 skip37b: -p8l_skip37b - ; source: test_word_gte.p8:4442 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_552_afterif - ; source: test_word_gte.p8:4443 success++ - inc p8b_main.p8v_success -label_asm_552_afterif - ; source: test_word_gte.p8:4446 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_554_else - ; source: test_word_gte.p8:4447 success++ - inc p8b_main.p8v_success - bra label_asm_553_afterif -label_asm_554_else - ; source: test_word_gte.p8:4449 cx16.r0L++ - inc cx16.r0L -label_asm_553_afterif - ; source: test_word_gte.p8:4452 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_gte.p8:4454 goto skip38a - bra p8l_skip38a - ; source: test_word_gte.p8:4455 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4456 skip38a: -p8l_skip38a - ; source: test_word_gte.p8:4458 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4459 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4461 goto skip38b - bra p8l_skip38b - ; source: test_word_gte.p8:4462 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4463 skip38b: -p8l_skip38b - ; source: test_word_gte.p8:4465 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_555_afterif - ; source: test_word_gte.p8:4466 success++ - inc p8b_main.p8v_success -label_asm_555_afterif - ; source: test_word_gte.p8:4469 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_557_else - ; source: test_word_gte.p8:4470 success++ - inc p8b_main.p8v_success - bra label_asm_556_afterif -label_asm_557_else - ; source: test_word_gte.p8:4472 cx16.r0L++ - inc cx16.r0L -label_asm_556_afterif - ; source: test_word_gte.p8:4475 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_gte.p8:4477 goto skip39a - bra p8l_skip39a - ; source: test_word_gte.p8:4478 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4479 skip39a: -p8l_skip39a - ; source: test_word_gte.p8:4481 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4482 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4484 goto skip39b - bra p8l_skip39b - ; source: test_word_gte.p8:4485 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4486 skip39b: -p8l_skip39b - ; source: test_word_gte.p8:4488 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_558_afterif - ; source: test_word_gte.p8:4489 success++ - inc p8b_main.p8v_success -label_asm_558_afterif - ; source: test_word_gte.p8:4492 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_560_else - ; source: test_word_gte.p8:4493 success++ - inc p8b_main.p8v_success - bra label_asm_559_afterif -label_asm_560_else - ; source: test_word_gte.p8:4495 cx16.r0L++ - inc cx16.r0L -label_asm_559_afterif - ; source: test_word_gte.p8:4498 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_gte.p8:4500 goto skip40a - bra p8l_skip40a - ; source: test_word_gte.p8:4501 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4502 skip40a: -p8l_skip40a - ; source: test_word_gte.p8:4504 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4505 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4507 goto skip40b - bra p8l_skip40b - ; source: test_word_gte.p8:4508 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4509 skip40b: -p8l_skip40b - ; source: test_word_gte.p8:4511 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_561_afterif - ; source: test_word_gte.p8:4512 success++ - inc p8b_main.p8v_success -label_asm_561_afterif - ; source: test_word_gte.p8:4515 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_563_else - ; source: test_word_gte.p8:4516 success++ - inc p8b_main.p8v_success - bra label_asm_562_afterif -label_asm_563_else - ; source: test_word_gte.p8:4518 cx16.r0L++ - inc cx16.r0L -label_asm_562_afterif - ; source: test_word_gte.p8:4521 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_gte.p8:4523 goto skip41a - bra p8l_skip41a - ; source: test_word_gte.p8:4524 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4525 skip41a: -p8l_skip41a - ; source: test_word_gte.p8:4527 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4528 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4530 goto skip41b - bra p8l_skip41b - ; source: test_word_gte.p8:4531 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4532 skip41b: -p8l_skip41b - ; source: test_word_gte.p8:4534 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_564_afterif - ; source: test_word_gte.p8:4535 success++ - inc p8b_main.p8v_success -label_asm_564_afterif - ; source: test_word_gte.p8:4538 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_566_else - ; source: test_word_gte.p8:4539 success++ - inc p8b_main.p8v_success - bra label_asm_565_afterif -label_asm_566_else - ; source: test_word_gte.p8:4541 cx16.r0L++ - inc cx16.r0L -label_asm_565_afterif - ; source: test_word_gte.p8:4544 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_gte.p8:4546 goto skip42a - bra p8l_skip42a - ; source: test_word_gte.p8:4547 lbl42a: fail_word(333) -p8l_lbl42a - ldy #>$014d - lda #<$014d - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4548 skip42a: -p8l_skip42a - ; source: test_word_gte.p8:4550 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4551 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4553 goto skip42b - bra p8l_skip42b - ; source: test_word_gte.p8:4554 lbl42b: fail_word(334) -p8l_lbl42b - ldy #>$014e - lda #<$014e - jsr p8b_main.p8s_fail_word - ; source: test_word_gte.p8:4555 skip42b: -p8l_skip42b - ; source: test_word_gte.p8:4557 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_567_afterif - ; source: test_word_gte.p8:4558 fail_word(335) - ldy #>$014f - lda #<$014f - jsr p8b_main.p8s_fail_word -label_asm_567_afterif - ; source: test_word_gte.p8:4561 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_569_else - ; source: test_word_gte.p8:4562 fail_word(336) - ldy #>$0150 - lda #<$0150 - jsr p8b_main.p8s_fail_word - bra label_asm_568_afterif -label_asm_569_else - ; source: test_word_gte.p8:4564 success++ - inc p8b_main.p8v_success -label_asm_568_afterif - ; source: test_word_gte.p8:4566 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_gte.p8:4568 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_gte.p8:4570 goto skip43a - bra p8l_skip43a - ; source: test_word_gte.p8:4571 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4572 skip43a: -p8l_skip43a - ; source: test_word_gte.p8:4574 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4575 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4577 goto skip43b - bra p8l_skip43b - ; source: test_word_gte.p8:4578 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4579 skip43b: -p8l_skip43b - ; source: test_word_gte.p8:4581 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_570_afterif - ; source: test_word_gte.p8:4582 success++ - inc p8b_main.p8v_success -label_asm_570_afterif - ; source: test_word_gte.p8:4585 if x>=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_572_else - ; source: test_word_gte.p8:4586 success++ - inc p8b_main.p8v_success - bra label_asm_571_afterif -label_asm_572_else - ; source: test_word_gte.p8:4588 cx16.r0L++ - inc cx16.r0L -label_asm_571_afterif - ; source: test_word_gte.p8:4591 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_gte.p8:4593 goto skip44a - bra p8l_skip44a - ; source: test_word_gte.p8:4594 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4595 skip44a: -p8l_skip44a - ; source: test_word_gte.p8:4597 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4598 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4600 goto skip44b - bra p8l_skip44b - ; source: test_word_gte.p8:4601 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4602 skip44b: -p8l_skip44b - ; source: test_word_gte.p8:4604 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_573_afterif - ; source: test_word_gte.p8:4605 success++ - inc p8b_main.p8v_success -label_asm_573_afterif - ; source: test_word_gte.p8:4608 if x>=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_575_else - ; source: test_word_gte.p8:4609 success++ - inc p8b_main.p8v_success - bra label_asm_574_afterif -label_asm_575_else - ; source: test_word_gte.p8:4611 cx16.r0L++ - inc cx16.r0L -label_asm_574_afterif - ; source: test_word_gte.p8:4614 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_gte.p8:4616 goto skip45a - bra p8l_skip45a - ; source: test_word_gte.p8:4617 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4618 skip45a: -p8l_skip45a - ; source: test_word_gte.p8:4620 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4621 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4623 goto skip45b - bra p8l_skip45b - ; source: test_word_gte.p8:4624 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4625 skip45b: -p8l_skip45b - ; source: test_word_gte.p8:4627 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_576_afterif - ; source: test_word_gte.p8:4628 success++ - inc p8b_main.p8v_success -label_asm_576_afterif - ; source: test_word_gte.p8:4631 if x>=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_578_else - ; source: test_word_gte.p8:4632 success++ - inc p8b_main.p8v_success - bra label_asm_577_afterif -label_asm_578_else - ; source: test_word_gte.p8:4634 cx16.r0L++ - inc cx16.r0L -label_asm_577_afterif - ; source: test_word_gte.p8:4637 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_gte.p8:4639 goto skip46a - bra p8l_skip46a - ; source: test_word_gte.p8:4640 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4641 skip46a: -p8l_skip46a - ; source: test_word_gte.p8:4643 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4644 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4646 goto skip46b - bra p8l_skip46b - ; source: test_word_gte.p8:4647 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4648 skip46b: -p8l_skip46b - ; source: test_word_gte.p8:4650 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_579_afterif - ; source: test_word_gte.p8:4651 success++ - inc p8b_main.p8v_success -label_asm_579_afterif - ; source: test_word_gte.p8:4654 if x>=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_581_else - ; source: test_word_gte.p8:4655 success++ - inc p8b_main.p8v_success - bra label_asm_580_afterif -label_asm_581_else - ; source: test_word_gte.p8:4657 cx16.r0L++ - inc cx16.r0L -label_asm_580_afterif - ; source: test_word_gte.p8:4660 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_gte.p8:4662 goto skip47a - bra p8l_skip47a - ; source: test_word_gte.p8:4663 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4664 skip47a: -p8l_skip47a - ; source: test_word_gte.p8:4666 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4667 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4669 goto skip47b - bra p8l_skip47b - ; source: test_word_gte.p8:4670 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4671 skip47b: -p8l_skip47b - ; source: test_word_gte.p8:4673 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_582_afterif - ; source: test_word_gte.p8:4674 success++ - inc p8b_main.p8v_success -label_asm_582_afterif - ; source: test_word_gte.p8:4677 if x>=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_584_else - ; source: test_word_gte.p8:4678 success++ - inc p8b_main.p8v_success - bra label_asm_583_afterif -label_asm_584_else - ; source: test_word_gte.p8:4680 cx16.r0L++ - inc cx16.r0L -label_asm_583_afterif - ; source: test_word_gte.p8:4683 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_gte.p8:4685 goto skip48a - bra p8l_skip48a - ; source: test_word_gte.p8:4686 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4687 skip48a: -p8l_skip48a - ; source: test_word_gte.p8:4689 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4690 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4692 goto skip48b - bra p8l_skip48b - ; source: test_word_gte.p8:4693 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4694 skip48b: -p8l_skip48b - ; source: test_word_gte.p8:4696 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_585_afterif - ; source: test_word_gte.p8:4697 success++ - inc p8b_main.p8v_success -label_asm_585_afterif - ; source: test_word_gte.p8:4700 if x>=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_587_else - ; source: test_word_gte.p8:4701 success++ - inc p8b_main.p8v_success - bra label_asm_586_afterif -label_asm_587_else - ; source: test_word_gte.p8:4703 cx16.r0L++ - inc cx16.r0L -label_asm_586_afterif - ; source: test_word_gte.p8:4706 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_gte.p8:4708 goto skip49a - bra p8l_skip49a - ; source: test_word_gte.p8:4709 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4710 skip49a: -p8l_skip49a - ; source: test_word_gte.p8:4712 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_gte.p8:4713 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_gte.p8:4715 goto skip49b - bra p8l_skip49b - ; source: test_word_gte.p8:4716 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_gte.p8:4717 skip49b: -p8l_skip49b - ; source: test_word_gte.p8:4719 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_588_afterif - ; source: test_word_gte.p8:4720 success++ - inc p8b_main.p8v_success -label_asm_588_afterif - ; source: test_word_gte.p8:4723 if x>=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_590_else - ; source: test_word_gte.p8:4724 success++ - inc p8b_main.p8v_success - bra label_asm_589_afterif -label_asm_590_else - ; source: test_word_gte.p8:4726 cx16.r0L++ - inc cx16.r0L -label_asm_589_afterif - ; source: test_word_gte.p8:4728 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_gte.p8:3587 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .sint ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $54 - .byte $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n>=number: " - .byte $0d, $3e, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n>=var: " - .byte $0d, $3e, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n>=expr: " - .byte $0d, $3e, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_word_gte.p8:14 txt.print("\ngreater-equal tests for: ") - ; source: test_word_gte.p8:18 txt.print("\n>=number: ") - ; source: test_word_gte.p8:20 txt.print("\n>=var: ") - ; source: test_word_gte.p8:22 txt.print("\n>=array[]: ") - ; source: test_word_gte.p8:24 txt.print("\n>=expr: ") - ; source: test_word_gte.p8:33 txt.print(" **failed** ") - ; source: test_word_gte.p8:35 txt.print(" success, expected ") - ; source: test_word_gte.p8:41 txt.print(" **fail#") - ; source: test_word_gte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_gte.p8 b/compiler/test/comparisons/test_word_gte.p8 deleted file mode 100644 index 0c87b5951..000000000 --- a/compiler/test/comparisons/test_word_gte.p8 +++ /dev/null @@ -1,4732 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=number: ") - test_cmp_number() - txt.print("\n>=var: ") - test_cmp_var() - txt.print("\n>=array[]: ") - test_cmp_array() - txt.print("\n>=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - word @shared x - success = 0 - x=-21829 - ; direct jump - if x>=-21829 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=-21829 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl2a - goto skip2a -lbl2a: fail_word(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=-1 - goto cx16.r3 - goto skip2b -lbl2b: fail_word(2) -skip2b: - ; no else - if x>=-1 - fail_word(3) - - ; with else - if x>=-1 - fail_word(4) - else - success++ - - ; direct jump - if x>=0 - goto lbl3a - goto skip3a -lbl3a: fail_word(5) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=0 - goto cx16.r3 - goto skip3b -lbl3b: fail_word(6) -skip3b: - ; no else - if x>=0 - fail_word(7) - - ; with else - if x>=0 - fail_word(8) - else - success++ - - ; direct jump - if x>=1 - goto lbl4a - goto skip4a -lbl4a: fail_word(9) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=1 - goto cx16.r3 - goto skip4b -lbl4b: fail_word(10) -skip4b: - ; no else - if x>=1 - fail_word(11) - - ; with else - if x>=1 - fail_word(12) - else - success++ - - ; direct jump - if x>=170 - goto lbl5a - goto skip5a -lbl5a: fail_word(13) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=170 - goto cx16.r3 - goto skip5b -lbl5b: fail_word(14) -skip5b: - ; no else - if x>=170 - fail_word(15) - - ; with else - if x>=170 - fail_word(16) - else - success++ - - ; direct jump - if x>=30464 - goto lbl6a - goto skip6a -lbl6a: fail_word(17) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=30464 - goto cx16.r3 - goto skip6b -lbl6b: fail_word(18) -skip6b: - ; no else - if x>=30464 - fail_word(19) - - ; with else - if x>=30464 - fail_word(20) - else - success++ - - ; direct jump - if x>=32767 - goto lbl7a - goto skip7a -lbl7a: fail_word(21) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=32767 - goto cx16.r3 - goto skip7b -lbl7b: fail_word(22) -skip7b: - ; no else - if x>=32767 - fail_word(23) - - ; with else - if x>=32767 - fail_word(24) - else - success++ - - x=-1 - ; direct jump - if x>=-21829 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=-21829 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=-1 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl10a - goto skip10a -lbl10a: fail_word(25) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=0 - goto cx16.r3 - goto skip10b -lbl10b: fail_word(26) -skip10b: - ; no else - if x>=0 - fail_word(27) - - ; with else - if x>=0 - fail_word(28) - else - success++ - - ; direct jump - if x>=1 - goto lbl11a - goto skip11a -lbl11a: fail_word(29) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=1 - goto cx16.r3 - goto skip11b -lbl11b: fail_word(30) -skip11b: - ; no else - if x>=1 - fail_word(31) - - ; with else - if x>=1 - fail_word(32) - else - success++ - - ; direct jump - if x>=170 - goto lbl12a - goto skip12a -lbl12a: fail_word(33) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=170 - goto cx16.r3 - goto skip12b -lbl12b: fail_word(34) -skip12b: - ; no else - if x>=170 - fail_word(35) - - ; with else - if x>=170 - fail_word(36) - else - success++ - - ; direct jump - if x>=30464 - goto lbl13a - goto skip13a -lbl13a: fail_word(37) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=30464 - goto cx16.r3 - goto skip13b -lbl13b: fail_word(38) -skip13b: - ; no else - if x>=30464 - fail_word(39) - - ; with else - if x>=30464 - fail_word(40) - else - success++ - - ; direct jump - if x>=32767 - goto lbl14a - goto skip14a -lbl14a: fail_word(41) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=32767 - goto cx16.r3 - goto skip14b -lbl14b: fail_word(42) -skip14b: - ; no else - if x>=32767 - fail_word(43) - - ; with else - if x>=32767 - fail_word(44) - else - success++ - - x=0 - ; direct jump - if x>=-21829 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=-21829 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=-1 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>=0 - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl18a - goto skip18a -lbl18a: fail_word(45) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>=1 - goto cx16.r3 - goto skip18b -lbl18b: fail_word(46) -skip18b: - ; no else - if x>=1 - fail_word(47) - - ; with else - if x>=1 - fail_word(48) - else - success++ - - ; direct jump - if x>=170 - goto lbl19a - goto skip19a -lbl19a: fail_word(49) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>=170 - goto cx16.r3 - goto skip19b -lbl19b: fail_word(50) -skip19b: - ; no else - if x>=170 - fail_word(51) - - ; with else - if x>=170 - fail_word(52) - else - success++ - - ; direct jump - if x>=30464 - goto lbl20a - goto skip20a -lbl20a: fail_word(53) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>=30464 - goto cx16.r3 - goto skip20b -lbl20b: fail_word(54) -skip20b: - ; no else - if x>=30464 - fail_word(55) - - ; with else - if x>=30464 - fail_word(56) - else - success++ - - ; direct jump - if x>=32767 - goto lbl21a - goto skip21a -lbl21a: fail_word(57) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>=32767 - goto cx16.r3 - goto skip21b -lbl21b: fail_word(58) -skip21b: - ; no else - if x>=32767 - fail_word(59) - - ; with else - if x>=32767 - fail_word(60) - else - success++ - - x=1 - ; direct jump - if x>=-21829 - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>=-21829 - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>=-1 - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>=0 - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>=1 - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=170 - goto lbl26a - goto skip26a -lbl26a: fail_word(61) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>=170 - goto cx16.r3 - goto skip26b -lbl26b: fail_word(62) -skip26b: - ; no else - if x>=170 - fail_word(63) - - ; with else - if x>=170 - fail_word(64) - else - success++ - - ; direct jump - if x>=30464 - goto lbl27a - goto skip27a -lbl27a: fail_word(65) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>=30464 - goto cx16.r3 - goto skip27b -lbl27b: fail_word(66) -skip27b: - ; no else - if x>=30464 - fail_word(67) - - ; with else - if x>=30464 - fail_word(68) - else - success++ - - ; direct jump - if x>=32767 - goto lbl28a - goto skip28a -lbl28a: fail_word(69) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>=32767 - goto cx16.r3 - goto skip28b -lbl28b: fail_word(70) -skip28b: - ; no else - if x>=32767 - fail_word(71) - - ; with else - if x>=32767 - fail_word(72) - else - success++ - - x=170 - ; direct jump - if x>=-21829 - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>=-21829 - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>=-1 - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>=0 - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>=1 - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=170 - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>=170 - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x>=170 - success++ - - ; with else - if x>=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=30464 - goto lbl34a - goto skip34a -lbl34a: fail_word(73) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>=30464 - goto cx16.r3 - goto skip34b -lbl34b: fail_word(74) -skip34b: - ; no else - if x>=30464 - fail_word(75) - - ; with else - if x>=30464 - fail_word(76) - else - success++ - - ; direct jump - if x>=32767 - goto lbl35a - goto skip35a -lbl35a: fail_word(77) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>=32767 - goto cx16.r3 - goto skip35b -lbl35b: fail_word(78) -skip35b: - ; no else - if x>=32767 - fail_word(79) - - ; with else - if x>=32767 - fail_word(80) - else - success++ - - x=30464 - ; direct jump - if x>=-21829 - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>=-21829 - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>=-1 - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>=0 - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>=1 - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=170 - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>=170 - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>=170 - success++ - - ; with else - if x>=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=30464 - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>=30464 - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x>=30464 - success++ - - ; with else - if x>=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=32767 - goto lbl42a - goto skip42a -lbl42a: fail_word(81) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>=32767 - goto cx16.r3 - goto skip42b -lbl42b: fail_word(82) -skip42b: - ; no else - if x>=32767 - fail_word(83) - - ; with else - if x>=32767 - fail_word(84) - else - success++ - - x=32767 - ; direct jump - if x>=-21829 - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>=-21829 - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>=-21829 - success++ - - ; with else - if x>=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=-1 - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>=-1 - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>=-1 - success++ - - ; with else - if x>=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=0 - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>=0 - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>=0 - success++ - - ; with else - if x>=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=1 - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>=1 - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>=1 - success++ - - ; with else - if x>=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=170 - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>=170 - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>=170 - success++ - - ; with else - if x>=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=30464 - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>=30464 - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>=30464 - success++ - - ; with else - if x>=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x>=32767 - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>=32767 - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x>=32767 - success++ - - ; with else - if x>=32767 - success++ - else - cx16.r0L++ - - verify_success(133) -} - sub test_cmp_var() { - word @shared x, value - success = 0 - x=-21829 - value=-21829 - ; direct jump - if x>=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl2a - goto skip2a -lbl2a: fail_word(85) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=value - goto cx16.r3 - goto skip2b -lbl2b: fail_word(86) -skip2b: - ; no else - if x>=value - fail_word(87) - - ; with else - if x>=value - fail_word(88) - else - success++ - - value=0 - ; direct jump - if x>=value - goto lbl3a - goto skip3a -lbl3a: fail_word(89) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=value - goto cx16.r3 - goto skip3b -lbl3b: fail_word(90) -skip3b: - ; no else - if x>=value - fail_word(91) - - ; with else - if x>=value - fail_word(92) - else - success++ - - value=1 - ; direct jump - if x>=value - goto lbl4a - goto skip4a -lbl4a: fail_word(93) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=value - goto cx16.r3 - goto skip4b -lbl4b: fail_word(94) -skip4b: - ; no else - if x>=value - fail_word(95) - - ; with else - if x>=value - fail_word(96) - else - success++ - - value=170 - ; direct jump - if x>=value - goto lbl5a - goto skip5a -lbl5a: fail_word(97) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=value - goto cx16.r3 - goto skip5b -lbl5b: fail_word(98) -skip5b: - ; no else - if x>=value - fail_word(99) - - ; with else - if x>=value - fail_word(100) - else - success++ - - value=30464 - ; direct jump - if x>=value - goto lbl6a - goto skip6a -lbl6a: fail_word(101) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=value - goto cx16.r3 - goto skip6b -lbl6b: fail_word(102) -skip6b: - ; no else - if x>=value - fail_word(103) - - ; with else - if x>=value - fail_word(104) - else - success++ - - value=32767 - ; direct jump - if x>=value - goto lbl7a - goto skip7a -lbl7a: fail_word(105) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=value - goto cx16.r3 - goto skip7b -lbl7b: fail_word(106) -skip7b: - ; no else - if x>=value - fail_word(107) - - ; with else - if x>=value - fail_word(108) - else - success++ - - x=-1 - value=-21829 - ; direct jump - if x>=value - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=value - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl10a - goto skip10a -lbl10a: fail_word(109) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=value - goto cx16.r3 - goto skip10b -lbl10b: fail_word(110) -skip10b: - ; no else - if x>=value - fail_word(111) - - ; with else - if x>=value - fail_word(112) - else - success++ - - value=1 - ; direct jump - if x>=value - goto lbl11a - goto skip11a -lbl11a: fail_word(113) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=value - goto cx16.r3 - goto skip11b -lbl11b: fail_word(114) -skip11b: - ; no else - if x>=value - fail_word(115) - - ; with else - if x>=value - fail_word(116) - else - success++ - - value=170 - ; direct jump - if x>=value - goto lbl12a - goto skip12a -lbl12a: fail_word(117) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=value - goto cx16.r3 - goto skip12b -lbl12b: fail_word(118) -skip12b: - ; no else - if x>=value - fail_word(119) - - ; with else - if x>=value - fail_word(120) - else - success++ - - value=30464 - ; direct jump - if x>=value - goto lbl13a - goto skip13a -lbl13a: fail_word(121) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=value - goto cx16.r3 - goto skip13b -lbl13b: fail_word(122) -skip13b: - ; no else - if x>=value - fail_word(123) - - ; with else - if x>=value - fail_word(124) - else - success++ - - value=32767 - ; direct jump - if x>=value - goto lbl14a - goto skip14a -lbl14a: fail_word(125) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=value - goto cx16.r3 - goto skip14b -lbl14b: fail_word(126) -skip14b: - ; no else - if x>=value - fail_word(127) - - ; with else - if x>=value - fail_word(128) - else - success++ - - x=0 - value=-21829 - ; direct jump - if x>=value - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=value - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=value - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>=value - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl18a - goto skip18a -lbl18a: fail_word(129) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>=value - goto cx16.r3 - goto skip18b -lbl18b: fail_word(130) -skip18b: - ; no else - if x>=value - fail_word(131) - - ; with else - if x>=value - fail_word(132) - else - success++ - - value=170 - ; direct jump - if x>=value - goto lbl19a - goto skip19a -lbl19a: fail_word(133) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>=value - goto cx16.r3 - goto skip19b -lbl19b: fail_word(134) -skip19b: - ; no else - if x>=value - fail_word(135) - - ; with else - if x>=value - fail_word(136) - else - success++ - - value=30464 - ; direct jump - if x>=value - goto lbl20a - goto skip20a -lbl20a: fail_word(137) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>=value - goto cx16.r3 - goto skip20b -lbl20b: fail_word(138) -skip20b: - ; no else - if x>=value - fail_word(139) - - ; with else - if x>=value - fail_word(140) - else - success++ - - value=32767 - ; direct jump - if x>=value - goto lbl21a - goto skip21a -lbl21a: fail_word(141) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>=value - goto cx16.r3 - goto skip21b -lbl21b: fail_word(142) -skip21b: - ; no else - if x>=value - fail_word(143) - - ; with else - if x>=value - fail_word(144) - else - success++ - - x=1 - value=-21829 - ; direct jump - if x>=value - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>=value - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>=value - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>=value - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>=value - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>=value - goto lbl26a - goto skip26a -lbl26a: fail_word(145) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>=value - goto cx16.r3 - goto skip26b -lbl26b: fail_word(146) -skip26b: - ; no else - if x>=value - fail_word(147) - - ; with else - if x>=value - fail_word(148) - else - success++ - - value=30464 - ; direct jump - if x>=value - goto lbl27a - goto skip27a -lbl27a: fail_word(149) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>=value - goto cx16.r3 - goto skip27b -lbl27b: fail_word(150) -skip27b: - ; no else - if x>=value - fail_word(151) - - ; with else - if x>=value - fail_word(152) - else - success++ - - value=32767 - ; direct jump - if x>=value - goto lbl28a - goto skip28a -lbl28a: fail_word(153) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>=value - goto cx16.r3 - goto skip28b -lbl28b: fail_word(154) -skip28b: - ; no else - if x>=value - fail_word(155) - - ; with else - if x>=value - fail_word(156) - else - success++ - - x=170 - value=-21829 - ; direct jump - if x>=value - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>=value - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>=value - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>=value - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>=value - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>=value - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>=value - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>=value - goto lbl34a - goto skip34a -lbl34a: fail_word(157) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>=value - goto cx16.r3 - goto skip34b -lbl34b: fail_word(158) -skip34b: - ; no else - if x>=value - fail_word(159) - - ; with else - if x>=value - fail_word(160) - else - success++ - - value=32767 - ; direct jump - if x>=value - goto lbl35a - goto skip35a -lbl35a: fail_word(161) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>=value - goto cx16.r3 - goto skip35b -lbl35b: fail_word(162) -skip35b: - ; no else - if x>=value - fail_word(163) - - ; with else - if x>=value - fail_word(164) - else - success++ - - x=30464 - value=-21829 - ; direct jump - if x>=value - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>=value - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>=value - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>=value - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>=value - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>=value - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>=value - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>=value - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>=value - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x>=value - goto lbl42a - goto skip42a -lbl42a: fail_word(165) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>=value - goto cx16.r3 - goto skip42b -lbl42b: fail_word(166) -skip42b: - ; no else - if x>=value - fail_word(167) - - ; with else - if x>=value - fail_word(168) - else - success++ - - x=32767 - value=-21829 - ; direct jump - if x>=value - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>=value - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x>=value - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>=value - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x>=value - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>=value - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x>=value - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>=value - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x>=value - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>=value - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x>=value - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>=value - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x>=value - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>=value - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x>=value - success++ - - ; with else - if x>=value - success++ - else - cx16.r0L++ - - verify_success(133) -} - sub test_cmp_array() { - word @shared x - word[] values = [0, 0] - success = 0 - x=-21829 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(169) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(170) -skip2b: - ; no else - if x>=values[1] - fail_word(171) - - ; with else - if x>=values[1] - fail_word(172) - else - success++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(173) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(174) -skip3b: - ; no else - if x>=values[1] - fail_word(175) - - ; with else - if x>=values[1] - fail_word(176) - else - success++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(177) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(178) -skip4b: - ; no else - if x>=values[1] - fail_word(179) - - ; with else - if x>=values[1] - fail_word(180) - else - success++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(181) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(182) -skip5b: - ; no else - if x>=values[1] - fail_word(183) - - ; with else - if x>=values[1] - fail_word(184) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(185) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(186) -skip6b: - ; no else - if x>=values[1] - fail_word(187) - - ; with else - if x>=values[1] - fail_word(188) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(189) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(190) -skip7b: - ; no else - if x>=values[1] - fail_word(191) - - ; with else - if x>=values[1] - fail_word(192) - else - success++ - - x=-1 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(193) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(194) -skip10b: - ; no else - if x>=values[1] - fail_word(195) - - ; with else - if x>=values[1] - fail_word(196) - else - success++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(197) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(198) -skip11b: - ; no else - if x>=values[1] - fail_word(199) - - ; with else - if x>=values[1] - fail_word(200) - else - success++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(201) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(202) -skip12b: - ; no else - if x>=values[1] - fail_word(203) - - ; with else - if x>=values[1] - fail_word(204) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(205) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(206) -skip13b: - ; no else - if x>=values[1] - fail_word(207) - - ; with else - if x>=values[1] - fail_word(208) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(209) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(210) -skip14b: - ; no else - if x>=values[1] - fail_word(211) - - ; with else - if x>=values[1] - fail_word(212) - else - success++ - - x=0 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(213) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>=values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(214) -skip18b: - ; no else - if x>=values[1] - fail_word(215) - - ; with else - if x>=values[1] - fail_word(216) - else - success++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(217) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>=values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(218) -skip19b: - ; no else - if x>=values[1] - fail_word(219) - - ; with else - if x>=values[1] - fail_word(220) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(221) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>=values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(222) -skip20b: - ; no else - if x>=values[1] - fail_word(223) - - ; with else - if x>=values[1] - fail_word(224) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl21a - goto skip21a -lbl21a: fail_word(225) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>=values[1] - goto cx16.r3 - goto skip21b -lbl21b: fail_word(226) -skip21b: - ; no else - if x>=values[1] - fail_word(227) - - ; with else - if x>=values[1] - fail_word(228) - else - success++ - - x=1 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>=values[1] - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>=values[1] - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>=values[1] - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>=values[1] - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl26a - goto skip26a -lbl26a: fail_word(229) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>=values[1] - goto cx16.r3 - goto skip26b -lbl26b: fail_word(230) -skip26b: - ; no else - if x>=values[1] - fail_word(231) - - ; with else - if x>=values[1] - fail_word(232) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl27a - goto skip27a -lbl27a: fail_word(233) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>=values[1] - goto cx16.r3 - goto skip27b -lbl27b: fail_word(234) -skip27b: - ; no else - if x>=values[1] - fail_word(235) - - ; with else - if x>=values[1] - fail_word(236) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl28a - goto skip28a -lbl28a: fail_word(237) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>=values[1] - goto cx16.r3 - goto skip28b -lbl28b: fail_word(238) -skip28b: - ; no else - if x>=values[1] - fail_word(239) - - ; with else - if x>=values[1] - fail_word(240) - else - success++ - - x=170 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>=values[1] - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>=values[1] - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>=values[1] - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>=values[1] - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>=values[1] - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl34a - goto skip34a -lbl34a: fail_word(241) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>=values[1] - goto cx16.r3 - goto skip34b -lbl34b: fail_word(242) -skip34b: - ; no else - if x>=values[1] - fail_word(243) - - ; with else - if x>=values[1] - fail_word(244) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl35a - goto skip35a -lbl35a: fail_word(245) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>=values[1] - goto cx16.r3 - goto skip35b -lbl35b: fail_word(246) -skip35b: - ; no else - if x>=values[1] - fail_word(247) - - ; with else - if x>=values[1] - fail_word(248) - else - success++ - - x=30464 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>=values[1] - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>=values[1] - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>=values[1] - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>=values[1] - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>=values[1] - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>=values[1] - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl42a - goto skip42a -lbl42a: fail_word(249) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>=values[1] - goto cx16.r3 - goto skip42b -lbl42b: fail_word(250) -skip42b: - ; no else - if x>=values[1] - fail_word(251) - - ; with else - if x>=values[1] - fail_word(252) - else - success++ - - x=32767 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>=values[1] - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>=values[1] - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>=values[1] - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>=values[1] - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>=values[1] - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>=values[1] - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>=values[1] - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - verify_success(133) -} - sub test_cmp_expr() { - word @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-21829 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: fail_word(253) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: fail_word(254) -skip2b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - fail_word(255) - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - fail_word(256) - else - success++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: fail_word(257) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: fail_word(258) -skip3b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - fail_word(259) - - ; with else - if x>=cx16.r4s+0-cx16.r5s - fail_word(260) - else - success++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: fail_word(261) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: fail_word(262) -skip4b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - fail_word(263) - - ; with else - if x>=cx16.r4s+1-cx16.r5s - fail_word(264) - else - success++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: fail_word(265) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: fail_word(266) -skip5b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - fail_word(267) - - ; with else - if x>=cx16.r4s+170-cx16.r5s - fail_word(268) - else - success++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: fail_word(269) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: fail_word(270) -skip6b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(271) - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(272) - else - success++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: fail_word(273) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: fail_word(274) -skip7b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(275) - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(276) - else - success++ - - x=-1 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: fail_word(277) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: fail_word(278) -skip10b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - fail_word(279) - - ; with else - if x>=cx16.r4s+0-cx16.r5s - fail_word(280) - else - success++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: fail_word(281) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: fail_word(282) -skip11b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - fail_word(283) - - ; with else - if x>=cx16.r4s+1-cx16.r5s - fail_word(284) - else - success++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: fail_word(285) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: fail_word(286) -skip12b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - fail_word(287) - - ; with else - if x>=cx16.r4s+170-cx16.r5s - fail_word(288) - else - success++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: fail_word(289) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: fail_word(290) -skip13b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(291) - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(292) - else - success++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: fail_word(293) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: fail_word(294) -skip14b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(295) - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(296) - else - success++ - - x=0 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: fail_word(297) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: fail_word(298) -skip18b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - fail_word(299) - - ; with else - if x>=cx16.r4s+1-cx16.r5s - fail_word(300) - else - success++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: fail_word(301) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: fail_word(302) -skip19b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - fail_word(303) - - ; with else - if x>=cx16.r4s+170-cx16.r5s - fail_word(304) - else - success++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: fail_word(305) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: fail_word(306) -skip20b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(307) - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(308) - else - success++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl21a - goto skip21a -lbl21a: fail_word(309) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip21b -lbl21b: fail_word(310) -skip21b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(311) - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(312) - else - success++ - - x=1 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl26a - goto skip26a -lbl26a: fail_word(313) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip26b -lbl26b: fail_word(314) -skip26b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - fail_word(315) - - ; with else - if x>=cx16.r4s+170-cx16.r5s - fail_word(316) - else - success++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl27a - goto skip27a -lbl27a: fail_word(317) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip27b -lbl27b: fail_word(318) -skip27b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(319) - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(320) - else - success++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl28a - goto skip28a -lbl28a: fail_word(321) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip28b -lbl28b: fail_word(322) -skip28b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(323) - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(324) - else - success++ - - x=170 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl34a - goto skip34a -lbl34a: fail_word(325) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip34b -lbl34b: fail_word(326) -skip34b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(327) - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - fail_word(328) - else - success++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl35a - goto skip35a -lbl35a: fail_word(329) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip35b -lbl35b: fail_word(330) -skip35b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(331) - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(332) - else - success++ - - x=30464 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl42a - goto skip42a -lbl42a: fail_word(333) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip42b -lbl42b: fail_word(334) -skip42b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(335) - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - fail_word(336) - else - success++ - - x=32767 - ; direct jump - if x>=cx16.r4s+-21829-cx16.r5s - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+-1-cx16.r5s - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+0-cx16.r5s - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+1-cx16.r5s - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+170-cx16.r5s - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+30464-cx16.r5s - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x>=cx16.r4s+32767-cx16.r5s - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x>=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x>=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - verify_success(133) -} - -} - diff --git a/compiler/test/comparisons/test_word_lt.asm b/compiler/test/comparisons/test_word_lt.asm deleted file mode 100644 index 97006b632..000000000 --- a/compiler/test/comparisons/test_word_lt.asm +++ /dev/null @@ -1,25773 +0,0 @@ -; w65c02 assembly code for 'test_word_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:49 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_lt.p8:9 ubyte success = 0 - ; source: test_word_lt.p8:10 str datatype = "word" - ; source: test_word_lt.p8:11 uword @shared comparison - ; source: test_word_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_lt.p8:14 txt.print("\nless-than tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:76 if x<-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_lt.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_word_lt.p8:79 lbl1a: fail_word(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:80 skip1a: -p8l_skip1a - ; source: test_word_lt.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:83 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_word_lt.p8:86 lbl1b: fail_word(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:87 skip1b: -p8l_skip1b - ; source: test_word_lt.p8:89 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_lt.p8:90 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_3_afterif - ; source: test_word_lt.p8:93 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_lt.p8:94 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_lt.p8:96 success++ - inc p8b_main.p8v_success -label_asm_4_afterif - ; source: test_word_lt.p8:99 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_lt.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_word_lt.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:103 skip2a: -p8l_skip2a - ; source: test_word_lt.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:106 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_word_lt.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:110 skip2b: -p8l_skip2b - ; source: test_word_lt.p8:112 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_6_afterif - ; source: test_word_lt.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_word_lt.p8:116 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_8_else - ; source: test_word_lt.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_lt.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_word_lt.p8:122 if x<0 - lda p8v_x+1 - bmi p8l_lbl3a - ; source: test_word_lt.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_word_lt.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:126 skip3a: -p8l_skip3a - ; source: test_word_lt.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:129 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_word_lt.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:133 skip3b: -p8l_skip3b - ; source: test_word_lt.p8:135 if x<0 - lda p8v_x+1 - bpl label_asm_9_afterif - ; source: test_word_lt.p8:136 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_word_lt.p8:139 if x<0 - lda p8v_x+1 - bpl label_asm_11_else - ; source: test_word_lt.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_lt.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_word_lt.p8:145 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl4a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl4a -+ - ; source: test_word_lt.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_word_lt.p8:148 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:149 skip4a: -p8l_skip4a - ; source: test_word_lt.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:152 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_word_lt.p8:155 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:156 skip4b: -p8l_skip4b - ; source: test_word_lt.p8:158 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_12_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_12_afterif -+ - ; source: test_word_lt.p8:159 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_word_lt.p8:162 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_14_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_14_else -+ - ; source: test_word_lt.p8:163 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_lt.p8:165 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_word_lt.p8:168 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_lt.p8:170 goto skip5a - bra p8l_skip5a - ; source: test_word_lt.p8:171 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:172 skip5a: -p8l_skip5a - ; source: test_word_lt.p8:174 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:175 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:177 goto skip5b - bra p8l_skip5b - ; source: test_word_lt.p8:178 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:179 skip5b: -p8l_skip5b - ; source: test_word_lt.p8:181 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_lt.p8:182 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_word_lt.p8:185 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_lt.p8:186 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_lt.p8:188 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_word_lt.p8:191 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_lt.p8:193 goto skip6a - bra p8l_skip6a - ; source: test_word_lt.p8:194 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:195 skip6a: -p8l_skip6a - ; source: test_word_lt.p8:197 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:198 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:200 goto skip6b - bra p8l_skip6b - ; source: test_word_lt.p8:201 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:202 skip6b: -p8l_skip6b - ; source: test_word_lt.p8:204 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_lt.p8:205 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_word_lt.p8:208 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_lt.p8:209 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_lt.p8:211 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_word_lt.p8:214 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_lt.p8:216 goto skip7a - bra p8l_skip7a - ; source: test_word_lt.p8:217 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:218 skip7a: -p8l_skip7a - ; source: test_word_lt.p8:220 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:221 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:223 goto skip7b - bra p8l_skip7b - ; source: test_word_lt.p8:224 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:225 skip7b: -p8l_skip7b - ; source: test_word_lt.p8:227 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_lt.p8:228 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_word_lt.p8:231 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_lt.p8:232 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_lt.p8:234 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_word_lt.p8:236 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:238 if x<-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_lt.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_word_lt.p8:241 lbl8a: fail_word(5) -p8l_lbl8a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:242 skip8a: -p8l_skip8a - ; source: test_word_lt.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:245 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_word_lt.p8:248 lbl8b: fail_word(6) -p8l_lbl8b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:249 skip8b: -p8l_skip8b - ; source: test_word_lt.p8:251 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_lt.p8:252 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_24_afterif - ; source: test_word_lt.p8:255 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_lt.p8:256 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_lt.p8:258 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_word_lt.p8:261 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_lt.p8:263 goto skip9a - bra p8l_skip9a - ; source: test_word_lt.p8:264 lbl9a: fail_word(9) -p8l_lbl9a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:265 skip9a: -p8l_skip9a - ; source: test_word_lt.p8:267 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:268 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:270 goto skip9b - bra p8l_skip9b - ; source: test_word_lt.p8:271 lbl9b: fail_word(10) -p8l_lbl9b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:272 skip9b: -p8l_skip9b - ; source: test_word_lt.p8:274 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_27_afterif - ; source: test_word_lt.p8:275 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_27_afterif - ; source: test_word_lt.p8:278 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_29_else - ; source: test_word_lt.p8:279 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_lt.p8:281 success++ - inc p8b_main.p8v_success -label_asm_28_afterif - ; source: test_word_lt.p8:284 if x<0 - lda p8v_x+1 - bmi p8l_lbl10a - ; source: test_word_lt.p8:286 goto skip10a - bra p8l_skip10a - ; source: test_word_lt.p8:287 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:288 skip10a: -p8l_skip10a - ; source: test_word_lt.p8:290 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:291 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:293 goto skip10b - bra p8l_skip10b - ; source: test_word_lt.p8:294 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:295 skip10b: -p8l_skip10b - ; source: test_word_lt.p8:297 if x<0 - lda p8v_x+1 - bpl label_asm_30_afterif - ; source: test_word_lt.p8:298 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_word_lt.p8:301 if x<0 - lda p8v_x+1 - bpl label_asm_32_else - ; source: test_word_lt.p8:302 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_lt.p8:304 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_word_lt.p8:307 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl11a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl11a -+ - ; source: test_word_lt.p8:309 goto skip11a - bra p8l_skip11a - ; source: test_word_lt.p8:310 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:311 skip11a: -p8l_skip11a - ; source: test_word_lt.p8:313 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:314 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:316 goto skip11b - bra p8l_skip11b - ; source: test_word_lt.p8:317 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:318 skip11b: -p8l_skip11b - ; source: test_word_lt.p8:320 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_33_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_33_afterif -+ - ; source: test_word_lt.p8:321 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_word_lt.p8:324 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_35_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_35_else -+ - ; source: test_word_lt.p8:325 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_lt.p8:327 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_word_lt.p8:330 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_lt.p8:332 goto skip12a - bra p8l_skip12a - ; source: test_word_lt.p8:333 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:334 skip12a: -p8l_skip12a - ; source: test_word_lt.p8:336 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:337 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:339 goto skip12b - bra p8l_skip12b - ; source: test_word_lt.p8:340 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:341 skip12b: -p8l_skip12b - ; source: test_word_lt.p8:343 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_lt.p8:344 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_word_lt.p8:347 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_lt.p8:348 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_lt.p8:350 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_word_lt.p8:353 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_lt.p8:355 goto skip13a - bra p8l_skip13a - ; source: test_word_lt.p8:356 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:357 skip13a: -p8l_skip13a - ; source: test_word_lt.p8:359 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:360 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:362 goto skip13b - bra p8l_skip13b - ; source: test_word_lt.p8:363 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:364 skip13b: -p8l_skip13b - ; source: test_word_lt.p8:366 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_lt.p8:367 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_word_lt.p8:370 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_lt.p8:371 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_lt.p8:373 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_word_lt.p8:376 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_lt.p8:378 goto skip14a - bra p8l_skip14a - ; source: test_word_lt.p8:379 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:380 skip14a: -p8l_skip14a - ; source: test_word_lt.p8:382 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:383 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:385 goto skip14b - bra p8l_skip14b - ; source: test_word_lt.p8:386 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:387 skip14b: -p8l_skip14b - ; source: test_word_lt.p8:389 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_lt.p8:390 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_word_lt.p8:393 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_lt.p8:394 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_lt.p8:396 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_word_lt.p8:398 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_lt.p8:400 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_lt.p8:402 goto skip15a - bra p8l_skip15a - ; source: test_word_lt.p8:403 lbl15a: fail_word(13) -p8l_lbl15a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:404 skip15a: -p8l_skip15a - ; source: test_word_lt.p8:406 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:407 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:409 goto skip15b - bra p8l_skip15b - ; source: test_word_lt.p8:410 lbl15b: fail_word(14) -p8l_lbl15b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:411 skip15b: -p8l_skip15b - ; source: test_word_lt.p8:413 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_lt.p8:414 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_45_afterif - ; source: test_word_lt.p8:417 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_lt.p8:418 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_lt.p8:420 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_word_lt.p8:423 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_lt.p8:425 goto skip16a - bra p8l_skip16a - ; source: test_word_lt.p8:426 lbl16a: fail_word(17) -p8l_lbl16a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:427 skip16a: -p8l_skip16a - ; source: test_word_lt.p8:429 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:430 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:432 goto skip16b - bra p8l_skip16b - ; source: test_word_lt.p8:433 lbl16b: fail_word(18) -p8l_lbl16b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:434 skip16b: -p8l_skip16b - ; source: test_word_lt.p8:436 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_48_afterif - ; source: test_word_lt.p8:437 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_48_afterif - ; source: test_word_lt.p8:440 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_50_else - ; source: test_word_lt.p8:441 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_lt.p8:443 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_word_lt.p8:446 if x<0 - lda p8v_x+1 - bmi p8l_lbl17a - ; source: test_word_lt.p8:448 goto skip17a - bra p8l_skip17a - ; source: test_word_lt.p8:449 lbl17a: fail_word(21) -p8l_lbl17a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:450 skip17a: -p8l_skip17a - ; source: test_word_lt.p8:452 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:453 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:455 goto skip17b - bra p8l_skip17b - ; source: test_word_lt.p8:456 lbl17b: fail_word(22) -p8l_lbl17b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:457 skip17b: -p8l_skip17b - ; source: test_word_lt.p8:459 if x<0 - lda p8v_x+1 - bpl label_asm_51_afterif - ; source: test_word_lt.p8:460 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_51_afterif - ; source: test_word_lt.p8:463 if x<0 - lda p8v_x+1 - bpl label_asm_53_else - ; source: test_word_lt.p8:464 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_lt.p8:466 success++ - inc p8b_main.p8v_success -label_asm_52_afterif - ; source: test_word_lt.p8:469 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl18a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl18a -+ - ; source: test_word_lt.p8:471 goto skip18a - bra p8l_skip18a - ; source: test_word_lt.p8:472 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:473 skip18a: -p8l_skip18a - ; source: test_word_lt.p8:475 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:476 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:478 goto skip18b - bra p8l_skip18b - ; source: test_word_lt.p8:479 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:480 skip18b: -p8l_skip18b - ; source: test_word_lt.p8:482 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_54_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_54_afterif -+ - ; source: test_word_lt.p8:483 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_word_lt.p8:486 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_56_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_56_else -+ - ; source: test_word_lt.p8:487 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_lt.p8:489 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_word_lt.p8:492 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_lt.p8:494 goto skip19a - bra p8l_skip19a - ; source: test_word_lt.p8:495 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:496 skip19a: -p8l_skip19a - ; source: test_word_lt.p8:498 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:499 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:501 goto skip19b - bra p8l_skip19b - ; source: test_word_lt.p8:502 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:503 skip19b: -p8l_skip19b - ; source: test_word_lt.p8:505 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_lt.p8:506 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_word_lt.p8:509 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_lt.p8:510 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_lt.p8:512 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_word_lt.p8:515 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_lt.p8:517 goto skip20a - bra p8l_skip20a - ; source: test_word_lt.p8:518 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:519 skip20a: -p8l_skip20a - ; source: test_word_lt.p8:521 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:522 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:524 goto skip20b - bra p8l_skip20b - ; source: test_word_lt.p8:525 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:526 skip20b: -p8l_skip20b - ; source: test_word_lt.p8:528 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_lt.p8:529 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_word_lt.p8:532 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_lt.p8:533 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_lt.p8:535 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_word_lt.p8:538 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_lt.p8:540 goto skip21a - bra p8l_skip21a - ; source: test_word_lt.p8:541 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:542 skip21a: -p8l_skip21a - ; source: test_word_lt.p8:544 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:545 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:547 goto skip21b - bra p8l_skip21b - ; source: test_word_lt.p8:548 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:549 skip21b: -p8l_skip21b - ; source: test_word_lt.p8:551 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_lt.p8:552 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_word_lt.p8:555 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_lt.p8:556 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_lt.p8:558 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_word_lt.p8:560 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:562 if x<-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_lt.p8:564 goto skip22a - bra p8l_skip22a - ; source: test_word_lt.p8:565 lbl22a: fail_word(25) -p8l_lbl22a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:566 skip22a: -p8l_skip22a - ; source: test_word_lt.p8:568 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:569 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:571 goto skip22b - bra p8l_skip22b - ; source: test_word_lt.p8:572 lbl22b: fail_word(26) -p8l_lbl22b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:573 skip22b: -p8l_skip22b - ; source: test_word_lt.p8:575 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_lt.p8:576 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_66_afterif - ; source: test_word_lt.p8:579 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_lt.p8:580 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_lt.p8:582 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_word_lt.p8:585 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_lt.p8:587 goto skip23a - bra p8l_skip23a - ; source: test_word_lt.p8:588 lbl23a: fail_word(29) -p8l_lbl23a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:589 skip23a: -p8l_skip23a - ; source: test_word_lt.p8:591 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:592 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:594 goto skip23b - bra p8l_skip23b - ; source: test_word_lt.p8:595 lbl23b: fail_word(30) -p8l_lbl23b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:596 skip23b: -p8l_skip23b - ; source: test_word_lt.p8:598 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_69_afterif - ; source: test_word_lt.p8:599 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_69_afterif - ; source: test_word_lt.p8:602 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_71_else - ; source: test_word_lt.p8:603 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_lt.p8:605 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_word_lt.p8:608 if x<0 - lda p8v_x+1 - bmi p8l_lbl24a - ; source: test_word_lt.p8:610 goto skip24a - bra p8l_skip24a - ; source: test_word_lt.p8:611 lbl24a: fail_word(33) -p8l_lbl24a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:612 skip24a: -p8l_skip24a - ; source: test_word_lt.p8:614 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:615 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:617 goto skip24b - bra p8l_skip24b - ; source: test_word_lt.p8:618 lbl24b: fail_word(34) -p8l_lbl24b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:619 skip24b: -p8l_skip24b - ; source: test_word_lt.p8:621 if x<0 - lda p8v_x+1 - bpl label_asm_72_afterif - ; source: test_word_lt.p8:622 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_72_afterif - ; source: test_word_lt.p8:625 if x<0 - lda p8v_x+1 - bpl label_asm_74_else - ; source: test_word_lt.p8:626 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_lt.p8:628 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_word_lt.p8:631 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl25a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl25a -+ - ; source: test_word_lt.p8:633 goto skip25a - bra p8l_skip25a - ; source: test_word_lt.p8:634 lbl25a: fail_word(37) -p8l_lbl25a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:635 skip25a: -p8l_skip25a - ; source: test_word_lt.p8:637 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:638 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:640 goto skip25b - bra p8l_skip25b - ; source: test_word_lt.p8:641 lbl25b: fail_word(38) -p8l_lbl25b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:642 skip25b: -p8l_skip25b - ; source: test_word_lt.p8:644 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_75_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_75_afterif -+ - ; source: test_word_lt.p8:645 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_75_afterif - ; source: test_word_lt.p8:648 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_77_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_77_else -+ - ; source: test_word_lt.p8:649 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_lt.p8:651 success++ - inc p8b_main.p8v_success -label_asm_76_afterif - ; source: test_word_lt.p8:654 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_lt.p8:656 goto skip26a - bra p8l_skip26a - ; source: test_word_lt.p8:657 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:658 skip26a: -p8l_skip26a - ; source: test_word_lt.p8:660 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:661 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:663 goto skip26b - bra p8l_skip26b - ; source: test_word_lt.p8:664 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:665 skip26b: -p8l_skip26b - ; source: test_word_lt.p8:667 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_lt.p8:668 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_word_lt.p8:671 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_lt.p8:672 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_lt.p8:674 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_word_lt.p8:677 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_lt.p8:679 goto skip27a - bra p8l_skip27a - ; source: test_word_lt.p8:680 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:681 skip27a: -p8l_skip27a - ; source: test_word_lt.p8:683 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:684 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:686 goto skip27b - bra p8l_skip27b - ; source: test_word_lt.p8:687 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:688 skip27b: -p8l_skip27b - ; source: test_word_lt.p8:690 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_lt.p8:691 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_word_lt.p8:694 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_lt.p8:695 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_lt.p8:697 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_word_lt.p8:700 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_lt.p8:702 goto skip28a - bra p8l_skip28a - ; source: test_word_lt.p8:703 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:704 skip28a: -p8l_skip28a - ; source: test_word_lt.p8:706 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:707 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:709 goto skip28b - bra p8l_skip28b - ; source: test_word_lt.p8:710 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:711 skip28b: -p8l_skip28b - ; source: test_word_lt.p8:713 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_lt.p8:714 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_word_lt.p8:717 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_lt.p8:718 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_lt.p8:720 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_word_lt.p8:722 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:724 if x<-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_lt.p8:726 goto skip29a - bra p8l_skip29a - ; source: test_word_lt.p8:727 lbl29a: fail_word(41) -p8l_lbl29a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:728 skip29a: -p8l_skip29a - ; source: test_word_lt.p8:730 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:731 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:733 goto skip29b - bra p8l_skip29b - ; source: test_word_lt.p8:734 lbl29b: fail_word(42) -p8l_lbl29b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:735 skip29b: -p8l_skip29b - ; source: test_word_lt.p8:737 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_lt.p8:738 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_87_afterif - ; source: test_word_lt.p8:741 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_lt.p8:742 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_lt.p8:744 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_word_lt.p8:747 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_lt.p8:749 goto skip30a - bra p8l_skip30a - ; source: test_word_lt.p8:750 lbl30a: fail_word(45) -p8l_lbl30a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:751 skip30a: -p8l_skip30a - ; source: test_word_lt.p8:753 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:754 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:756 goto skip30b - bra p8l_skip30b - ; source: test_word_lt.p8:757 lbl30b: fail_word(46) -p8l_lbl30b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:758 skip30b: -p8l_skip30b - ; source: test_word_lt.p8:760 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_90_afterif - ; source: test_word_lt.p8:761 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_90_afterif - ; source: test_word_lt.p8:764 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_92_else - ; source: test_word_lt.p8:765 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_lt.p8:767 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_word_lt.p8:770 if x<0 - lda p8v_x+1 - bmi p8l_lbl31a - ; source: test_word_lt.p8:772 goto skip31a - bra p8l_skip31a - ; source: test_word_lt.p8:773 lbl31a: fail_word(49) -p8l_lbl31a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:774 skip31a: -p8l_skip31a - ; source: test_word_lt.p8:776 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:777 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:779 goto skip31b - bra p8l_skip31b - ; source: test_word_lt.p8:780 lbl31b: fail_word(50) -p8l_lbl31b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:781 skip31b: -p8l_skip31b - ; source: test_word_lt.p8:783 if x<0 - lda p8v_x+1 - bpl label_asm_93_afterif - ; source: test_word_lt.p8:784 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_93_afterif - ; source: test_word_lt.p8:787 if x<0 - lda p8v_x+1 - bpl label_asm_95_else - ; source: test_word_lt.p8:788 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_lt.p8:790 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_word_lt.p8:793 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl32a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl32a -+ - ; source: test_word_lt.p8:795 goto skip32a - bra p8l_skip32a - ; source: test_word_lt.p8:796 lbl32a: fail_word(53) -p8l_lbl32a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:797 skip32a: -p8l_skip32a - ; source: test_word_lt.p8:799 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:800 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:802 goto skip32b - bra p8l_skip32b - ; source: test_word_lt.p8:803 lbl32b: fail_word(54) -p8l_lbl32b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:804 skip32b: -p8l_skip32b - ; source: test_word_lt.p8:806 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_96_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_96_afterif -+ - ; source: test_word_lt.p8:807 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_96_afterif - ; source: test_word_lt.p8:810 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_98_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_98_else -+ - ; source: test_word_lt.p8:811 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_lt.p8:813 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_word_lt.p8:816 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_lt.p8:818 goto skip33a - bra p8l_skip33a - ; source: test_word_lt.p8:819 lbl33a: fail_word(57) -p8l_lbl33a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:820 skip33a: -p8l_skip33a - ; source: test_word_lt.p8:822 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:823 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:825 goto skip33b - bra p8l_skip33b - ; source: test_word_lt.p8:826 lbl33b: fail_word(58) -p8l_lbl33b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:827 skip33b: -p8l_skip33b - ; source: test_word_lt.p8:829 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_lt.p8:830 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_99_afterif - ; source: test_word_lt.p8:833 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_lt.p8:834 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_lt.p8:836 success++ - inc p8b_main.p8v_success -label_asm_100_afterif - ; source: test_word_lt.p8:839 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_lt.p8:841 goto skip34a - bra p8l_skip34a - ; source: test_word_lt.p8:842 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:843 skip34a: -p8l_skip34a - ; source: test_word_lt.p8:845 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:846 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:848 goto skip34b - bra p8l_skip34b - ; source: test_word_lt.p8:849 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:850 skip34b: -p8l_skip34b - ; source: test_word_lt.p8:852 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_lt.p8:853 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_word_lt.p8:856 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_lt.p8:857 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_lt.p8:859 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_word_lt.p8:862 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_lt.p8:864 goto skip35a - bra p8l_skip35a - ; source: test_word_lt.p8:865 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:866 skip35a: -p8l_skip35a - ; source: test_word_lt.p8:868 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:869 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:871 goto skip35b - bra p8l_skip35b - ; source: test_word_lt.p8:872 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:873 skip35b: -p8l_skip35b - ; source: test_word_lt.p8:875 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_lt.p8:876 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_word_lt.p8:879 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_lt.p8:880 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_lt.p8:882 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_word_lt.p8:884 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:886 if x<-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_lt.p8:888 goto skip36a - bra p8l_skip36a - ; source: test_word_lt.p8:889 lbl36a: fail_word(61) -p8l_lbl36a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:890 skip36a: -p8l_skip36a - ; source: test_word_lt.p8:892 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:893 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:895 goto skip36b - bra p8l_skip36b - ; source: test_word_lt.p8:896 lbl36b: fail_word(62) -p8l_lbl36b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:897 skip36b: -p8l_skip36b - ; source: test_word_lt.p8:899 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_lt.p8:900 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_108_afterif - ; source: test_word_lt.p8:903 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_lt.p8:904 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_lt.p8:906 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_word_lt.p8:909 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_lt.p8:911 goto skip37a - bra p8l_skip37a - ; source: test_word_lt.p8:912 lbl37a: fail_word(65) -p8l_lbl37a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:913 skip37a: -p8l_skip37a - ; source: test_word_lt.p8:915 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:916 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:918 goto skip37b - bra p8l_skip37b - ; source: test_word_lt.p8:919 lbl37b: fail_word(66) -p8l_lbl37b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:920 skip37b: -p8l_skip37b - ; source: test_word_lt.p8:922 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_111_afterif - ; source: test_word_lt.p8:923 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_111_afterif - ; source: test_word_lt.p8:926 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_113_else - ; source: test_word_lt.p8:927 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_lt.p8:929 success++ - inc p8b_main.p8v_success -label_asm_112_afterif - ; source: test_word_lt.p8:932 if x<0 - lda p8v_x+1 - bmi p8l_lbl38a - ; source: test_word_lt.p8:934 goto skip38a - bra p8l_skip38a - ; source: test_word_lt.p8:935 lbl38a: fail_word(69) -p8l_lbl38a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:936 skip38a: -p8l_skip38a - ; source: test_word_lt.p8:938 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:939 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:941 goto skip38b - bra p8l_skip38b - ; source: test_word_lt.p8:942 lbl38b: fail_word(70) -p8l_lbl38b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:943 skip38b: -p8l_skip38b - ; source: test_word_lt.p8:945 if x<0 - lda p8v_x+1 - bpl label_asm_114_afterif - ; source: test_word_lt.p8:946 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_114_afterif - ; source: test_word_lt.p8:949 if x<0 - lda p8v_x+1 - bpl label_asm_116_else - ; source: test_word_lt.p8:950 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_lt.p8:952 success++ - inc p8b_main.p8v_success -label_asm_115_afterif - ; source: test_word_lt.p8:955 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl39a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl39a -+ - ; source: test_word_lt.p8:957 goto skip39a - bra p8l_skip39a - ; source: test_word_lt.p8:958 lbl39a: fail_word(73) -p8l_lbl39a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:959 skip39a: -p8l_skip39a - ; source: test_word_lt.p8:961 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:962 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:964 goto skip39b - bra p8l_skip39b - ; source: test_word_lt.p8:965 lbl39b: fail_word(74) -p8l_lbl39b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:966 skip39b: -p8l_skip39b - ; source: test_word_lt.p8:968 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_117_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_117_afterif -+ - ; source: test_word_lt.p8:969 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_117_afterif - ; source: test_word_lt.p8:972 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_119_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_119_else -+ - ; source: test_word_lt.p8:973 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_lt.p8:975 success++ - inc p8b_main.p8v_success -label_asm_118_afterif - ; source: test_word_lt.p8:978 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_lt.p8:980 goto skip40a - bra p8l_skip40a - ; source: test_word_lt.p8:981 lbl40a: fail_word(77) -p8l_lbl40a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:982 skip40a: -p8l_skip40a - ; source: test_word_lt.p8:984 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:985 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:987 goto skip40b - bra p8l_skip40b - ; source: test_word_lt.p8:988 lbl40b: fail_word(78) -p8l_lbl40b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:989 skip40b: -p8l_skip40b - ; source: test_word_lt.p8:991 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_lt.p8:992 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_120_afterif - ; source: test_word_lt.p8:995 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_lt.p8:996 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_lt.p8:998 success++ - inc p8b_main.p8v_success -label_asm_121_afterif - ; source: test_word_lt.p8:1001 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_lt.p8:1003 goto skip41a - bra p8l_skip41a - ; source: test_word_lt.p8:1004 lbl41a: fail_word(81) -p8l_lbl41a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1005 skip41a: -p8l_skip41a - ; source: test_word_lt.p8:1007 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1008 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1010 goto skip41b - bra p8l_skip41b - ; source: test_word_lt.p8:1011 lbl41b: fail_word(82) -p8l_lbl41b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1012 skip41b: -p8l_skip41b - ; source: test_word_lt.p8:1014 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_lt.p8:1015 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_123_afterif - ; source: test_word_lt.p8:1018 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_lt.p8:1019 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_lt.p8:1021 success++ - inc p8b_main.p8v_success -label_asm_124_afterif - ; source: test_word_lt.p8:1024 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_lt.p8:1026 goto skip42a - bra p8l_skip42a - ; source: test_word_lt.p8:1027 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:1028 skip42a: -p8l_skip42a - ; source: test_word_lt.p8:1030 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1031 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1033 goto skip42b - bra p8l_skip42b - ; source: test_word_lt.p8:1034 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:1035 skip42b: -p8l_skip42b - ; source: test_word_lt.p8:1037 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_lt.p8:1038 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_word_lt.p8:1041 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_lt.p8:1042 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_lt.p8:1044 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_word_lt.p8:1046 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:1048 if x<-21829 - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_lt.p8:1050 goto skip43a - bra p8l_skip43a - ; source: test_word_lt.p8:1051 lbl43a: fail_word(85) -p8l_lbl43a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1052 skip43a: -p8l_skip43a - ; source: test_word_lt.p8:1054 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1055 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1057 goto skip43b - bra p8l_skip43b - ; source: test_word_lt.p8:1058 lbl43b: fail_word(86) -p8l_lbl43b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1059 skip43b: -p8l_skip43b - ; source: test_word_lt.p8:1061 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_lt.p8:1062 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_129_afterif - ; source: test_word_lt.p8:1065 if x<-21829 - ldy p8v_x+1 - lda p8v_x - cmp #<-$5545 - tya - sbc #>-$5545 - bvs + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_lt.p8:1066 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_lt.p8:1068 success++ - inc p8b_main.p8v_success -label_asm_130_afterif - ; source: test_word_lt.p8:1071 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_lt.p8:1073 goto skip44a - bra p8l_skip44a - ; source: test_word_lt.p8:1074 lbl44a: fail_word(89) -p8l_lbl44a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1075 skip44a: -p8l_skip44a - ; source: test_word_lt.p8:1077 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1078 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1080 goto skip44b - bra p8l_skip44b - ; source: test_word_lt.p8:1081 lbl44b: fail_word(90) -p8l_lbl44b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1082 skip44b: -p8l_skip44b - ; source: test_word_lt.p8:1084 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_132_afterif - ; source: test_word_lt.p8:1085 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_132_afterif - ; source: test_word_lt.p8:1088 if x<-1 - ldy p8v_x+1 - lda p8v_x - cmp #<-1 - tya - sbc #>-1 - bvs + - eor #128 -+ bmi label_asm_134_else - ; source: test_word_lt.p8:1089 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_lt.p8:1091 success++ - inc p8b_main.p8v_success -label_asm_133_afterif - ; source: test_word_lt.p8:1094 if x<0 - lda p8v_x+1 - bmi p8l_lbl45a - ; source: test_word_lt.p8:1096 goto skip45a - bra p8l_skip45a - ; source: test_word_lt.p8:1097 lbl45a: fail_word(93) -p8l_lbl45a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1098 skip45a: -p8l_skip45a - ; source: test_word_lt.p8:1100 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1101 if x<0 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1103 goto skip45b - bra p8l_skip45b - ; source: test_word_lt.p8:1104 lbl45b: fail_word(94) -p8l_lbl45b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1105 skip45b: -p8l_skip45b - ; source: test_word_lt.p8:1107 if x<0 - lda p8v_x+1 - bpl label_asm_135_afterif - ; source: test_word_lt.p8:1108 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_135_afterif - ; source: test_word_lt.p8:1111 if x<0 - lda p8v_x+1 - bpl label_asm_137_else - ; source: test_word_lt.p8:1112 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_lt.p8:1114 success++ - inc p8b_main.p8v_success -label_asm_136_afterif - ; source: test_word_lt.p8:1117 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl46a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl46a -+ - ; source: test_word_lt.p8:1119 goto skip46a - bra p8l_skip46a - ; source: test_word_lt.p8:1120 lbl46a: fail_word(97) -p8l_lbl46a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1121 skip46a: -p8l_skip46a - ; source: test_word_lt.p8:1123 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1124 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1126 goto skip46b - bra p8l_skip46b - ; source: test_word_lt.p8:1127 lbl46b: fail_word(98) -p8l_lbl46b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1128 skip46b: -p8l_skip46b - ; source: test_word_lt.p8:1130 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_138_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_138_afterif -+ - ; source: test_word_lt.p8:1131 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_138_afterif - ; source: test_word_lt.p8:1134 if x<1 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_140_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_140_else -+ - ; source: test_word_lt.p8:1135 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_lt.p8:1137 success++ - inc p8b_main.p8v_success -label_asm_139_afterif - ; source: test_word_lt.p8:1140 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_lt.p8:1142 goto skip47a - bra p8l_skip47a - ; source: test_word_lt.p8:1143 lbl47a: fail_word(101) -p8l_lbl47a - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1144 skip47a: -p8l_skip47a - ; source: test_word_lt.p8:1146 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1147 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1149 goto skip47b - bra p8l_skip47b - ; source: test_word_lt.p8:1150 lbl47b: fail_word(102) -p8l_lbl47b - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1151 skip47b: -p8l_skip47b - ; source: test_word_lt.p8:1153 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_lt.p8:1154 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_141_afterif - ; source: test_word_lt.p8:1157 if x<170 - ldy p8v_x+1 - lda p8v_x - cmp #<$aa - tya - sbc #>$aa - bvs + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_lt.p8:1158 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_lt.p8:1160 success++ - inc p8b_main.p8v_success -label_asm_142_afterif - ; source: test_word_lt.p8:1163 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_lt.p8:1165 goto skip48a - bra p8l_skip48a - ; source: test_word_lt.p8:1166 lbl48a: fail_word(105) -p8l_lbl48a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1167 skip48a: -p8l_skip48a - ; source: test_word_lt.p8:1169 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1170 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1172 goto skip48b - bra p8l_skip48b - ; source: test_word_lt.p8:1173 lbl48b: fail_word(106) -p8l_lbl48b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1174 skip48b: -p8l_skip48b - ; source: test_word_lt.p8:1176 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_lt.p8:1177 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_144_afterif - ; source: test_word_lt.p8:1180 if x<30464 - ldy p8v_x+1 - lda p8v_x - cmp #<$7700 - tya - sbc #>$7700 - bvs + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_lt.p8:1181 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_lt.p8:1183 success++ - inc p8b_main.p8v_success -label_asm_145_afterif - ; source: test_word_lt.p8:1186 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_lt.p8:1188 goto skip49a - bra p8l_skip49a - ; source: test_word_lt.p8:1189 lbl49a: fail_word(109) -p8l_lbl49a - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1190 skip49a: -p8l_skip49a - ; source: test_word_lt.p8:1192 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1193 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:1195 goto skip49b - bra p8l_skip49b - ; source: test_word_lt.p8:1196 lbl49b: fail_word(110) -p8l_lbl49b - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1197 skip49b: -p8l_skip49b - ; source: test_word_lt.p8:1199 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_lt.p8:1200 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_147_afterif - ; source: test_word_lt.p8:1203 if x<32767 - ldy p8v_x+1 - lda p8v_x - cmp #<$7fff - tya - sbc #>$7fff - bvs + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_lt.p8:1204 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_lt.p8:1206 success++ - inc p8b_main.p8v_success -label_asm_148_afterif - ; source: test_word_lt.p8:1208 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_lt.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_lt.p8:1210 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_word_lt.p8:1211 word @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_word_lt.p8:1212 success = 0 - stz p8b_main.p8v_success - ; source: test_word_lt.p8:1213 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:1214 value=-21829 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1216 if x$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1220 skip1a: -p8l_skip1a - ; source: test_word_lt.p8:1222 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1223 if x$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1227 skip1b: -p8l_skip1b - ; source: test_word_lt.p8:1229 if x$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_150_afterif - ; source: test_word_lt.p8:1233 if x$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_lt.p8:1236 success++ - inc p8b_main.p8v_success -label_asm_151_afterif - ; source: test_word_lt.p8:1238 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1240 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1247 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1271 if x1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1288 if xp8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1295 if x$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1312 if xp8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1319 if x$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1336 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1343 if x$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1360 if xp8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1367 if x-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:1383 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1385 if x$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1389 skip8a: -p8l_skip8a - ; source: test_word_lt.p8:1391 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1392 if x$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1396 skip8b: -p8l_skip8b - ; source: test_word_lt.p8:1398 if x$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_171_afterif - ; source: test_word_lt.p8:1402 if x$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_lt.p8:1405 success++ - inc p8b_main.p8v_success -label_asm_172_afterif - ; source: test_word_lt.p8:1407 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1409 if x$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1413 skip9a: -p8l_skip9a - ; source: test_word_lt.p8:1415 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1416 if x$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1420 skip9b: -p8l_skip9b - ; source: test_word_lt.p8:1422 if x$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_174_afterif - ; source: test_word_lt.p8:1426 if x$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_lt.p8:1429 success++ - inc p8b_main.p8v_success -label_asm_175_afterif - ; source: test_word_lt.p8:1431 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lt.p8:1433 if xp8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1440 if x1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1457 if xp8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1464 if x$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1481 if xp8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1488 if x$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1505 if xp8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1512 if x$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1529 if xp8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1536 if x-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1554 if x$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1558 skip15a: -p8l_skip15a - ; source: test_word_lt.p8:1560 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1561 if x$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1565 skip15b: -p8l_skip15b - ; source: test_word_lt.p8:1567 if x$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_192_afterif - ; source: test_word_lt.p8:1571 if x$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_lt.p8:1574 success++ - inc p8b_main.p8v_success -label_asm_193_afterif - ; source: test_word_lt.p8:1576 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1578 if x$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1582 skip16a: -p8l_skip16a - ; source: test_word_lt.p8:1584 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1585 if x$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1589 skip16b: -p8l_skip16b - ; source: test_word_lt.p8:1591 if x$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_195_afterif - ; source: test_word_lt.p8:1595 if x$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_lt.p8:1598 success++ - inc p8b_main.p8v_success -label_asm_196_afterif - ; source: test_word_lt.p8:1600 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lt.p8:1602 if x$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1606 skip17a: -p8l_skip17a - ; source: test_word_lt.p8:1608 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1609 if x$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1613 skip17b: -p8l_skip17b - ; source: test_word_lt.p8:1615 if x$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_198_afterif - ; source: test_word_lt.p8:1619 if x$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_lt.p8:1622 success++ - inc p8b_main.p8v_success -label_asm_199_afterif - ; source: test_word_lt.p8:1624 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1626 if xp8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1633 if x$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1650 if xp8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1657 if x$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1674 if xp8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1681 if x$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1698 if xp8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1705 if x1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:1721 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1723 if x$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1727 skip22a: -p8l_skip22a - ; source: test_word_lt.p8:1729 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1730 if x$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1734 skip22b: -p8l_skip22b - ; source: test_word_lt.p8:1736 if x$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_213_afterif - ; source: test_word_lt.p8:1740 if x$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_lt.p8:1743 success++ - inc p8b_main.p8v_success -label_asm_214_afterif - ; source: test_word_lt.p8:1745 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1747 if x$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1751 skip23a: -p8l_skip23a - ; source: test_word_lt.p8:1753 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1754 if x$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1758 skip23b: -p8l_skip23b - ; source: test_word_lt.p8:1760 if x$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_216_afterif - ; source: test_word_lt.p8:1764 if x$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_lt.p8:1767 success++ - inc p8b_main.p8v_success -label_asm_217_afterif - ; source: test_word_lt.p8:1769 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lt.p8:1771 if x$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1775 skip24a: -p8l_skip24a - ; source: test_word_lt.p8:1777 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1778 if x$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1782 skip24b: -p8l_skip24b - ; source: test_word_lt.p8:1784 if x$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_219_afterif - ; source: test_word_lt.p8:1788 if x$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_lt.p8:1791 success++ - inc p8b_main.p8v_success -label_asm_220_afterif - ; source: test_word_lt.p8:1793 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1795 if x$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1799 skip25a: -p8l_skip25a - ; source: test_word_lt.p8:1801 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1802 if x$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1806 skip25b: -p8l_skip25b - ; source: test_word_lt.p8:1808 if x$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_222_afterif - ; source: test_word_lt.p8:1812 if x$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_lt.p8:1815 success++ - inc p8b_main.p8v_success -label_asm_223_afterif - ; source: test_word_lt.p8:1817 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1819 if xp8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1826 if x$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1843 if xp8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1850 if x$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1867 if xp8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1874 if x$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:1890 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1892 if x$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1896 skip29a: -p8l_skip29a - ; source: test_word_lt.p8:1898 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1899 if x$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1903 skip29b: -p8l_skip29b - ; source: test_word_lt.p8:1905 if x$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_234_afterif - ; source: test_word_lt.p8:1909 if x$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_lt.p8:1912 success++ - inc p8b_main.p8v_success -label_asm_235_afterif - ; source: test_word_lt.p8:1914 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1916 if x$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1920 skip30a: -p8l_skip30a - ; source: test_word_lt.p8:1922 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1923 if x$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1927 skip30b: -p8l_skip30b - ; source: test_word_lt.p8:1929 if x$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_237_afterif - ; source: test_word_lt.p8:1933 if x$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_lt.p8:1936 success++ - inc p8b_main.p8v_success -label_asm_238_afterif - ; source: test_word_lt.p8:1938 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lt.p8:1940 if x$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1944 skip31a: -p8l_skip31a - ; source: test_word_lt.p8:1946 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1947 if x$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1951 skip31b: -p8l_skip31b - ; source: test_word_lt.p8:1953 if x$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_240_afterif - ; source: test_word_lt.p8:1957 if x$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_lt.p8:1960 success++ - inc p8b_main.p8v_success -label_asm_241_afterif - ; source: test_word_lt.p8:1962 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1964 if x$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1968 skip32a: -p8l_skip32a - ; source: test_word_lt.p8:1970 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1971 if x$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1975 skip32b: -p8l_skip32b - ; source: test_word_lt.p8:1977 if x$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_243_afterif - ; source: test_word_lt.p8:1981 if x$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_lt.p8:1984 success++ - inc p8b_main.p8v_success -label_asm_244_afterif - ; source: test_word_lt.p8:1986 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:1988 if x$a9 - lda #<$a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1992 skip33a: -p8l_skip33a - ; source: test_word_lt.p8:1994 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:1995 if x$aa - lda #<$aa - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:1999 skip33b: -p8l_skip33b - ; source: test_word_lt.p8:2001 if x$ab - lda #<$ab - jsr p8b_main.p8s_fail_word -label_asm_246_afterif - ; source: test_word_lt.p8:2005 if x$ac - lda #<$ac - jsr p8b_main.p8s_fail_word - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_lt.p8:2008 success++ - inc p8b_main.p8v_success -label_asm_247_afterif - ; source: test_word_lt.p8:2010 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2012 if xp8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2019 if x$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2036 if xp8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2043 if x$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:2059 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2061 if x$ad - lda #<$ad - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2065 skip36a: -p8l_skip36a - ; source: test_word_lt.p8:2067 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2068 if x$ae - lda #<$ae - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2072 skip36b: -p8l_skip36b - ; source: test_word_lt.p8:2074 if x$af - lda #<$af - jsr p8b_main.p8s_fail_word -label_asm_255_afterif - ; source: test_word_lt.p8:2078 if x$b0 - lda #<$b0 - jsr p8b_main.p8s_fail_word - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_lt.p8:2081 success++ - inc p8b_main.p8v_success -label_asm_256_afterif - ; source: test_word_lt.p8:2083 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2085 if x$b1 - lda #<$b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2089 skip37a: -p8l_skip37a - ; source: test_word_lt.p8:2091 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2092 if x$b2 - lda #<$b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2096 skip37b: -p8l_skip37b - ; source: test_word_lt.p8:2098 if x$b3 - lda #<$b3 - jsr p8b_main.p8s_fail_word -label_asm_258_afterif - ; source: test_word_lt.p8:2102 if x$b4 - lda #<$b4 - jsr p8b_main.p8s_fail_word - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_lt.p8:2105 success++ - inc p8b_main.p8v_success -label_asm_259_afterif - ; source: test_word_lt.p8:2107 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lt.p8:2109 if x$b5 - lda #<$b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2113 skip38a: -p8l_skip38a - ; source: test_word_lt.p8:2115 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2116 if x$b6 - lda #<$b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2120 skip38b: -p8l_skip38b - ; source: test_word_lt.p8:2122 if x$b7 - lda #<$b7 - jsr p8b_main.p8s_fail_word -label_asm_261_afterif - ; source: test_word_lt.p8:2126 if x$b8 - lda #<$b8 - jsr p8b_main.p8s_fail_word - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_lt.p8:2129 success++ - inc p8b_main.p8v_success -label_asm_262_afterif - ; source: test_word_lt.p8:2131 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2133 if x$b9 - lda #<$b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2137 skip39a: -p8l_skip39a - ; source: test_word_lt.p8:2139 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2140 if x$ba - lda #<$ba - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2144 skip39b: -p8l_skip39b - ; source: test_word_lt.p8:2146 if x$bb - lda #<$bb - jsr p8b_main.p8s_fail_word -label_asm_264_afterif - ; source: test_word_lt.p8:2150 if x$bc - lda #<$bc - jsr p8b_main.p8s_fail_word - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_lt.p8:2153 success++ - inc p8b_main.p8v_success -label_asm_265_afterif - ; source: test_word_lt.p8:2155 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2157 if x$bd - lda #<$bd - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2161 skip40a: -p8l_skip40a - ; source: test_word_lt.p8:2163 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2164 if x$be - lda #<$be - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2168 skip40b: -p8l_skip40b - ; source: test_word_lt.p8:2170 if x$bf - lda #<$bf - jsr p8b_main.p8s_fail_word -label_asm_267_afterif - ; source: test_word_lt.p8:2174 if x$c0 - lda #<$c0 - jsr p8b_main.p8s_fail_word - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_lt.p8:2177 success++ - inc p8b_main.p8v_success -label_asm_268_afterif - ; source: test_word_lt.p8:2179 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2181 if x$c1 - lda #<$c1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2185 skip41a: -p8l_skip41a - ; source: test_word_lt.p8:2187 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2188 if x$c2 - lda #<$c2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2192 skip41b: -p8l_skip41b - ; source: test_word_lt.p8:2194 if x$c3 - lda #<$c3 - jsr p8b_main.p8s_fail_word -label_asm_270_afterif - ; source: test_word_lt.p8:2198 if x$c4 - lda #<$c4 - jsr p8b_main.p8s_fail_word - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_lt.p8:2201 success++ - inc p8b_main.p8v_success -label_asm_271_afterif - ; source: test_word_lt.p8:2203 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2205 if xp8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2212 if x$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:2228 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2230 if x$c5 - lda #<$c5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2234 skip43a: -p8l_skip43a - ; source: test_word_lt.p8:2236 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2237 if x$c6 - lda #<$c6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2241 skip43b: -p8l_skip43b - ; source: test_word_lt.p8:2243 if x$c7 - lda #<$c7 - jsr p8b_main.p8s_fail_word -label_asm_276_afterif - ; source: test_word_lt.p8:2247 if x$c8 - lda #<$c8 - jsr p8b_main.p8s_fail_word - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_lt.p8:2250 success++ - inc p8b_main.p8v_success -label_asm_277_afterif - ; source: test_word_lt.p8:2252 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2254 if x$c9 - lda #<$c9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2258 skip44a: -p8l_skip44a - ; source: test_word_lt.p8:2260 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2261 if x$ca - lda #<$ca - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2265 skip44b: -p8l_skip44b - ; source: test_word_lt.p8:2267 if x$cb - lda #<$cb - jsr p8b_main.p8s_fail_word -label_asm_279_afterif - ; source: test_word_lt.p8:2271 if x$cc - lda #<$cc - jsr p8b_main.p8s_fail_word - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_lt.p8:2274 success++ - inc p8b_main.p8v_success -label_asm_280_afterif - ; source: test_word_lt.p8:2276 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lt.p8:2278 if x$cd - lda #<$cd - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2282 skip45a: -p8l_skip45a - ; source: test_word_lt.p8:2284 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2285 if x$ce - lda #<$ce - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2289 skip45b: -p8l_skip45b - ; source: test_word_lt.p8:2291 if x$cf - lda #<$cf - jsr p8b_main.p8s_fail_word -label_asm_282_afterif - ; source: test_word_lt.p8:2295 if x$d0 - lda #<$d0 - jsr p8b_main.p8s_fail_word - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_lt.p8:2298 success++ - inc p8b_main.p8v_success -label_asm_283_afterif - ; source: test_word_lt.p8:2300 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2302 if x$d1 - lda #<$d1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2306 skip46a: -p8l_skip46a - ; source: test_word_lt.p8:2308 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2309 if x$d2 - lda #<$d2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2313 skip46b: -p8l_skip46b - ; source: test_word_lt.p8:2315 if x$d3 - lda #<$d3 - jsr p8b_main.p8s_fail_word -label_asm_285_afterif - ; source: test_word_lt.p8:2319 if x$d4 - lda #<$d4 - jsr p8b_main.p8s_fail_word - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_lt.p8:2322 success++ - inc p8b_main.p8v_success -label_asm_286_afterif - ; source: test_word_lt.p8:2324 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2326 if x$d5 - lda #<$d5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2330 skip47a: -p8l_skip47a - ; source: test_word_lt.p8:2332 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2333 if x$d6 - lda #<$d6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2337 skip47b: -p8l_skip47b - ; source: test_word_lt.p8:2339 if x$d7 - lda #<$d7 - jsr p8b_main.p8s_fail_word -label_asm_288_afterif - ; source: test_word_lt.p8:2343 if x$d8 - lda #<$d8 - jsr p8b_main.p8s_fail_word - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_lt.p8:2346 success++ - inc p8b_main.p8v_success -label_asm_289_afterif - ; source: test_word_lt.p8:2348 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2350 if x$d9 - lda #<$d9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2354 skip48a: -p8l_skip48a - ; source: test_word_lt.p8:2356 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2357 if x$da - lda #<$da - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2361 skip48b: -p8l_skip48b - ; source: test_word_lt.p8:2363 if x$db - lda #<$db - jsr p8b_main.p8s_fail_word -label_asm_291_afterif - ; source: test_word_lt.p8:2367 if x$dc - lda #<$dc - jsr p8b_main.p8s_fail_word - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_lt.p8:2370 success++ - inc p8b_main.p8v_success -label_asm_292_afterif - ; source: test_word_lt.p8:2372 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lt.p8:2374 if x$dd - lda #<$dd - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2378 skip49a: -p8l_skip49a - ; source: test_word_lt.p8:2380 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2381 if x$de - lda #<$de - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2385 skip49b: -p8l_skip49b - ; source: test_word_lt.p8:2387 if x$df - lda #<$df - jsr p8b_main.p8s_fail_word -label_asm_294_afterif - ; source: test_word_lt.p8:2391 if x$e0 - lda #<$e0 - jsr p8b_main.p8s_fail_word - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_lt.p8:2394 success++ - inc p8b_main.p8v_success -label_asm_295_afterif - ; source: test_word_lt.p8:2396 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_lt.p8:1210 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .sint ? -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_lt.p8:2398 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_word_lt.p8:2399 word @shared x - ; source: test_word_lt.p8:2400 word[] values = [0, 0] - ; source: test_word_lt.p8:2399 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_lt.p8:2401 success = 0 - stz p8b_main.p8v_success - ; source: test_word_lt.p8:2402 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:2403 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:2405 if x$e1 - lda #<$e1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2409 skip1a: -p8l_skip1a - ; source: test_word_lt.p8:2411 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2412 if x$e2 - lda #<$e2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2416 skip1b: -p8l_skip1b - ; source: test_word_lt.p8:2418 if x$e3 - lda #<$e3 - jsr p8b_main.p8s_fail_word -label_asm_297_afterif - ; source: test_word_lt.p8:2422 if x$e4 - lda #<$e4 - jsr p8b_main.p8s_fail_word - bra label_asm_298_afterif -label_asm_299_else - ; source: test_word_lt.p8:2425 success++ - inc p8b_main.p8v_success -label_asm_298_afterif - ; source: test_word_lt.p8:2427 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2429 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2436 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2460 if x1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2477 if xp8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2484 if x$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:2501 if xp8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2508 if x$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:2525 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2532 if x$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:2549 if xp8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2556 if x-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:2572 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:2574 if x$e5 - lda #<$e5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2578 skip8a: -p8l_skip8a - ; source: test_word_lt.p8:2580 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2581 if x$e6 - lda #<$e6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2585 skip8b: -p8l_skip8b - ; source: test_word_lt.p8:2587 if x$e7 - lda #<$e7 - jsr p8b_main.p8s_fail_word -label_asm_318_afterif - ; source: test_word_lt.p8:2591 if x$e8 - lda #<$e8 - jsr p8b_main.p8s_fail_word - bra label_asm_319_afterif -label_asm_320_else - ; source: test_word_lt.p8:2594 success++ - inc p8b_main.p8v_success -label_asm_319_afterif - ; source: test_word_lt.p8:2596 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2598 if x$e9 - lda #<$e9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2602 skip9a: -p8l_skip9a - ; source: test_word_lt.p8:2604 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2605 if x$ea - lda #<$ea - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2609 skip9b: -p8l_skip9b - ; source: test_word_lt.p8:2611 if x$eb - lda #<$eb - jsr p8b_main.p8s_fail_word -label_asm_321_afterif - ; source: test_word_lt.p8:2615 if x$ec - lda #<$ec - jsr p8b_main.p8s_fail_word - bra label_asm_322_afterif -label_asm_323_else - ; source: test_word_lt.p8:2618 success++ - inc p8b_main.p8v_success -label_asm_322_afterif - ; source: test_word_lt.p8:2620 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lt.p8:2622 if xp8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2629 if x1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2646 if xp8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2653 if x$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:2670 if xp8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2677 if x$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:2694 if xp8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2701 if x$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:2718 if xp8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2725 if x-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:2743 if x$ed - lda #<$ed - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2747 skip15a: -p8l_skip15a - ; source: test_word_lt.p8:2749 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2750 if x$ee - lda #<$ee - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2754 skip15b: -p8l_skip15b - ; source: test_word_lt.p8:2756 if x$ef - lda #<$ef - jsr p8b_main.p8s_fail_word -label_asm_339_afterif - ; source: test_word_lt.p8:2760 if x$f0 - lda #<$f0 - jsr p8b_main.p8s_fail_word - bra label_asm_340_afterif -label_asm_341_else - ; source: test_word_lt.p8:2763 success++ - inc p8b_main.p8v_success -label_asm_340_afterif - ; source: test_word_lt.p8:2765 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2767 if x$f1 - lda #<$f1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2771 skip16a: -p8l_skip16a - ; source: test_word_lt.p8:2773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2774 if x$f2 - lda #<$f2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2778 skip16b: -p8l_skip16b - ; source: test_word_lt.p8:2780 if x$f3 - lda #<$f3 - jsr p8b_main.p8s_fail_word -label_asm_342_afterif - ; source: test_word_lt.p8:2784 if x$f4 - lda #<$f4 - jsr p8b_main.p8s_fail_word - bra label_asm_343_afterif -label_asm_344_else - ; source: test_word_lt.p8:2787 success++ - inc p8b_main.p8v_success -label_asm_343_afterif - ; source: test_word_lt.p8:2789 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lt.p8:2791 if x$f5 - lda #<$f5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2795 skip17a: -p8l_skip17a - ; source: test_word_lt.p8:2797 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2798 if x$f6 - lda #<$f6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2802 skip17b: -p8l_skip17b - ; source: test_word_lt.p8:2804 if x$f7 - lda #<$f7 - jsr p8b_main.p8s_fail_word -label_asm_345_afterif - ; source: test_word_lt.p8:2808 if x$f8 - lda #<$f8 - jsr p8b_main.p8s_fail_word - bra label_asm_346_afterif -label_asm_347_else - ; source: test_word_lt.p8:2811 success++ - inc p8b_main.p8v_success -label_asm_346_afterif - ; source: test_word_lt.p8:2813 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2815 if xp8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2822 if x$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:2839 if xp8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2846 if x$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:2863 if xp8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2870 if x$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:2887 if xp8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2894 if x1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:2910 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:2912 if x$f9 - lda #<$f9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2916 skip22a: -p8l_skip22a - ; source: test_word_lt.p8:2918 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2919 if x$fa - lda #<$fa - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2923 skip22b: -p8l_skip22b - ; source: test_word_lt.p8:2925 if x$fb - lda #<$fb - jsr p8b_main.p8s_fail_word -label_asm_360_afterif - ; source: test_word_lt.p8:2929 if x$fc - lda #<$fc - jsr p8b_main.p8s_fail_word - bra label_asm_361_afterif -label_asm_362_else - ; source: test_word_lt.p8:2932 success++ - inc p8b_main.p8v_success -label_asm_361_afterif - ; source: test_word_lt.p8:2934 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2936 if x$fd - lda #<$fd - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2940 skip23a: -p8l_skip23a - ; source: test_word_lt.p8:2942 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2943 if x$fe - lda #<$fe - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2947 skip23b: -p8l_skip23b - ; source: test_word_lt.p8:2949 if x$ff - lda #<$ff - jsr p8b_main.p8s_fail_word -label_asm_363_afterif - ; source: test_word_lt.p8:2953 if x$0100 - lda #<$0100 - jsr p8b_main.p8s_fail_word - bra label_asm_364_afterif -label_asm_365_else - ; source: test_word_lt.p8:2956 success++ - inc p8b_main.p8v_success -label_asm_364_afterif - ; source: test_word_lt.p8:2958 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lt.p8:2960 if x$0101 - lda #<$0101 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2964 skip24a: -p8l_skip24a - ; source: test_word_lt.p8:2966 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2967 if x$0102 - lda #<$0102 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2971 skip24b: -p8l_skip24b - ; source: test_word_lt.p8:2973 if x$0103 - lda #<$0103 - jsr p8b_main.p8s_fail_word -label_asm_366_afterif - ; source: test_word_lt.p8:2977 if x$0104 - lda #<$0104 - jsr p8b_main.p8s_fail_word - bra label_asm_367_afterif -label_asm_368_else - ; source: test_word_lt.p8:2980 success++ - inc p8b_main.p8v_success -label_asm_367_afterif - ; source: test_word_lt.p8:2982 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lt.p8:2984 if x$0105 - lda #<$0105 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2988 skip25a: -p8l_skip25a - ; source: test_word_lt.p8:2990 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:2991 if x$0106 - lda #<$0106 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:2995 skip25b: -p8l_skip25b - ; source: test_word_lt.p8:2997 if x$0107 - lda #<$0107 - jsr p8b_main.p8s_fail_word -label_asm_369_afterif - ; source: test_word_lt.p8:3001 if x$0108 - lda #<$0108 - jsr p8b_main.p8s_fail_word - bra label_asm_370_afterif -label_asm_371_else - ; source: test_word_lt.p8:3004 success++ - inc p8b_main.p8v_success -label_asm_370_afterif - ; source: test_word_lt.p8:3006 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:3008 if xp8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3015 if x$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:3032 if xp8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3039 if x$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:3056 if xp8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3063 if x$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:3079 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:3081 if x$0109 - lda #<$0109 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3085 skip29a: -p8l_skip29a - ; source: test_word_lt.p8:3087 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3088 if x$010a - lda #<$010a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3092 skip29b: -p8l_skip29b - ; source: test_word_lt.p8:3094 if x$010b - lda #<$010b - jsr p8b_main.p8s_fail_word -label_asm_381_afterif - ; source: test_word_lt.p8:3098 if x$010c - lda #<$010c - jsr p8b_main.p8s_fail_word - bra label_asm_382_afterif -label_asm_383_else - ; source: test_word_lt.p8:3101 success++ - inc p8b_main.p8v_success -label_asm_382_afterif - ; source: test_word_lt.p8:3103 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:3105 if x$010d - lda #<$010d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3109 skip30a: -p8l_skip30a - ; source: test_word_lt.p8:3111 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3112 if x$010e - lda #<$010e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3116 skip30b: -p8l_skip30b - ; source: test_word_lt.p8:3118 if x$010f - lda #<$010f - jsr p8b_main.p8s_fail_word -label_asm_384_afterif - ; source: test_word_lt.p8:3122 if x$0110 - lda #<$0110 - jsr p8b_main.p8s_fail_word - bra label_asm_385_afterif -label_asm_386_else - ; source: test_word_lt.p8:3125 success++ - inc p8b_main.p8v_success -label_asm_385_afterif - ; source: test_word_lt.p8:3127 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lt.p8:3129 if x$0111 - lda #<$0111 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3133 skip31a: -p8l_skip31a - ; source: test_word_lt.p8:3135 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3136 if x$0112 - lda #<$0112 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3140 skip31b: -p8l_skip31b - ; source: test_word_lt.p8:3142 if x$0113 - lda #<$0113 - jsr p8b_main.p8s_fail_word -label_asm_387_afterif - ; source: test_word_lt.p8:3146 if x$0114 - lda #<$0114 - jsr p8b_main.p8s_fail_word - bra label_asm_388_afterif -label_asm_389_else - ; source: test_word_lt.p8:3149 success++ - inc p8b_main.p8v_success -label_asm_388_afterif - ; source: test_word_lt.p8:3151 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lt.p8:3153 if x$0115 - lda #<$0115 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3157 skip32a: -p8l_skip32a - ; source: test_word_lt.p8:3159 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3160 if x$0116 - lda #<$0116 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3164 skip32b: -p8l_skip32b - ; source: test_word_lt.p8:3166 if x$0117 - lda #<$0117 - jsr p8b_main.p8s_fail_word -label_asm_390_afterif - ; source: test_word_lt.p8:3170 if x$0118 - lda #<$0118 - jsr p8b_main.p8s_fail_word - bra label_asm_391_afterif -label_asm_392_else - ; source: test_word_lt.p8:3173 success++ - inc p8b_main.p8v_success -label_asm_391_afterif - ; source: test_word_lt.p8:3175 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:3177 if x$0119 - lda #<$0119 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3181 skip33a: -p8l_skip33a - ; source: test_word_lt.p8:3183 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3184 if x$011a - lda #<$011a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3188 skip33b: -p8l_skip33b - ; source: test_word_lt.p8:3190 if x$011b - lda #<$011b - jsr p8b_main.p8s_fail_word -label_asm_393_afterif - ; source: test_word_lt.p8:3194 if x$011c - lda #<$011c - jsr p8b_main.p8s_fail_word - bra label_asm_394_afterif -label_asm_395_else - ; source: test_word_lt.p8:3197 success++ - inc p8b_main.p8v_success -label_asm_394_afterif - ; source: test_word_lt.p8:3199 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:3201 if xp8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3208 if x$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:3225 if xp8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3232 if x$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:3248 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:3250 if x$011d - lda #<$011d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3254 skip36a: -p8l_skip36a - ; source: test_word_lt.p8:3256 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3257 if x$011e - lda #<$011e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3261 skip36b: -p8l_skip36b - ; source: test_word_lt.p8:3263 if x$011f - lda #<$011f - jsr p8b_main.p8s_fail_word -label_asm_402_afterif - ; source: test_word_lt.p8:3267 if x$0120 - lda #<$0120 - jsr p8b_main.p8s_fail_word - bra label_asm_403_afterif -label_asm_404_else - ; source: test_word_lt.p8:3270 success++ - inc p8b_main.p8v_success -label_asm_403_afterif - ; source: test_word_lt.p8:3272 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:3274 if x$0121 - lda #<$0121 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3278 skip37a: -p8l_skip37a - ; source: test_word_lt.p8:3280 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3281 if x$0122 - lda #<$0122 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3285 skip37b: -p8l_skip37b - ; source: test_word_lt.p8:3287 if x$0123 - lda #<$0123 - jsr p8b_main.p8s_fail_word -label_asm_405_afterif - ; source: test_word_lt.p8:3291 if x$0124 - lda #<$0124 - jsr p8b_main.p8s_fail_word - bra label_asm_406_afterif -label_asm_407_else - ; source: test_word_lt.p8:3294 success++ - inc p8b_main.p8v_success -label_asm_406_afterif - ; source: test_word_lt.p8:3296 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lt.p8:3298 if x$0125 - lda #<$0125 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3302 skip38a: -p8l_skip38a - ; source: test_word_lt.p8:3304 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3305 if x$0126 - lda #<$0126 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3309 skip38b: -p8l_skip38b - ; source: test_word_lt.p8:3311 if x$0127 - lda #<$0127 - jsr p8b_main.p8s_fail_word -label_asm_408_afterif - ; source: test_word_lt.p8:3315 if x$0128 - lda #<$0128 - jsr p8b_main.p8s_fail_word - bra label_asm_409_afterif -label_asm_410_else - ; source: test_word_lt.p8:3318 success++ - inc p8b_main.p8v_success -label_asm_409_afterif - ; source: test_word_lt.p8:3320 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lt.p8:3322 if x$0129 - lda #<$0129 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3326 skip39a: -p8l_skip39a - ; source: test_word_lt.p8:3328 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3329 if x$012a - lda #<$012a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3333 skip39b: -p8l_skip39b - ; source: test_word_lt.p8:3335 if x$012b - lda #<$012b - jsr p8b_main.p8s_fail_word -label_asm_411_afterif - ; source: test_word_lt.p8:3339 if x$012c - lda #<$012c - jsr p8b_main.p8s_fail_word - bra label_asm_412_afterif -label_asm_413_else - ; source: test_word_lt.p8:3342 success++ - inc p8b_main.p8v_success -label_asm_412_afterif - ; source: test_word_lt.p8:3344 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:3346 if x$012d - lda #<$012d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3350 skip40a: -p8l_skip40a - ; source: test_word_lt.p8:3352 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3353 if x$012e - lda #<$012e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3357 skip40b: -p8l_skip40b - ; source: test_word_lt.p8:3359 if x$012f - lda #<$012f - jsr p8b_main.p8s_fail_word -label_asm_414_afterif - ; source: test_word_lt.p8:3363 if x$0130 - lda #<$0130 - jsr p8b_main.p8s_fail_word - bra label_asm_415_afterif -label_asm_416_else - ; source: test_word_lt.p8:3366 success++ - inc p8b_main.p8v_success -label_asm_415_afterif - ; source: test_word_lt.p8:3368 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:3370 if x$0131 - lda #<$0131 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3374 skip41a: -p8l_skip41a - ; source: test_word_lt.p8:3376 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3377 if x$0132 - lda #<$0132 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3381 skip41b: -p8l_skip41b - ; source: test_word_lt.p8:3383 if x$0133 - lda #<$0133 - jsr p8b_main.p8s_fail_word -label_asm_417_afterif - ; source: test_word_lt.p8:3387 if x$0134 - lda #<$0134 - jsr p8b_main.p8s_fail_word - bra label_asm_418_afterif -label_asm_419_else - ; source: test_word_lt.p8:3390 success++ - inc p8b_main.p8v_success -label_asm_418_afterif - ; source: test_word_lt.p8:3392 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:3394 if xp8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3401 if x$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:3417 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lt.p8:3419 if x$0135 - lda #<$0135 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3423 skip43a: -p8l_skip43a - ; source: test_word_lt.p8:3425 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3426 if x$0136 - lda #<$0136 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3430 skip43b: -p8l_skip43b - ; source: test_word_lt.p8:3432 if x$0137 - lda #<$0137 - jsr p8b_main.p8s_fail_word -label_asm_423_afterif - ; source: test_word_lt.p8:3436 if x$0138 - lda #<$0138 - jsr p8b_main.p8s_fail_word - bra label_asm_424_afterif -label_asm_425_else - ; source: test_word_lt.p8:3439 success++ - inc p8b_main.p8v_success -label_asm_424_afterif - ; source: test_word_lt.p8:3441 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lt.p8:3443 if x$0139 - lda #<$0139 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3447 skip44a: -p8l_skip44a - ; source: test_word_lt.p8:3449 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3450 if x$013a - lda #<$013a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3454 skip44b: -p8l_skip44b - ; source: test_word_lt.p8:3456 if x$013b - lda #<$013b - jsr p8b_main.p8s_fail_word -label_asm_426_afterif - ; source: test_word_lt.p8:3460 if x$013c - lda #<$013c - jsr p8b_main.p8s_fail_word - bra label_asm_427_afterif -label_asm_428_else - ; source: test_word_lt.p8:3463 success++ - inc p8b_main.p8v_success -label_asm_427_afterif - ; source: test_word_lt.p8:3465 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lt.p8:3467 if x$013d - lda #<$013d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3471 skip45a: -p8l_skip45a - ; source: test_word_lt.p8:3473 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3474 if x$013e - lda #<$013e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3478 skip45b: -p8l_skip45b - ; source: test_word_lt.p8:3480 if x$013f - lda #<$013f - jsr p8b_main.p8s_fail_word -label_asm_429_afterif - ; source: test_word_lt.p8:3484 if x$0140 - lda #<$0140 - jsr p8b_main.p8s_fail_word - bra label_asm_430_afterif -label_asm_431_else - ; source: test_word_lt.p8:3487 success++ - inc p8b_main.p8v_success -label_asm_430_afterif - ; source: test_word_lt.p8:3489 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lt.p8:3491 if x$0141 - lda #<$0141 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3495 skip46a: -p8l_skip46a - ; source: test_word_lt.p8:3497 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3498 if x$0142 - lda #<$0142 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3502 skip46b: -p8l_skip46b - ; source: test_word_lt.p8:3504 if x$0143 - lda #<$0143 - jsr p8b_main.p8s_fail_word -label_asm_432_afterif - ; source: test_word_lt.p8:3508 if x$0144 - lda #<$0144 - jsr p8b_main.p8s_fail_word - bra label_asm_433_afterif -label_asm_434_else - ; source: test_word_lt.p8:3511 success++ - inc p8b_main.p8v_success -label_asm_433_afterif - ; source: test_word_lt.p8:3513 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lt.p8:3515 if x$0145 - lda #<$0145 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3519 skip47a: -p8l_skip47a - ; source: test_word_lt.p8:3521 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3522 if x$0146 - lda #<$0146 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3526 skip47b: -p8l_skip47b - ; source: test_word_lt.p8:3528 if x$0147 - lda #<$0147 - jsr p8b_main.p8s_fail_word -label_asm_435_afterif - ; source: test_word_lt.p8:3532 if x$0148 - lda #<$0148 - jsr p8b_main.p8s_fail_word - bra label_asm_436_afterif -label_asm_437_else - ; source: test_word_lt.p8:3535 success++ - inc p8b_main.p8v_success -label_asm_436_afterif - ; source: test_word_lt.p8:3537 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lt.p8:3539 if x$0149 - lda #<$0149 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3543 skip48a: -p8l_skip48a - ; source: test_word_lt.p8:3545 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3546 if x$014a - lda #<$014a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3550 skip48b: -p8l_skip48b - ; source: test_word_lt.p8:3552 if x$014b - lda #<$014b - jsr p8b_main.p8s_fail_word -label_asm_438_afterif - ; source: test_word_lt.p8:3556 if x$014c - lda #<$014c - jsr p8b_main.p8s_fail_word - bra label_asm_439_afterif -label_asm_440_else - ; source: test_word_lt.p8:3559 success++ - inc p8b_main.p8v_success -label_asm_439_afterif - ; source: test_word_lt.p8:3561 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lt.p8:3563 if x$014d - lda #<$014d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3567 skip49a: -p8l_skip49a - ; source: test_word_lt.p8:3569 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3570 if x$014e - lda #<$014e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3574 skip49b: -p8l_skip49b - ; source: test_word_lt.p8:3576 if x$014f - lda #<$014f - jsr p8b_main.p8s_fail_word -label_asm_441_afterif - ; source: test_word_lt.p8:3580 if x$0150 - lda #<$0150 - jsr p8b_main.p8s_fail_word - bra label_asm_442_afterif -label_asm_443_else - ; source: test_word_lt.p8:3583 success++ - inc p8b_main.p8v_success -label_asm_442_afterif - ; source: test_word_lt.p8:3585 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_lt.p8:2398 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -p8v_values .sint $0000, $0000 - .pend - ; source: test_word_lt.p8:3587 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_word_lt.p8:3588 word @shared x - ; source: test_word_lt.p8:3591 float @shared f4 = 1.0 - ; source: test_word_lt.p8:3592 float @shared f5 = 1.0 - ; source: test_word_lt.p8:3588 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_lt.p8:3589 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_lt.p8:3590 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_lt.p8:3591 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_word_lt.p8:3592 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_word_lt.p8:3593 success = 0 - stz p8b_main.p8v_success - ; source: test_word_lt.p8:3594 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:3596 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_lt.p8:3598 goto skip1a - bra p8l_skip1a - ; source: test_word_lt.p8:3599 lbl1a: fail_word(337) -p8l_lbl1a - ldy #>$0151 - lda #<$0151 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3600 skip1a: -p8l_skip1a - ; source: test_word_lt.p8:3602 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3603 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3605 goto skip1b - bra p8l_skip1b - ; source: test_word_lt.p8:3606 lbl1b: fail_word(338) -p8l_lbl1b - ldy #>$0152 - lda #<$0152 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3607 skip1b: -p8l_skip1b - ; source: test_word_lt.p8:3609 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_444_afterif - ; source: test_word_lt.p8:3610 fail_word(339) - ldy #>$0153 - lda #<$0153 - jsr p8b_main.p8s_fail_word -label_asm_444_afterif - ; source: test_word_lt.p8:3613 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_446_else - ; source: test_word_lt.p8:3614 fail_word(340) - ldy #>$0154 - lda #<$0154 - jsr p8b_main.p8s_fail_word - bra label_asm_445_afterif -label_asm_446_else - ; source: test_word_lt.p8:3616 success++ - inc p8b_main.p8v_success -label_asm_445_afterif - ; source: test_word_lt.p8:3619 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_lt.p8:3621 goto skip2a - bra p8l_skip2a - ; source: test_word_lt.p8:3622 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3623 skip2a: -p8l_skip2a - ; source: test_word_lt.p8:3625 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3626 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3628 goto skip2b - bra p8l_skip2b - ; source: test_word_lt.p8:3629 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3630 skip2b: -p8l_skip2b - ; source: test_word_lt.p8:3632 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_447_afterif - ; source: test_word_lt.p8:3633 success++ - inc p8b_main.p8v_success -label_asm_447_afterif - ; source: test_word_lt.p8:3636 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_449_else - ; source: test_word_lt.p8:3637 success++ - inc p8b_main.p8v_success - bra label_asm_448_afterif -label_asm_449_else - ; source: test_word_lt.p8:3639 cx16.r0L++ - inc cx16.r0L -label_asm_448_afterif - ; source: test_word_lt.p8:3642 if xp8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3649 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_lt.p8:3667 goto skip4a - bra p8l_skip4a - ; source: test_word_lt.p8:3668 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3669 skip4a: -p8l_skip4a - ; source: test_word_lt.p8:3671 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3672 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3674 goto skip4b - bra p8l_skip4b - ; source: test_word_lt.p8:3675 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3676 skip4b: -p8l_skip4b - ; source: test_word_lt.p8:3678 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_453_afterif - ; source: test_word_lt.p8:3679 success++ - inc p8b_main.p8v_success -label_asm_453_afterif - ; source: test_word_lt.p8:3682 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_455_else - ; source: test_word_lt.p8:3683 success++ - inc p8b_main.p8v_success - bra label_asm_454_afterif -label_asm_455_else - ; source: test_word_lt.p8:3685 cx16.r0L++ - inc cx16.r0L -label_asm_454_afterif - ; source: test_word_lt.p8:3688 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_lt.p8:3690 goto skip5a - bra p8l_skip5a - ; source: test_word_lt.p8:3691 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3692 skip5a: -p8l_skip5a - ; source: test_word_lt.p8:3694 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3695 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3697 goto skip5b - bra p8l_skip5b - ; source: test_word_lt.p8:3698 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3699 skip5b: -p8l_skip5b - ; source: test_word_lt.p8:3701 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_456_afterif - ; source: test_word_lt.p8:3702 success++ - inc p8b_main.p8v_success -label_asm_456_afterif - ; source: test_word_lt.p8:3705 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_458_else - ; source: test_word_lt.p8:3706 success++ - inc p8b_main.p8v_success - bra label_asm_457_afterif -label_asm_458_else - ; source: test_word_lt.p8:3708 cx16.r0L++ - inc cx16.r0L -label_asm_457_afterif - ; source: test_word_lt.p8:3711 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_lt.p8:3713 goto skip6a - bra p8l_skip6a - ; source: test_word_lt.p8:3714 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3715 skip6a: -p8l_skip6a - ; source: test_word_lt.p8:3717 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3718 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3720 goto skip6b - bra p8l_skip6b - ; source: test_word_lt.p8:3721 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3722 skip6b: -p8l_skip6b - ; source: test_word_lt.p8:3724 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_459_afterif - ; source: test_word_lt.p8:3725 success++ - inc p8b_main.p8v_success -label_asm_459_afterif - ; source: test_word_lt.p8:3728 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_461_else - ; source: test_word_lt.p8:3729 success++ - inc p8b_main.p8v_success - bra label_asm_460_afterif -label_asm_461_else - ; source: test_word_lt.p8:3731 cx16.r0L++ - inc cx16.r0L -label_asm_460_afterif - ; source: test_word_lt.p8:3734 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_lt.p8:3736 goto skip7a - bra p8l_skip7a - ; source: test_word_lt.p8:3737 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3738 skip7a: -p8l_skip7a - ; source: test_word_lt.p8:3740 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3741 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3743 goto skip7b - bra p8l_skip7b - ; source: test_word_lt.p8:3744 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3745 skip7b: -p8l_skip7b - ; source: test_word_lt.p8:3747 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_462_afterif - ; source: test_word_lt.p8:3748 success++ - inc p8b_main.p8v_success -label_asm_462_afterif - ; source: test_word_lt.p8:3751 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_464_else - ; source: test_word_lt.p8:3752 success++ - inc p8b_main.p8v_success - bra label_asm_463_afterif -label_asm_464_else - ; source: test_word_lt.p8:3754 cx16.r0L++ - inc cx16.r0L -label_asm_463_afterif - ; source: test_word_lt.p8:3756 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:3758 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_lt.p8:3760 goto skip8a - bra p8l_skip8a - ; source: test_word_lt.p8:3761 lbl8a: fail_word(341) -p8l_lbl8a - ldy #>$0155 - lda #<$0155 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3762 skip8a: -p8l_skip8a - ; source: test_word_lt.p8:3764 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3765 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3767 goto skip8b - bra p8l_skip8b - ; source: test_word_lt.p8:3768 lbl8b: fail_word(342) -p8l_lbl8b - ldy #>$0156 - lda #<$0156 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3769 skip8b: -p8l_skip8b - ; source: test_word_lt.p8:3771 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_465_afterif - ; source: test_word_lt.p8:3772 fail_word(343) - ldy #>$0157 - lda #<$0157 - jsr p8b_main.p8s_fail_word -label_asm_465_afterif - ; source: test_word_lt.p8:3775 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_467_else - ; source: test_word_lt.p8:3776 fail_word(344) - ldy #>$0158 - lda #<$0158 - jsr p8b_main.p8s_fail_word - bra label_asm_466_afterif -label_asm_467_else - ; source: test_word_lt.p8:3778 success++ - inc p8b_main.p8v_success -label_asm_466_afterif - ; source: test_word_lt.p8:3781 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_lt.p8:3783 goto skip9a - bra p8l_skip9a - ; source: test_word_lt.p8:3784 lbl9a: fail_word(345) -p8l_lbl9a - ldy #>$0159 - lda #<$0159 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3785 skip9a: -p8l_skip9a - ; source: test_word_lt.p8:3787 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3788 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3790 goto skip9b - bra p8l_skip9b - ; source: test_word_lt.p8:3791 lbl9b: fail_word(346) -p8l_lbl9b - ldy #>$015a - lda #<$015a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3792 skip9b: -p8l_skip9b - ; source: test_word_lt.p8:3794 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_468_afterif - ; source: test_word_lt.p8:3795 fail_word(347) - ldy #>$015b - lda #<$015b - jsr p8b_main.p8s_fail_word -label_asm_468_afterif - ; source: test_word_lt.p8:3798 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_470_else - ; source: test_word_lt.p8:3799 fail_word(348) - ldy #>$015c - lda #<$015c - jsr p8b_main.p8s_fail_word - bra label_asm_469_afterif -label_asm_470_else - ; source: test_word_lt.p8:3801 success++ - inc p8b_main.p8v_success -label_asm_469_afterif - ; source: test_word_lt.p8:3804 if xp8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3811 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_lt.p8:3829 goto skip11a - bra p8l_skip11a - ; source: test_word_lt.p8:3830 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3831 skip11a: -p8l_skip11a - ; source: test_word_lt.p8:3833 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3834 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3836 goto skip11b - bra p8l_skip11b - ; source: test_word_lt.p8:3837 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3838 skip11b: -p8l_skip11b - ; source: test_word_lt.p8:3840 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_474_afterif - ; source: test_word_lt.p8:3841 success++ - inc p8b_main.p8v_success -label_asm_474_afterif - ; source: test_word_lt.p8:3844 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_476_else - ; source: test_word_lt.p8:3845 success++ - inc p8b_main.p8v_success - bra label_asm_475_afterif -label_asm_476_else - ; source: test_word_lt.p8:3847 cx16.r0L++ - inc cx16.r0L -label_asm_475_afterif - ; source: test_word_lt.p8:3850 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_lt.p8:3852 goto skip12a - bra p8l_skip12a - ; source: test_word_lt.p8:3853 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3854 skip12a: -p8l_skip12a - ; source: test_word_lt.p8:3856 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3857 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3859 goto skip12b - bra p8l_skip12b - ; source: test_word_lt.p8:3860 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3861 skip12b: -p8l_skip12b - ; source: test_word_lt.p8:3863 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_477_afterif - ; source: test_word_lt.p8:3864 success++ - inc p8b_main.p8v_success -label_asm_477_afterif - ; source: test_word_lt.p8:3867 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_479_else - ; source: test_word_lt.p8:3868 success++ - inc p8b_main.p8v_success - bra label_asm_478_afterif -label_asm_479_else - ; source: test_word_lt.p8:3870 cx16.r0L++ - inc cx16.r0L -label_asm_478_afterif - ; source: test_word_lt.p8:3873 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_lt.p8:3875 goto skip13a - bra p8l_skip13a - ; source: test_word_lt.p8:3876 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3877 skip13a: -p8l_skip13a - ; source: test_word_lt.p8:3879 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3880 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3882 goto skip13b - bra p8l_skip13b - ; source: test_word_lt.p8:3883 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3884 skip13b: -p8l_skip13b - ; source: test_word_lt.p8:3886 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_480_afterif - ; source: test_word_lt.p8:3887 success++ - inc p8b_main.p8v_success -label_asm_480_afterif - ; source: test_word_lt.p8:3890 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_482_else - ; source: test_word_lt.p8:3891 success++ - inc p8b_main.p8v_success - bra label_asm_481_afterif -label_asm_482_else - ; source: test_word_lt.p8:3893 cx16.r0L++ - inc cx16.r0L -label_asm_481_afterif - ; source: test_word_lt.p8:3896 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_lt.p8:3898 goto skip14a - bra p8l_skip14a - ; source: test_word_lt.p8:3899 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3900 skip14a: -p8l_skip14a - ; source: test_word_lt.p8:3902 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3903 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3905 goto skip14b - bra p8l_skip14b - ; source: test_word_lt.p8:3906 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3907 skip14b: -p8l_skip14b - ; source: test_word_lt.p8:3909 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_483_afterif - ; source: test_word_lt.p8:3910 success++ - inc p8b_main.p8v_success -label_asm_483_afterif - ; source: test_word_lt.p8:3913 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_485_else - ; source: test_word_lt.p8:3914 success++ - inc p8b_main.p8v_success - bra label_asm_484_afterif -label_asm_485_else - ; source: test_word_lt.p8:3916 cx16.r0L++ - inc cx16.r0L -label_asm_484_afterif - ; source: test_word_lt.p8:3918 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_lt.p8:3920 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_lt.p8:3922 goto skip15a - bra p8l_skip15a - ; source: test_word_lt.p8:3923 lbl15a: fail_word(349) -p8l_lbl15a - ldy #>$015d - lda #<$015d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3924 skip15a: -p8l_skip15a - ; source: test_word_lt.p8:3926 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3927 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3929 goto skip15b - bra p8l_skip15b - ; source: test_word_lt.p8:3930 lbl15b: fail_word(350) -p8l_lbl15b - ldy #>$015e - lda #<$015e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3931 skip15b: -p8l_skip15b - ; source: test_word_lt.p8:3933 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_486_afterif - ; source: test_word_lt.p8:3934 fail_word(351) - ldy #>$015f - lda #<$015f - jsr p8b_main.p8s_fail_word -label_asm_486_afterif - ; source: test_word_lt.p8:3937 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_488_else - ; source: test_word_lt.p8:3938 fail_word(352) - ldy #>$0160 - lda #<$0160 - jsr p8b_main.p8s_fail_word - bra label_asm_487_afterif -label_asm_488_else - ; source: test_word_lt.p8:3940 success++ - inc p8b_main.p8v_success -label_asm_487_afterif - ; source: test_word_lt.p8:3943 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_lt.p8:3945 goto skip16a - bra p8l_skip16a - ; source: test_word_lt.p8:3946 lbl16a: fail_word(353) -p8l_lbl16a - ldy #>$0161 - lda #<$0161 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3947 skip16a: -p8l_skip16a - ; source: test_word_lt.p8:3949 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3950 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3952 goto skip16b - bra p8l_skip16b - ; source: test_word_lt.p8:3953 lbl16b: fail_word(354) -p8l_lbl16b - ldy #>$0162 - lda #<$0162 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3954 skip16b: -p8l_skip16b - ; source: test_word_lt.p8:3956 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_489_afterif - ; source: test_word_lt.p8:3957 fail_word(355) - ldy #>$0163 - lda #<$0163 - jsr p8b_main.p8s_fail_word -label_asm_489_afterif - ; source: test_word_lt.p8:3960 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_491_else - ; source: test_word_lt.p8:3961 fail_word(356) - ldy #>$0164 - lda #<$0164 - jsr p8b_main.p8s_fail_word - bra label_asm_490_afterif -label_asm_491_else - ; source: test_word_lt.p8:3963 success++ - inc p8b_main.p8v_success -label_asm_490_afterif - ; source: test_word_lt.p8:3966 if x$0165 - lda #<$0165 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3970 skip17a: -p8l_skip17a - ; source: test_word_lt.p8:3972 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3973 if x$0166 - lda #<$0166 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:3977 skip17b: -p8l_skip17b - ; source: test_word_lt.p8:3979 if x$0167 - lda #<$0167 - jsr p8b_main.p8s_fail_word -label_asm_492_afterif - ; source: test_word_lt.p8:3983 if x$0168 - lda #<$0168 - jsr p8b_main.p8s_fail_word - bra label_asm_493_afterif -label_asm_494_else - ; source: test_word_lt.p8:3986 success++ - inc p8b_main.p8v_success -label_asm_493_afterif - ; source: test_word_lt.p8:3989 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_lt.p8:3991 goto skip18a - bra p8l_skip18a - ; source: test_word_lt.p8:3992 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:3993 skip18a: -p8l_skip18a - ; source: test_word_lt.p8:3995 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:3996 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:3998 goto skip18b - bra p8l_skip18b - ; source: test_word_lt.p8:3999 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4000 skip18b: -p8l_skip18b - ; source: test_word_lt.p8:4002 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_495_afterif - ; source: test_word_lt.p8:4003 success++ - inc p8b_main.p8v_success -label_asm_495_afterif - ; source: test_word_lt.p8:4006 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_497_else - ; source: test_word_lt.p8:4007 success++ - inc p8b_main.p8v_success - bra label_asm_496_afterif -label_asm_497_else - ; source: test_word_lt.p8:4009 cx16.r0L++ - inc cx16.r0L -label_asm_496_afterif - ; source: test_word_lt.p8:4012 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_lt.p8:4014 goto skip19a - bra p8l_skip19a - ; source: test_word_lt.p8:4015 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4016 skip19a: -p8l_skip19a - ; source: test_word_lt.p8:4018 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4019 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4021 goto skip19b - bra p8l_skip19b - ; source: test_word_lt.p8:4022 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4023 skip19b: -p8l_skip19b - ; source: test_word_lt.p8:4025 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_498_afterif - ; source: test_word_lt.p8:4026 success++ - inc p8b_main.p8v_success -label_asm_498_afterif - ; source: test_word_lt.p8:4029 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_500_else - ; source: test_word_lt.p8:4030 success++ - inc p8b_main.p8v_success - bra label_asm_499_afterif -label_asm_500_else - ; source: test_word_lt.p8:4032 cx16.r0L++ - inc cx16.r0L -label_asm_499_afterif - ; source: test_word_lt.p8:4035 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_lt.p8:4037 goto skip20a - bra p8l_skip20a - ; source: test_word_lt.p8:4038 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4039 skip20a: -p8l_skip20a - ; source: test_word_lt.p8:4041 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4042 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4044 goto skip20b - bra p8l_skip20b - ; source: test_word_lt.p8:4045 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4046 skip20b: -p8l_skip20b - ; source: test_word_lt.p8:4048 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_501_afterif - ; source: test_word_lt.p8:4049 success++ - inc p8b_main.p8v_success -label_asm_501_afterif - ; source: test_word_lt.p8:4052 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_503_else - ; source: test_word_lt.p8:4053 success++ - inc p8b_main.p8v_success - bra label_asm_502_afterif -label_asm_503_else - ; source: test_word_lt.p8:4055 cx16.r0L++ - inc cx16.r0L -label_asm_502_afterif - ; source: test_word_lt.p8:4058 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_lt.p8:4060 goto skip21a - bra p8l_skip21a - ; source: test_word_lt.p8:4061 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4062 skip21a: -p8l_skip21a - ; source: test_word_lt.p8:4064 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4065 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4067 goto skip21b - bra p8l_skip21b - ; source: test_word_lt.p8:4068 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4069 skip21b: -p8l_skip21b - ; source: test_word_lt.p8:4071 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_504_afterif - ; source: test_word_lt.p8:4072 success++ - inc p8b_main.p8v_success -label_asm_504_afterif - ; source: test_word_lt.p8:4075 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_506_else - ; source: test_word_lt.p8:4076 success++ - inc p8b_main.p8v_success - bra label_asm_505_afterif -label_asm_506_else - ; source: test_word_lt.p8:4078 cx16.r0L++ - inc cx16.r0L -label_asm_505_afterif - ; source: test_word_lt.p8:4080 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:4082 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_lt.p8:4084 goto skip22a - bra p8l_skip22a - ; source: test_word_lt.p8:4085 lbl22a: fail_word(361) -p8l_lbl22a - ldy #>$0169 - lda #<$0169 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4086 skip22a: -p8l_skip22a - ; source: test_word_lt.p8:4088 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4089 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4091 goto skip22b - bra p8l_skip22b - ; source: test_word_lt.p8:4092 lbl22b: fail_word(362) -p8l_lbl22b - ldy #>$016a - lda #<$016a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4093 skip22b: -p8l_skip22b - ; source: test_word_lt.p8:4095 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_507_afterif - ; source: test_word_lt.p8:4096 fail_word(363) - ldy #>$016b - lda #<$016b - jsr p8b_main.p8s_fail_word -label_asm_507_afterif - ; source: test_word_lt.p8:4099 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_509_else - ; source: test_word_lt.p8:4100 fail_word(364) - ldy #>$016c - lda #<$016c - jsr p8b_main.p8s_fail_word - bra label_asm_508_afterif -label_asm_509_else - ; source: test_word_lt.p8:4102 success++ - inc p8b_main.p8v_success -label_asm_508_afterif - ; source: test_word_lt.p8:4105 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_lt.p8:4107 goto skip23a - bra p8l_skip23a - ; source: test_word_lt.p8:4108 lbl23a: fail_word(365) -p8l_lbl23a - ldy #>$016d - lda #<$016d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4109 skip23a: -p8l_skip23a - ; source: test_word_lt.p8:4111 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4112 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4114 goto skip23b - bra p8l_skip23b - ; source: test_word_lt.p8:4115 lbl23b: fail_word(366) -p8l_lbl23b - ldy #>$016e - lda #<$016e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4116 skip23b: -p8l_skip23b - ; source: test_word_lt.p8:4118 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_510_afterif - ; source: test_word_lt.p8:4119 fail_word(367) - ldy #>$016f - lda #<$016f - jsr p8b_main.p8s_fail_word -label_asm_510_afterif - ; source: test_word_lt.p8:4122 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_512_else - ; source: test_word_lt.p8:4123 fail_word(368) - ldy #>$0170 - lda #<$0170 - jsr p8b_main.p8s_fail_word - bra label_asm_511_afterif -label_asm_512_else - ; source: test_word_lt.p8:4125 success++ - inc p8b_main.p8v_success -label_asm_511_afterif - ; source: test_word_lt.p8:4128 if x$0171 - lda #<$0171 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4132 skip24a: -p8l_skip24a - ; source: test_word_lt.p8:4134 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4135 if x$0172 - lda #<$0172 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4139 skip24b: -p8l_skip24b - ; source: test_word_lt.p8:4141 if x$0173 - lda #<$0173 - jsr p8b_main.p8s_fail_word -label_asm_513_afterif - ; source: test_word_lt.p8:4145 if x$0174 - lda #<$0174 - jsr p8b_main.p8s_fail_word - bra label_asm_514_afterif -label_asm_515_else - ; source: test_word_lt.p8:4148 success++ - inc p8b_main.p8v_success -label_asm_514_afterif - ; source: test_word_lt.p8:4151 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_lt.p8:4153 goto skip25a - bra p8l_skip25a - ; source: test_word_lt.p8:4154 lbl25a: fail_word(373) -p8l_lbl25a - ldy #>$0175 - lda #<$0175 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4155 skip25a: -p8l_skip25a - ; source: test_word_lt.p8:4157 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4158 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4160 goto skip25b - bra p8l_skip25b - ; source: test_word_lt.p8:4161 lbl25b: fail_word(374) -p8l_lbl25b - ldy #>$0176 - lda #<$0176 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4162 skip25b: -p8l_skip25b - ; source: test_word_lt.p8:4164 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_516_afterif - ; source: test_word_lt.p8:4165 fail_word(375) - ldy #>$0177 - lda #<$0177 - jsr p8b_main.p8s_fail_word -label_asm_516_afterif - ; source: test_word_lt.p8:4168 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_518_else - ; source: test_word_lt.p8:4169 fail_word(376) - ldy #>$0178 - lda #<$0178 - jsr p8b_main.p8s_fail_word - bra label_asm_517_afterif -label_asm_518_else - ; source: test_word_lt.p8:4171 success++ - inc p8b_main.p8v_success -label_asm_517_afterif - ; source: test_word_lt.p8:4174 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_lt.p8:4176 goto skip26a - bra p8l_skip26a - ; source: test_word_lt.p8:4177 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4178 skip26a: -p8l_skip26a - ; source: test_word_lt.p8:4180 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4181 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4183 goto skip26b - bra p8l_skip26b - ; source: test_word_lt.p8:4184 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4185 skip26b: -p8l_skip26b - ; source: test_word_lt.p8:4187 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_519_afterif - ; source: test_word_lt.p8:4188 success++ - inc p8b_main.p8v_success -label_asm_519_afterif - ; source: test_word_lt.p8:4191 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_521_else - ; source: test_word_lt.p8:4192 success++ - inc p8b_main.p8v_success - bra label_asm_520_afterif -label_asm_521_else - ; source: test_word_lt.p8:4194 cx16.r0L++ - inc cx16.r0L -label_asm_520_afterif - ; source: test_word_lt.p8:4197 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_lt.p8:4199 goto skip27a - bra p8l_skip27a - ; source: test_word_lt.p8:4200 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4201 skip27a: -p8l_skip27a - ; source: test_word_lt.p8:4203 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4204 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4206 goto skip27b - bra p8l_skip27b - ; source: test_word_lt.p8:4207 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4208 skip27b: -p8l_skip27b - ; source: test_word_lt.p8:4210 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_522_afterif - ; source: test_word_lt.p8:4211 success++ - inc p8b_main.p8v_success -label_asm_522_afterif - ; source: test_word_lt.p8:4214 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_524_else - ; source: test_word_lt.p8:4215 success++ - inc p8b_main.p8v_success - bra label_asm_523_afterif -label_asm_524_else - ; source: test_word_lt.p8:4217 cx16.r0L++ - inc cx16.r0L -label_asm_523_afterif - ; source: test_word_lt.p8:4220 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_lt.p8:4222 goto skip28a - bra p8l_skip28a - ; source: test_word_lt.p8:4223 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4224 skip28a: -p8l_skip28a - ; source: test_word_lt.p8:4226 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4227 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4229 goto skip28b - bra p8l_skip28b - ; source: test_word_lt.p8:4230 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4231 skip28b: -p8l_skip28b - ; source: test_word_lt.p8:4233 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_525_afterif - ; source: test_word_lt.p8:4234 success++ - inc p8b_main.p8v_success -label_asm_525_afterif - ; source: test_word_lt.p8:4237 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_527_else - ; source: test_word_lt.p8:4238 success++ - inc p8b_main.p8v_success - bra label_asm_526_afterif -label_asm_527_else - ; source: test_word_lt.p8:4240 cx16.r0L++ - inc cx16.r0L -label_asm_526_afterif - ; source: test_word_lt.p8:4242 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:4244 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_lt.p8:4246 goto skip29a - bra p8l_skip29a - ; source: test_word_lt.p8:4247 lbl29a: fail_word(377) -p8l_lbl29a - ldy #>$0179 - lda #<$0179 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4248 skip29a: -p8l_skip29a - ; source: test_word_lt.p8:4250 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4251 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4253 goto skip29b - bra p8l_skip29b - ; source: test_word_lt.p8:4254 lbl29b: fail_word(378) -p8l_lbl29b - ldy #>$017a - lda #<$017a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4255 skip29b: -p8l_skip29b - ; source: test_word_lt.p8:4257 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_528_afterif - ; source: test_word_lt.p8:4258 fail_word(379) - ldy #>$017b - lda #<$017b - jsr p8b_main.p8s_fail_word -label_asm_528_afterif - ; source: test_word_lt.p8:4261 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_530_else - ; source: test_word_lt.p8:4262 fail_word(380) - ldy #>$017c - lda #<$017c - jsr p8b_main.p8s_fail_word - bra label_asm_529_afterif -label_asm_530_else - ; source: test_word_lt.p8:4264 success++ - inc p8b_main.p8v_success -label_asm_529_afterif - ; source: test_word_lt.p8:4267 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_lt.p8:4269 goto skip30a - bra p8l_skip30a - ; source: test_word_lt.p8:4270 lbl30a: fail_word(381) -p8l_lbl30a - ldy #>$017d - lda #<$017d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4271 skip30a: -p8l_skip30a - ; source: test_word_lt.p8:4273 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4274 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4276 goto skip30b - bra p8l_skip30b - ; source: test_word_lt.p8:4277 lbl30b: fail_word(382) -p8l_lbl30b - ldy #>$017e - lda #<$017e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4278 skip30b: -p8l_skip30b - ; source: test_word_lt.p8:4280 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_531_afterif - ; source: test_word_lt.p8:4281 fail_word(383) - ldy #>$017f - lda #<$017f - jsr p8b_main.p8s_fail_word -label_asm_531_afterif - ; source: test_word_lt.p8:4284 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_533_else - ; source: test_word_lt.p8:4285 fail_word(384) - ldy #>$0180 - lda #<$0180 - jsr p8b_main.p8s_fail_word - bra label_asm_532_afterif -label_asm_533_else - ; source: test_word_lt.p8:4287 success++ - inc p8b_main.p8v_success -label_asm_532_afterif - ; source: test_word_lt.p8:4290 if x$0181 - lda #<$0181 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4294 skip31a: -p8l_skip31a - ; source: test_word_lt.p8:4296 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4297 if x$0182 - lda #<$0182 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4301 skip31b: -p8l_skip31b - ; source: test_word_lt.p8:4303 if x$0183 - lda #<$0183 - jsr p8b_main.p8s_fail_word -label_asm_534_afterif - ; source: test_word_lt.p8:4307 if x$0184 - lda #<$0184 - jsr p8b_main.p8s_fail_word - bra label_asm_535_afterif -label_asm_536_else - ; source: test_word_lt.p8:4310 success++ - inc p8b_main.p8v_success -label_asm_535_afterif - ; source: test_word_lt.p8:4313 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_lt.p8:4315 goto skip32a - bra p8l_skip32a - ; source: test_word_lt.p8:4316 lbl32a: fail_word(389) -p8l_lbl32a - ldy #>$0185 - lda #<$0185 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4317 skip32a: -p8l_skip32a - ; source: test_word_lt.p8:4319 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4320 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4322 goto skip32b - bra p8l_skip32b - ; source: test_word_lt.p8:4323 lbl32b: fail_word(390) -p8l_lbl32b - ldy #>$0186 - lda #<$0186 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4324 skip32b: -p8l_skip32b - ; source: test_word_lt.p8:4326 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_537_afterif - ; source: test_word_lt.p8:4327 fail_word(391) - ldy #>$0187 - lda #<$0187 - jsr p8b_main.p8s_fail_word -label_asm_537_afterif - ; source: test_word_lt.p8:4330 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_539_else - ; source: test_word_lt.p8:4331 fail_word(392) - ldy #>$0188 - lda #<$0188 - jsr p8b_main.p8s_fail_word - bra label_asm_538_afterif -label_asm_539_else - ; source: test_word_lt.p8:4333 success++ - inc p8b_main.p8v_success -label_asm_538_afterif - ; source: test_word_lt.p8:4336 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_lt.p8:4338 goto skip33a - bra p8l_skip33a - ; source: test_word_lt.p8:4339 lbl33a: fail_word(393) -p8l_lbl33a - ldy #>$0189 - lda #<$0189 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4340 skip33a: -p8l_skip33a - ; source: test_word_lt.p8:4342 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4343 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4345 goto skip33b - bra p8l_skip33b - ; source: test_word_lt.p8:4346 lbl33b: fail_word(394) -p8l_lbl33b - ldy #>$018a - lda #<$018a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4347 skip33b: -p8l_skip33b - ; source: test_word_lt.p8:4349 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_540_afterif - ; source: test_word_lt.p8:4350 fail_word(395) - ldy #>$018b - lda #<$018b - jsr p8b_main.p8s_fail_word -label_asm_540_afterif - ; source: test_word_lt.p8:4353 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_542_else - ; source: test_word_lt.p8:4354 fail_word(396) - ldy #>$018c - lda #<$018c - jsr p8b_main.p8s_fail_word - bra label_asm_541_afterif -label_asm_542_else - ; source: test_word_lt.p8:4356 success++ - inc p8b_main.p8v_success -label_asm_541_afterif - ; source: test_word_lt.p8:4359 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_lt.p8:4361 goto skip34a - bra p8l_skip34a - ; source: test_word_lt.p8:4362 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4363 skip34a: -p8l_skip34a - ; source: test_word_lt.p8:4365 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4366 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4368 goto skip34b - bra p8l_skip34b - ; source: test_word_lt.p8:4369 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4370 skip34b: -p8l_skip34b - ; source: test_word_lt.p8:4372 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_543_afterif - ; source: test_word_lt.p8:4373 success++ - inc p8b_main.p8v_success -label_asm_543_afterif - ; source: test_word_lt.p8:4376 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_545_else - ; source: test_word_lt.p8:4377 success++ - inc p8b_main.p8v_success - bra label_asm_544_afterif -label_asm_545_else - ; source: test_word_lt.p8:4379 cx16.r0L++ - inc cx16.r0L -label_asm_544_afterif - ; source: test_word_lt.p8:4382 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_lt.p8:4384 goto skip35a - bra p8l_skip35a - ; source: test_word_lt.p8:4385 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4386 skip35a: -p8l_skip35a - ; source: test_word_lt.p8:4388 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4389 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4391 goto skip35b - bra p8l_skip35b - ; source: test_word_lt.p8:4392 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4393 skip35b: -p8l_skip35b - ; source: test_word_lt.p8:4395 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_546_afterif - ; source: test_word_lt.p8:4396 success++ - inc p8b_main.p8v_success -label_asm_546_afterif - ; source: test_word_lt.p8:4399 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_548_else - ; source: test_word_lt.p8:4400 success++ - inc p8b_main.p8v_success - bra label_asm_547_afterif -label_asm_548_else - ; source: test_word_lt.p8:4402 cx16.r0L++ - inc cx16.r0L -label_asm_547_afterif - ; source: test_word_lt.p8:4404 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:4406 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_lt.p8:4408 goto skip36a - bra p8l_skip36a - ; source: test_word_lt.p8:4409 lbl36a: fail_word(397) -p8l_lbl36a - ldy #>$018d - lda #<$018d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4410 skip36a: -p8l_skip36a - ; source: test_word_lt.p8:4412 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4413 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4415 goto skip36b - bra p8l_skip36b - ; source: test_word_lt.p8:4416 lbl36b: fail_word(398) -p8l_lbl36b - ldy #>$018e - lda #<$018e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4417 skip36b: -p8l_skip36b - ; source: test_word_lt.p8:4419 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_549_afterif - ; source: test_word_lt.p8:4420 fail_word(399) - ldy #>$018f - lda #<$018f - jsr p8b_main.p8s_fail_word -label_asm_549_afterif - ; source: test_word_lt.p8:4423 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_551_else - ; source: test_word_lt.p8:4424 fail_word(400) - ldy #>$0190 - lda #<$0190 - jsr p8b_main.p8s_fail_word - bra label_asm_550_afterif -label_asm_551_else - ; source: test_word_lt.p8:4426 success++ - inc p8b_main.p8v_success -label_asm_550_afterif - ; source: test_word_lt.p8:4429 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_lt.p8:4431 goto skip37a - bra p8l_skip37a - ; source: test_word_lt.p8:4432 lbl37a: fail_word(401) -p8l_lbl37a - ldy #>$0191 - lda #<$0191 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4433 skip37a: -p8l_skip37a - ; source: test_word_lt.p8:4435 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4436 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4438 goto skip37b - bra p8l_skip37b - ; source: test_word_lt.p8:4439 lbl37b: fail_word(402) -p8l_lbl37b - ldy #>$0192 - lda #<$0192 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4440 skip37b: -p8l_skip37b - ; source: test_word_lt.p8:4442 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_552_afterif - ; source: test_word_lt.p8:4443 fail_word(403) - ldy #>$0193 - lda #<$0193 - jsr p8b_main.p8s_fail_word -label_asm_552_afterif - ; source: test_word_lt.p8:4446 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_554_else - ; source: test_word_lt.p8:4447 fail_word(404) - ldy #>$0194 - lda #<$0194 - jsr p8b_main.p8s_fail_word - bra label_asm_553_afterif -label_asm_554_else - ; source: test_word_lt.p8:4449 success++ - inc p8b_main.p8v_success -label_asm_553_afterif - ; source: test_word_lt.p8:4452 if x$0195 - lda #<$0195 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4456 skip38a: -p8l_skip38a - ; source: test_word_lt.p8:4458 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4459 if x$0196 - lda #<$0196 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4463 skip38b: -p8l_skip38b - ; source: test_word_lt.p8:4465 if x$0197 - lda #<$0197 - jsr p8b_main.p8s_fail_word -label_asm_555_afterif - ; source: test_word_lt.p8:4469 if x$0198 - lda #<$0198 - jsr p8b_main.p8s_fail_word - bra label_asm_556_afterif -label_asm_557_else - ; source: test_word_lt.p8:4472 success++ - inc p8b_main.p8v_success -label_asm_556_afterif - ; source: test_word_lt.p8:4475 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_lt.p8:4477 goto skip39a - bra p8l_skip39a - ; source: test_word_lt.p8:4478 lbl39a: fail_word(409) -p8l_lbl39a - ldy #>$0199 - lda #<$0199 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4479 skip39a: -p8l_skip39a - ; source: test_word_lt.p8:4481 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4482 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4484 goto skip39b - bra p8l_skip39b - ; source: test_word_lt.p8:4485 lbl39b: fail_word(410) -p8l_lbl39b - ldy #>$019a - lda #<$019a - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4486 skip39b: -p8l_skip39b - ; source: test_word_lt.p8:4488 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_558_afterif - ; source: test_word_lt.p8:4489 fail_word(411) - ldy #>$019b - lda #<$019b - jsr p8b_main.p8s_fail_word -label_asm_558_afterif - ; source: test_word_lt.p8:4492 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_560_else - ; source: test_word_lt.p8:4493 fail_word(412) - ldy #>$019c - lda #<$019c - jsr p8b_main.p8s_fail_word - bra label_asm_559_afterif -label_asm_560_else - ; source: test_word_lt.p8:4495 success++ - inc p8b_main.p8v_success -label_asm_559_afterif - ; source: test_word_lt.p8:4498 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_lt.p8:4500 goto skip40a - bra p8l_skip40a - ; source: test_word_lt.p8:4501 lbl40a: fail_word(413) -p8l_lbl40a - ldy #>$019d - lda #<$019d - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4502 skip40a: -p8l_skip40a - ; source: test_word_lt.p8:4504 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4505 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4507 goto skip40b - bra p8l_skip40b - ; source: test_word_lt.p8:4508 lbl40b: fail_word(414) -p8l_lbl40b - ldy #>$019e - lda #<$019e - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4509 skip40b: -p8l_skip40b - ; source: test_word_lt.p8:4511 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_561_afterif - ; source: test_word_lt.p8:4512 fail_word(415) - ldy #>$019f - lda #<$019f - jsr p8b_main.p8s_fail_word -label_asm_561_afterif - ; source: test_word_lt.p8:4515 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_563_else - ; source: test_word_lt.p8:4516 fail_word(416) - ldy #>$01a0 - lda #<$01a0 - jsr p8b_main.p8s_fail_word - bra label_asm_562_afterif -label_asm_563_else - ; source: test_word_lt.p8:4518 success++ - inc p8b_main.p8v_success -label_asm_562_afterif - ; source: test_word_lt.p8:4521 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_lt.p8:4523 goto skip41a - bra p8l_skip41a - ; source: test_word_lt.p8:4524 lbl41a: fail_word(417) -p8l_lbl41a - ldy #>$01a1 - lda #<$01a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4525 skip41a: -p8l_skip41a - ; source: test_word_lt.p8:4527 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4528 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4530 goto skip41b - bra p8l_skip41b - ; source: test_word_lt.p8:4531 lbl41b: fail_word(418) -p8l_lbl41b - ldy #>$01a2 - lda #<$01a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4532 skip41b: -p8l_skip41b - ; source: test_word_lt.p8:4534 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_564_afterif - ; source: test_word_lt.p8:4535 fail_word(419) - ldy #>$01a3 - lda #<$01a3 - jsr p8b_main.p8s_fail_word -label_asm_564_afterif - ; source: test_word_lt.p8:4538 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_566_else - ; source: test_word_lt.p8:4539 fail_word(420) - ldy #>$01a4 - lda #<$01a4 - jsr p8b_main.p8s_fail_word - bra label_asm_565_afterif -label_asm_566_else - ; source: test_word_lt.p8:4541 success++ - inc p8b_main.p8v_success -label_asm_565_afterif - ; source: test_word_lt.p8:4544 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_lt.p8:4546 goto skip42a - bra p8l_skip42a - ; source: test_word_lt.p8:4547 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4548 skip42a: -p8l_skip42a - ; source: test_word_lt.p8:4550 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4551 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4553 goto skip42b - bra p8l_skip42b - ; source: test_word_lt.p8:4554 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - ; source: test_word_lt.p8:4555 skip42b: -p8l_skip42b - ; source: test_word_lt.p8:4557 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_567_afterif - ; source: test_word_lt.p8:4558 success++ - inc p8b_main.p8v_success -label_asm_567_afterif - ; source: test_word_lt.p8:4561 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_569_else - ; source: test_word_lt.p8:4562 success++ - inc p8b_main.p8v_success - bra label_asm_568_afterif -label_asm_569_else - ; source: test_word_lt.p8:4564 cx16.r0L++ - inc cx16.r0L -label_asm_568_afterif - ; source: test_word_lt.p8:4566 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lt.p8:4568 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_lt.p8:4570 goto skip43a - bra p8l_skip43a - ; source: test_word_lt.p8:4571 lbl43a: fail_word(421) -p8l_lbl43a - ldy #>$01a5 - lda #<$01a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4572 skip43a: -p8l_skip43a - ; source: test_word_lt.p8:4574 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4575 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4577 goto skip43b - bra p8l_skip43b - ; source: test_word_lt.p8:4578 lbl43b: fail_word(422) -p8l_lbl43b - ldy #>$01a6 - lda #<$01a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4579 skip43b: -p8l_skip43b - ; source: test_word_lt.p8:4581 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_570_afterif - ; source: test_word_lt.p8:4582 fail_word(423) - ldy #>$01a7 - lda #<$01a7 - jsr p8b_main.p8s_fail_word -label_asm_570_afterif - ; source: test_word_lt.p8:4585 if x$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_572_else - ; source: test_word_lt.p8:4586 fail_word(424) - ldy #>$01a8 - lda #<$01a8 - jsr p8b_main.p8s_fail_word - bra label_asm_571_afterif -label_asm_572_else - ; source: test_word_lt.p8:4588 success++ - inc p8b_main.p8v_success -label_asm_571_afterif - ; source: test_word_lt.p8:4591 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_lt.p8:4593 goto skip44a - bra p8l_skip44a - ; source: test_word_lt.p8:4594 lbl44a: fail_word(425) -p8l_lbl44a - ldy #>$01a9 - lda #<$01a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4595 skip44a: -p8l_skip44a - ; source: test_word_lt.p8:4597 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4598 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4600 goto skip44b - bra p8l_skip44b - ; source: test_word_lt.p8:4601 lbl44b: fail_word(426) -p8l_lbl44b - ldy #>$01aa - lda #<$01aa - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4602 skip44b: -p8l_skip44b - ; source: test_word_lt.p8:4604 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_573_afterif - ; source: test_word_lt.p8:4605 fail_word(427) - ldy #>$01ab - lda #<$01ab - jsr p8b_main.p8s_fail_word -label_asm_573_afterif - ; source: test_word_lt.p8:4608 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_575_else - ; source: test_word_lt.p8:4609 fail_word(428) - ldy #>$01ac - lda #<$01ac - jsr p8b_main.p8s_fail_word - bra label_asm_574_afterif -label_asm_575_else - ; source: test_word_lt.p8:4611 success++ - inc p8b_main.p8v_success -label_asm_574_afterif - ; source: test_word_lt.p8:4614 if x$01ad - lda #<$01ad - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4618 skip45a: -p8l_skip45a - ; source: test_word_lt.p8:4620 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4621 if x$01ae - lda #<$01ae - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4625 skip45b: -p8l_skip45b - ; source: test_word_lt.p8:4627 if x$01af - lda #<$01af - jsr p8b_main.p8s_fail_word -label_asm_576_afterif - ; source: test_word_lt.p8:4631 if x$01b0 - lda #<$01b0 - jsr p8b_main.p8s_fail_word - bra label_asm_577_afterif -label_asm_578_else - ; source: test_word_lt.p8:4634 success++ - inc p8b_main.p8v_success -label_asm_577_afterif - ; source: test_word_lt.p8:4637 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_lt.p8:4639 goto skip46a - bra p8l_skip46a - ; source: test_word_lt.p8:4640 lbl46a: fail_word(433) -p8l_lbl46a - ldy #>$01b1 - lda #<$01b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4641 skip46a: -p8l_skip46a - ; source: test_word_lt.p8:4643 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4644 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4646 goto skip46b - bra p8l_skip46b - ; source: test_word_lt.p8:4647 lbl46b: fail_word(434) -p8l_lbl46b - ldy #>$01b2 - lda #<$01b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4648 skip46b: -p8l_skip46b - ; source: test_word_lt.p8:4650 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_579_afterif - ; source: test_word_lt.p8:4651 fail_word(435) - ldy #>$01b3 - lda #<$01b3 - jsr p8b_main.p8s_fail_word -label_asm_579_afterif - ; source: test_word_lt.p8:4654 if x1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_581_else - ; source: test_word_lt.p8:4655 fail_word(436) - ldy #>$01b4 - lda #<$01b4 - jsr p8b_main.p8s_fail_word - bra label_asm_580_afterif -label_asm_581_else - ; source: test_word_lt.p8:4657 success++ - inc p8b_main.p8v_success -label_asm_580_afterif - ; source: test_word_lt.p8:4660 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_lt.p8:4662 goto skip47a - bra p8l_skip47a - ; source: test_word_lt.p8:4663 lbl47a: fail_word(437) -p8l_lbl47a - ldy #>$01b5 - lda #<$01b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4664 skip47a: -p8l_skip47a - ; source: test_word_lt.p8:4666 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4667 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4669 goto skip47b - bra p8l_skip47b - ; source: test_word_lt.p8:4670 lbl47b: fail_word(438) -p8l_lbl47b - ldy #>$01b6 - lda #<$01b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4671 skip47b: -p8l_skip47b - ; source: test_word_lt.p8:4673 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_582_afterif - ; source: test_word_lt.p8:4674 fail_word(439) - ldy #>$01b7 - lda #<$01b7 - jsr p8b_main.p8s_fail_word -label_asm_582_afterif - ; source: test_word_lt.p8:4677 if x$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_584_else - ; source: test_word_lt.p8:4678 fail_word(440) - ldy #>$01b8 - lda #<$01b8 - jsr p8b_main.p8s_fail_word - bra label_asm_583_afterif -label_asm_584_else - ; source: test_word_lt.p8:4680 success++ - inc p8b_main.p8v_success -label_asm_583_afterif - ; source: test_word_lt.p8:4683 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_lt.p8:4685 goto skip48a - bra p8l_skip48a - ; source: test_word_lt.p8:4686 lbl48a: fail_word(441) -p8l_lbl48a - ldy #>$01b9 - lda #<$01b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4687 skip48a: -p8l_skip48a - ; source: test_word_lt.p8:4689 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4690 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4692 goto skip48b - bra p8l_skip48b - ; source: test_word_lt.p8:4693 lbl48b: fail_word(442) -p8l_lbl48b - ldy #>$01ba - lda #<$01ba - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4694 skip48b: -p8l_skip48b - ; source: test_word_lt.p8:4696 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_585_afterif - ; source: test_word_lt.p8:4697 fail_word(443) - ldy #>$01bb - lda #<$01bb - jsr p8b_main.p8s_fail_word -label_asm_585_afterif - ; source: test_word_lt.p8:4700 if x$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_587_else - ; source: test_word_lt.p8:4701 fail_word(444) - ldy #>$01bc - lda #<$01bc - jsr p8b_main.p8s_fail_word - bra label_asm_586_afterif -label_asm_587_else - ; source: test_word_lt.p8:4703 success++ - inc p8b_main.p8v_success -label_asm_586_afterif - ; source: test_word_lt.p8:4706 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_lt.p8:4708 goto skip49a - bra p8l_skip49a - ; source: test_word_lt.p8:4709 lbl49a: fail_word(445) -p8l_lbl49a - ldy #>$01bd - lda #<$01bd - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4710 skip49a: -p8l_skip49a - ; source: test_word_lt.p8:4712 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lt.p8:4713 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lt.p8:4715 goto skip49b - bra p8l_skip49b - ; source: test_word_lt.p8:4716 lbl49b: fail_word(446) -p8l_lbl49b - ldy #>$01be - lda #<$01be - jsr p8b_main.p8s_fail_word - ; source: test_word_lt.p8:4717 skip49b: -p8l_skip49b - ; source: test_word_lt.p8:4719 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_588_afterif - ; source: test_word_lt.p8:4720 fail_word(447) - ldy #>$01bf - lda #<$01bf - jsr p8b_main.p8s_fail_word -label_asm_588_afterif - ; source: test_word_lt.p8:4723 if x$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_590_else - ; source: test_word_lt.p8:4724 fail_word(448) - ldy #>$01c0 - lda #<$01c0 - jsr p8b_main.p8s_fail_word - bra label_asm_589_afterif -label_asm_590_else - ; source: test_word_lt.p8:4726 success++ - inc p8b_main.p8v_success -label_asm_589_afterif - ; source: test_word_lt.p8:4728 verify_success(112) - lda #$70 - jmp p8b_main.p8s_verify_success - ; source: test_word_lt.p8:3587 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .sint ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $54, $45, $53, $54, $53 - .byte $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_lt.p8 b/compiler/test/comparisons/test_word_lt.p8 deleted file mode 100644 index c4babbfc9..000000000 --- a/compiler/test/comparisons/test_word_lt.p8 +++ /dev/null @@ -1,4732 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\nless-than tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_lte.p8:14 txt.print("\nless-equal tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:76 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_lte.p8:78 goto skip1a - bra p8l_skip1a - ; source: test_word_lte.p8:79 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:80 skip1a: -p8l_skip1a - ; source: test_word_lte.p8:82 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:83 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:85 goto skip1b - bra p8l_skip1b - ; source: test_word_lte.p8:86 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:87 skip1b: -p8l_skip1b - ; source: test_word_lte.p8:89 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_lte.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_word_lte.p8:93 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_lte.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_lte.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_word_lte.p8:99 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl2a - ; source: test_word_lte.p8:101 goto skip2a - bra p8l_skip2a - ; source: test_word_lte.p8:102 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:103 skip2a: -p8l_skip2a - ; source: test_word_lte.p8:105 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:106 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:108 goto skip2b - bra p8l_skip2b - ; source: test_word_lte.p8:109 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:110 skip2b: -p8l_skip2b - ; source: test_word_lte.p8:112 if x<=-1 - lda p8v_x+1 - bpl label_asm_6_afterif - ; source: test_word_lte.p8:113 success++ - inc p8b_main.p8v_success -label_asm_6_afterif - ; source: test_word_lte.p8:116 if x<=-1 - lda p8v_x+1 - bpl label_asm_8_else - ; source: test_word_lte.p8:117 success++ - inc p8b_main.p8v_success - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_lte.p8:119 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_word_lte.p8:122 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl3a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl3a -+ - ; source: test_word_lte.p8:124 goto skip3a - bra p8l_skip3a - ; source: test_word_lte.p8:125 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:126 skip3a: -p8l_skip3a - ; source: test_word_lte.p8:128 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:129 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:131 goto skip3b - bra p8l_skip3b - ; source: test_word_lte.p8:132 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:133 skip3b: -p8l_skip3b - ; source: test_word_lte.p8:135 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_9_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_9_afterif -+ - ; source: test_word_lte.p8:136 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_word_lte.p8:139 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_11_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_11_else -+ - ; source: test_word_lte.p8:140 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_lte.p8:142 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_word_lte.p8:145 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_lte.p8:147 goto skip4a - bra p8l_skip4a - ; source: test_word_lte.p8:148 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:149 skip4a: -p8l_skip4a - ; source: test_word_lte.p8:151 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:152 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:154 goto skip4b - bra p8l_skip4b - ; source: test_word_lte.p8:155 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:156 skip4b: -p8l_skip4b - ; source: test_word_lte.p8:158 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_12_afterif - ; source: test_word_lte.p8:159 success++ - inc p8b_main.p8v_success -label_asm_12_afterif - ; source: test_word_lte.p8:162 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_14_else - ; source: test_word_lte.p8:163 success++ - inc p8b_main.p8v_success - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_lte.p8:165 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_word_lte.p8:168 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_lte.p8:170 goto skip5a - bra p8l_skip5a - ; source: test_word_lte.p8:171 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:172 skip5a: -p8l_skip5a - ; source: test_word_lte.p8:174 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:175 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:177 goto skip5b - bra p8l_skip5b - ; source: test_word_lte.p8:178 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:179 skip5b: -p8l_skip5b - ; source: test_word_lte.p8:181 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_lte.p8:182 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_word_lte.p8:185 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_lte.p8:186 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_lte.p8:188 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_word_lte.p8:191 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_lte.p8:193 goto skip6a - bra p8l_skip6a - ; source: test_word_lte.p8:194 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:195 skip6a: -p8l_skip6a - ; source: test_word_lte.p8:197 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:198 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:200 goto skip6b - bra p8l_skip6b - ; source: test_word_lte.p8:201 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:202 skip6b: -p8l_skip6b - ; source: test_word_lte.p8:204 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_lte.p8:205 success++ - inc p8b_main.p8v_success -label_asm_18_afterif - ; source: test_word_lte.p8:208 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_lte.p8:209 success++ - inc p8b_main.p8v_success - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_lte.p8:211 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_word_lte.p8:214 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_lte.p8:216 goto skip7a - bra p8l_skip7a - ; source: test_word_lte.p8:217 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:218 skip7a: -p8l_skip7a - ; source: test_word_lte.p8:220 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:221 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:223 goto skip7b - bra p8l_skip7b - ; source: test_word_lte.p8:224 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:225 skip7b: -p8l_skip7b - ; source: test_word_lte.p8:227 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_lte.p8:228 success++ - inc p8b_main.p8v_success -label_asm_21_afterif - ; source: test_word_lte.p8:231 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_lte.p8:232 success++ - inc p8b_main.p8v_success - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_lte.p8:234 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_word_lte.p8:236 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:238 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_lte.p8:240 goto skip8a - bra p8l_skip8a - ; source: test_word_lte.p8:241 lbl8a: fail_word(1) -p8l_lbl8a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:242 skip8a: -p8l_skip8a - ; source: test_word_lte.p8:244 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:245 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:247 goto skip8b - bra p8l_skip8b - ; source: test_word_lte.p8:248 lbl8b: fail_word(2) -p8l_lbl8b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:249 skip8b: -p8l_skip8b - ; source: test_word_lte.p8:251 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_lte.p8:252 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_24_afterif - ; source: test_word_lte.p8:255 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_lte.p8:256 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_lte.p8:258 success++ - inc p8b_main.p8v_success -label_asm_25_afterif - ; source: test_word_lte.p8:261 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl9a - ; source: test_word_lte.p8:263 goto skip9a - bra p8l_skip9a - ; source: test_word_lte.p8:264 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:265 skip9a: -p8l_skip9a - ; source: test_word_lte.p8:267 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:268 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:270 goto skip9b - bra p8l_skip9b - ; source: test_word_lte.p8:271 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:272 skip9b: -p8l_skip9b - ; source: test_word_lte.p8:274 if x<=-1 - lda p8v_x+1 - bpl label_asm_27_afterif - ; source: test_word_lte.p8:275 success++ - inc p8b_main.p8v_success -label_asm_27_afterif - ; source: test_word_lte.p8:278 if x<=-1 - lda p8v_x+1 - bpl label_asm_29_else - ; source: test_word_lte.p8:279 success++ - inc p8b_main.p8v_success - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_lte.p8:281 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_word_lte.p8:284 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl10a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl10a -+ - ; source: test_word_lte.p8:286 goto skip10a - bra p8l_skip10a - ; source: test_word_lte.p8:287 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:288 skip10a: -p8l_skip10a - ; source: test_word_lte.p8:290 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:291 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:293 goto skip10b - bra p8l_skip10b - ; source: test_word_lte.p8:294 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:295 skip10b: -p8l_skip10b - ; source: test_word_lte.p8:297 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_30_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_30_afterif -+ - ; source: test_word_lte.p8:298 success++ - inc p8b_main.p8v_success -label_asm_30_afterif - ; source: test_word_lte.p8:301 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_32_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_32_else -+ - ; source: test_word_lte.p8:302 success++ - inc p8b_main.p8v_success - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_lte.p8:304 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_word_lte.p8:307 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_lte.p8:309 goto skip11a - bra p8l_skip11a - ; source: test_word_lte.p8:310 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:311 skip11a: -p8l_skip11a - ; source: test_word_lte.p8:313 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:314 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:316 goto skip11b - bra p8l_skip11b - ; source: test_word_lte.p8:317 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:318 skip11b: -p8l_skip11b - ; source: test_word_lte.p8:320 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_33_afterif - ; source: test_word_lte.p8:321 success++ - inc p8b_main.p8v_success -label_asm_33_afterif - ; source: test_word_lte.p8:324 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_35_else - ; source: test_word_lte.p8:325 success++ - inc p8b_main.p8v_success - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_lte.p8:327 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_word_lte.p8:330 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_lte.p8:332 goto skip12a - bra p8l_skip12a - ; source: test_word_lte.p8:333 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:334 skip12a: -p8l_skip12a - ; source: test_word_lte.p8:336 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:337 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:339 goto skip12b - bra p8l_skip12b - ; source: test_word_lte.p8:340 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:341 skip12b: -p8l_skip12b - ; source: test_word_lte.p8:343 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_lte.p8:344 success++ - inc p8b_main.p8v_success -label_asm_36_afterif - ; source: test_word_lte.p8:347 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_lte.p8:348 success++ - inc p8b_main.p8v_success - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_lte.p8:350 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_word_lte.p8:353 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_lte.p8:355 goto skip13a - bra p8l_skip13a - ; source: test_word_lte.p8:356 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:357 skip13a: -p8l_skip13a - ; source: test_word_lte.p8:359 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:360 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:362 goto skip13b - bra p8l_skip13b - ; source: test_word_lte.p8:363 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:364 skip13b: -p8l_skip13b - ; source: test_word_lte.p8:366 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_lte.p8:367 success++ - inc p8b_main.p8v_success -label_asm_39_afterif - ; source: test_word_lte.p8:370 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_lte.p8:371 success++ - inc p8b_main.p8v_success - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_lte.p8:373 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_word_lte.p8:376 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_lte.p8:378 goto skip14a - bra p8l_skip14a - ; source: test_word_lte.p8:379 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:380 skip14a: -p8l_skip14a - ; source: test_word_lte.p8:382 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:383 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:385 goto skip14b - bra p8l_skip14b - ; source: test_word_lte.p8:386 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:387 skip14b: -p8l_skip14b - ; source: test_word_lte.p8:389 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_lte.p8:390 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_word_lte.p8:393 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_lte.p8:394 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_lte.p8:396 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_word_lte.p8:398 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_lte.p8:400 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_lte.p8:402 goto skip15a - bra p8l_skip15a - ; source: test_word_lte.p8:403 lbl15a: fail_word(5) -p8l_lbl15a - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:404 skip15a: -p8l_skip15a - ; source: test_word_lte.p8:406 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:407 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:409 goto skip15b - bra p8l_skip15b - ; source: test_word_lte.p8:410 lbl15b: fail_word(6) -p8l_lbl15b - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:411 skip15b: -p8l_skip15b - ; source: test_word_lte.p8:413 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_lte.p8:414 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_45_afterif - ; source: test_word_lte.p8:417 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_lte.p8:418 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_lte.p8:420 success++ - inc p8b_main.p8v_success -label_asm_46_afterif - ; source: test_word_lte.p8:423 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl16a - ; source: test_word_lte.p8:425 goto skip16a - bra p8l_skip16a - ; source: test_word_lte.p8:426 lbl16a: fail_word(9) -p8l_lbl16a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:427 skip16a: -p8l_skip16a - ; source: test_word_lte.p8:429 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:430 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:432 goto skip16b - bra p8l_skip16b - ; source: test_word_lte.p8:433 lbl16b: fail_word(10) -p8l_lbl16b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:434 skip16b: -p8l_skip16b - ; source: test_word_lte.p8:436 if x<=-1 - lda p8v_x+1 - bpl label_asm_48_afterif - ; source: test_word_lte.p8:437 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_48_afterif - ; source: test_word_lte.p8:440 if x<=-1 - lda p8v_x+1 - bpl label_asm_50_else - ; source: test_word_lte.p8:441 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_lte.p8:443 success++ - inc p8b_main.p8v_success -label_asm_49_afterif - ; source: test_word_lte.p8:446 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl17a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl17a -+ - ; source: test_word_lte.p8:448 goto skip17a - bra p8l_skip17a - ; source: test_word_lte.p8:449 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:450 skip17a: -p8l_skip17a - ; source: test_word_lte.p8:452 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:453 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:455 goto skip17b - bra p8l_skip17b - ; source: test_word_lte.p8:456 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:457 skip17b: -p8l_skip17b - ; source: test_word_lte.p8:459 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_51_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_51_afterif -+ - ; source: test_word_lte.p8:460 success++ - inc p8b_main.p8v_success -label_asm_51_afterif - ; source: test_word_lte.p8:463 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_53_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_53_else -+ - ; source: test_word_lte.p8:464 success++ - inc p8b_main.p8v_success - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_lte.p8:466 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_word_lte.p8:469 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_lte.p8:471 goto skip18a - bra p8l_skip18a - ; source: test_word_lte.p8:472 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:473 skip18a: -p8l_skip18a - ; source: test_word_lte.p8:475 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:476 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:478 goto skip18b - bra p8l_skip18b - ; source: test_word_lte.p8:479 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:480 skip18b: -p8l_skip18b - ; source: test_word_lte.p8:482 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_54_afterif - ; source: test_word_lte.p8:483 success++ - inc p8b_main.p8v_success -label_asm_54_afterif - ; source: test_word_lte.p8:486 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_56_else - ; source: test_word_lte.p8:487 success++ - inc p8b_main.p8v_success - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_lte.p8:489 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_word_lte.p8:492 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_lte.p8:494 goto skip19a - bra p8l_skip19a - ; source: test_word_lte.p8:495 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:496 skip19a: -p8l_skip19a - ; source: test_word_lte.p8:498 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:499 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:501 goto skip19b - bra p8l_skip19b - ; source: test_word_lte.p8:502 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:503 skip19b: -p8l_skip19b - ; source: test_word_lte.p8:505 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_lte.p8:506 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_word_lte.p8:509 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_lte.p8:510 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_lte.p8:512 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_word_lte.p8:515 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_lte.p8:517 goto skip20a - bra p8l_skip20a - ; source: test_word_lte.p8:518 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:519 skip20a: -p8l_skip20a - ; source: test_word_lte.p8:521 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:522 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:524 goto skip20b - bra p8l_skip20b - ; source: test_word_lte.p8:525 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:526 skip20b: -p8l_skip20b - ; source: test_word_lte.p8:528 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_lte.p8:529 success++ - inc p8b_main.p8v_success -label_asm_60_afterif - ; source: test_word_lte.p8:532 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_lte.p8:533 success++ - inc p8b_main.p8v_success - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_lte.p8:535 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_word_lte.p8:538 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_lte.p8:540 goto skip21a - bra p8l_skip21a - ; source: test_word_lte.p8:541 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:542 skip21a: -p8l_skip21a - ; source: test_word_lte.p8:544 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:545 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:547 goto skip21b - bra p8l_skip21b - ; source: test_word_lte.p8:548 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:549 skip21b: -p8l_skip21b - ; source: test_word_lte.p8:551 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_lte.p8:552 success++ - inc p8b_main.p8v_success -label_asm_63_afterif - ; source: test_word_lte.p8:555 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_lte.p8:556 success++ - inc p8b_main.p8v_success - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_lte.p8:558 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_word_lte.p8:560 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:562 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_lte.p8:564 goto skip22a - bra p8l_skip22a - ; source: test_word_lte.p8:565 lbl22a: fail_word(13) -p8l_lbl22a - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:566 skip22a: -p8l_skip22a - ; source: test_word_lte.p8:568 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:569 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:571 goto skip22b - bra p8l_skip22b - ; source: test_word_lte.p8:572 lbl22b: fail_word(14) -p8l_lbl22b - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:573 skip22b: -p8l_skip22b - ; source: test_word_lte.p8:575 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_lte.p8:576 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_66_afterif - ; source: test_word_lte.p8:579 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_lte.p8:580 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_lte.p8:582 success++ - inc p8b_main.p8v_success -label_asm_67_afterif - ; source: test_word_lte.p8:585 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl23a - ; source: test_word_lte.p8:587 goto skip23a - bra p8l_skip23a - ; source: test_word_lte.p8:588 lbl23a: fail_word(17) -p8l_lbl23a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:589 skip23a: -p8l_skip23a - ; source: test_word_lte.p8:591 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:592 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:594 goto skip23b - bra p8l_skip23b - ; source: test_word_lte.p8:595 lbl23b: fail_word(18) -p8l_lbl23b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:596 skip23b: -p8l_skip23b - ; source: test_word_lte.p8:598 if x<=-1 - lda p8v_x+1 - bpl label_asm_69_afterif - ; source: test_word_lte.p8:599 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_69_afterif - ; source: test_word_lte.p8:602 if x<=-1 - lda p8v_x+1 - bpl label_asm_71_else - ; source: test_word_lte.p8:603 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_lte.p8:605 success++ - inc p8b_main.p8v_success -label_asm_70_afterif - ; source: test_word_lte.p8:608 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl24a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl24a -+ - ; source: test_word_lte.p8:610 goto skip24a - bra p8l_skip24a - ; source: test_word_lte.p8:611 lbl24a: fail_word(21) -p8l_lbl24a - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:612 skip24a: -p8l_skip24a - ; source: test_word_lte.p8:614 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:615 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:617 goto skip24b - bra p8l_skip24b - ; source: test_word_lte.p8:618 lbl24b: fail_word(22) -p8l_lbl24b - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:619 skip24b: -p8l_skip24b - ; source: test_word_lte.p8:621 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_72_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_72_afterif -+ - ; source: test_word_lte.p8:622 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_72_afterif - ; source: test_word_lte.p8:625 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_74_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_74_else -+ - ; source: test_word_lte.p8:626 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_lte.p8:628 success++ - inc p8b_main.p8v_success -label_asm_73_afterif - ; source: test_word_lte.p8:631 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_lte.p8:633 goto skip25a - bra p8l_skip25a - ; source: test_word_lte.p8:634 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:635 skip25a: -p8l_skip25a - ; source: test_word_lte.p8:637 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:638 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:640 goto skip25b - bra p8l_skip25b - ; source: test_word_lte.p8:641 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:642 skip25b: -p8l_skip25b - ; source: test_word_lte.p8:644 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_75_afterif - ; source: test_word_lte.p8:645 success++ - inc p8b_main.p8v_success -label_asm_75_afterif - ; source: test_word_lte.p8:648 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_77_else - ; source: test_word_lte.p8:649 success++ - inc p8b_main.p8v_success - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_lte.p8:651 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_word_lte.p8:654 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_lte.p8:656 goto skip26a - bra p8l_skip26a - ; source: test_word_lte.p8:657 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:658 skip26a: -p8l_skip26a - ; source: test_word_lte.p8:660 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:661 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:663 goto skip26b - bra p8l_skip26b - ; source: test_word_lte.p8:664 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:665 skip26b: -p8l_skip26b - ; source: test_word_lte.p8:667 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_lte.p8:668 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_word_lte.p8:671 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_lte.p8:672 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_lte.p8:674 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_word_lte.p8:677 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_lte.p8:679 goto skip27a - bra p8l_skip27a - ; source: test_word_lte.p8:680 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:681 skip27a: -p8l_skip27a - ; source: test_word_lte.p8:683 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:684 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:686 goto skip27b - bra p8l_skip27b - ; source: test_word_lte.p8:687 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:688 skip27b: -p8l_skip27b - ; source: test_word_lte.p8:690 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_lte.p8:691 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_word_lte.p8:694 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_lte.p8:695 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_lte.p8:697 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_word_lte.p8:700 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_lte.p8:702 goto skip28a - bra p8l_skip28a - ; source: test_word_lte.p8:703 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:704 skip28a: -p8l_skip28a - ; source: test_word_lte.p8:706 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:707 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:709 goto skip28b - bra p8l_skip28b - ; source: test_word_lte.p8:710 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:711 skip28b: -p8l_skip28b - ; source: test_word_lte.p8:713 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_lte.p8:714 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_word_lte.p8:717 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_lte.p8:718 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_lte.p8:720 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_word_lte.p8:722 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:724 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_lte.p8:726 goto skip29a - bra p8l_skip29a - ; source: test_word_lte.p8:727 lbl29a: fail_word(25) -p8l_lbl29a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:728 skip29a: -p8l_skip29a - ; source: test_word_lte.p8:730 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:731 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:733 goto skip29b - bra p8l_skip29b - ; source: test_word_lte.p8:734 lbl29b: fail_word(26) -p8l_lbl29b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:735 skip29b: -p8l_skip29b - ; source: test_word_lte.p8:737 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_lte.p8:738 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_87_afterif - ; source: test_word_lte.p8:741 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_lte.p8:742 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_lte.p8:744 success++ - inc p8b_main.p8v_success -label_asm_88_afterif - ; source: test_word_lte.p8:747 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl30a - ; source: test_word_lte.p8:749 goto skip30a - bra p8l_skip30a - ; source: test_word_lte.p8:750 lbl30a: fail_word(29) -p8l_lbl30a - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:751 skip30a: -p8l_skip30a - ; source: test_word_lte.p8:753 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:754 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:756 goto skip30b - bra p8l_skip30b - ; source: test_word_lte.p8:757 lbl30b: fail_word(30) -p8l_lbl30b - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:758 skip30b: -p8l_skip30b - ; source: test_word_lte.p8:760 if x<=-1 - lda p8v_x+1 - bpl label_asm_90_afterif - ; source: test_word_lte.p8:761 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_90_afterif - ; source: test_word_lte.p8:764 if x<=-1 - lda p8v_x+1 - bpl label_asm_92_else - ; source: test_word_lte.p8:765 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_lte.p8:767 success++ - inc p8b_main.p8v_success -label_asm_91_afterif - ; source: test_word_lte.p8:770 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl31a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl31a -+ - ; source: test_word_lte.p8:772 goto skip31a - bra p8l_skip31a - ; source: test_word_lte.p8:773 lbl31a: fail_word(33) -p8l_lbl31a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:774 skip31a: -p8l_skip31a - ; source: test_word_lte.p8:776 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:777 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:779 goto skip31b - bra p8l_skip31b - ; source: test_word_lte.p8:780 lbl31b: fail_word(34) -p8l_lbl31b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:781 skip31b: -p8l_skip31b - ; source: test_word_lte.p8:783 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_93_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_93_afterif -+ - ; source: test_word_lte.p8:784 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_93_afterif - ; source: test_word_lte.p8:787 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_95_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_95_else -+ - ; source: test_word_lte.p8:788 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_lte.p8:790 success++ - inc p8b_main.p8v_success -label_asm_94_afterif - ; source: test_word_lte.p8:793 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_lte.p8:795 goto skip32a - bra p8l_skip32a - ; source: test_word_lte.p8:796 lbl32a: fail_word(37) -p8l_lbl32a - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:797 skip32a: -p8l_skip32a - ; source: test_word_lte.p8:799 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:800 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:802 goto skip32b - bra p8l_skip32b - ; source: test_word_lte.p8:803 lbl32b: fail_word(38) -p8l_lbl32b - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:804 skip32b: -p8l_skip32b - ; source: test_word_lte.p8:806 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_96_afterif - ; source: test_word_lte.p8:807 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_96_afterif - ; source: test_word_lte.p8:810 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_98_else - ; source: test_word_lte.p8:811 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_lte.p8:813 success++ - inc p8b_main.p8v_success -label_asm_97_afterif - ; source: test_word_lte.p8:816 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_lte.p8:818 goto skip33a - bra p8l_skip33a - ; source: test_word_lte.p8:819 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:820 skip33a: -p8l_skip33a - ; source: test_word_lte.p8:822 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:823 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:825 goto skip33b - bra p8l_skip33b - ; source: test_word_lte.p8:826 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:827 skip33b: -p8l_skip33b - ; source: test_word_lte.p8:829 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_lte.p8:830 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_word_lte.p8:833 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_lte.p8:834 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_lte.p8:836 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_word_lte.p8:839 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_lte.p8:841 goto skip34a - bra p8l_skip34a - ; source: test_word_lte.p8:842 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:843 skip34a: -p8l_skip34a - ; source: test_word_lte.p8:845 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:846 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:848 goto skip34b - bra p8l_skip34b - ; source: test_word_lte.p8:849 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:850 skip34b: -p8l_skip34b - ; source: test_word_lte.p8:852 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_lte.p8:853 success++ - inc p8b_main.p8v_success -label_asm_102_afterif - ; source: test_word_lte.p8:856 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_lte.p8:857 success++ - inc p8b_main.p8v_success - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_lte.p8:859 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_word_lte.p8:862 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_lte.p8:864 goto skip35a - bra p8l_skip35a - ; source: test_word_lte.p8:865 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:866 skip35a: -p8l_skip35a - ; source: test_word_lte.p8:868 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:869 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:871 goto skip35b - bra p8l_skip35b - ; source: test_word_lte.p8:872 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:873 skip35b: -p8l_skip35b - ; source: test_word_lte.p8:875 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_lte.p8:876 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_word_lte.p8:879 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_lte.p8:880 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_lte.p8:882 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_word_lte.p8:884 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:886 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_lte.p8:888 goto skip36a - bra p8l_skip36a - ; source: test_word_lte.p8:889 lbl36a: fail_word(41) -p8l_lbl36a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:890 skip36a: -p8l_skip36a - ; source: test_word_lte.p8:892 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:893 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:895 goto skip36b - bra p8l_skip36b - ; source: test_word_lte.p8:896 lbl36b: fail_word(42) -p8l_lbl36b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:897 skip36b: -p8l_skip36b - ; source: test_word_lte.p8:899 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_lte.p8:900 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_108_afterif - ; source: test_word_lte.p8:903 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_lte.p8:904 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_lte.p8:906 success++ - inc p8b_main.p8v_success -label_asm_109_afterif - ; source: test_word_lte.p8:909 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl37a - ; source: test_word_lte.p8:911 goto skip37a - bra p8l_skip37a - ; source: test_word_lte.p8:912 lbl37a: fail_word(45) -p8l_lbl37a - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:913 skip37a: -p8l_skip37a - ; source: test_word_lte.p8:915 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:916 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:918 goto skip37b - bra p8l_skip37b - ; source: test_word_lte.p8:919 lbl37b: fail_word(46) -p8l_lbl37b - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:920 skip37b: -p8l_skip37b - ; source: test_word_lte.p8:922 if x<=-1 - lda p8v_x+1 - bpl label_asm_111_afterif - ; source: test_word_lte.p8:923 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_111_afterif - ; source: test_word_lte.p8:926 if x<=-1 - lda p8v_x+1 - bpl label_asm_113_else - ; source: test_word_lte.p8:927 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_lte.p8:929 success++ - inc p8b_main.p8v_success -label_asm_112_afterif - ; source: test_word_lte.p8:932 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl38a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl38a -+ - ; source: test_word_lte.p8:934 goto skip38a - bra p8l_skip38a - ; source: test_word_lte.p8:935 lbl38a: fail_word(49) -p8l_lbl38a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:936 skip38a: -p8l_skip38a - ; source: test_word_lte.p8:938 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:939 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:941 goto skip38b - bra p8l_skip38b - ; source: test_word_lte.p8:942 lbl38b: fail_word(50) -p8l_lbl38b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:943 skip38b: -p8l_skip38b - ; source: test_word_lte.p8:945 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_114_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_114_afterif -+ - ; source: test_word_lte.p8:946 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_114_afterif - ; source: test_word_lte.p8:949 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_116_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_116_else -+ - ; source: test_word_lte.p8:950 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_lte.p8:952 success++ - inc p8b_main.p8v_success -label_asm_115_afterif - ; source: test_word_lte.p8:955 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_lte.p8:957 goto skip39a - bra p8l_skip39a - ; source: test_word_lte.p8:958 lbl39a: fail_word(53) -p8l_lbl39a - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:959 skip39a: -p8l_skip39a - ; source: test_word_lte.p8:961 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:962 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:964 goto skip39b - bra p8l_skip39b - ; source: test_word_lte.p8:965 lbl39b: fail_word(54) -p8l_lbl39b - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:966 skip39b: -p8l_skip39b - ; source: test_word_lte.p8:968 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_117_afterif - ; source: test_word_lte.p8:969 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_117_afterif - ; source: test_word_lte.p8:972 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_119_else - ; source: test_word_lte.p8:973 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_lte.p8:975 success++ - inc p8b_main.p8v_success -label_asm_118_afterif - ; source: test_word_lte.p8:978 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_lte.p8:980 goto skip40a - bra p8l_skip40a - ; source: test_word_lte.p8:981 lbl40a: fail_word(57) -p8l_lbl40a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:982 skip40a: -p8l_skip40a - ; source: test_word_lte.p8:984 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:985 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:987 goto skip40b - bra p8l_skip40b - ; source: test_word_lte.p8:988 lbl40b: fail_word(58) -p8l_lbl40b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:989 skip40b: -p8l_skip40b - ; source: test_word_lte.p8:991 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_lte.p8:992 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_120_afterif - ; source: test_word_lte.p8:995 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_lte.p8:996 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_lte.p8:998 success++ - inc p8b_main.p8v_success -label_asm_121_afterif - ; source: test_word_lte.p8:1001 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_lte.p8:1003 goto skip41a - bra p8l_skip41a - ; source: test_word_lte.p8:1004 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1005 skip41a: -p8l_skip41a - ; source: test_word_lte.p8:1007 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1008 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1010 goto skip41b - bra p8l_skip41b - ; source: test_word_lte.p8:1011 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1012 skip41b: -p8l_skip41b - ; source: test_word_lte.p8:1014 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_lte.p8:1015 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_word_lte.p8:1018 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_lte.p8:1019 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_lte.p8:1021 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_word_lte.p8:1024 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_lte.p8:1026 goto skip42a - bra p8l_skip42a - ; source: test_word_lte.p8:1027 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1028 skip42a: -p8l_skip42a - ; source: test_word_lte.p8:1030 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1031 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1033 goto skip42b - bra p8l_skip42b - ; source: test_word_lte.p8:1034 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1035 skip42b: -p8l_skip42b - ; source: test_word_lte.p8:1037 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_lte.p8:1038 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_word_lte.p8:1041 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_lte.p8:1042 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_lte.p8:1044 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_word_lte.p8:1046 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:1048 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_lte.p8:1050 goto skip43a - bra p8l_skip43a - ; source: test_word_lte.p8:1051 lbl43a: fail_word(61) -p8l_lbl43a - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1052 skip43a: -p8l_skip43a - ; source: test_word_lte.p8:1054 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1055 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1057 goto skip43b - bra p8l_skip43b - ; source: test_word_lte.p8:1058 lbl43b: fail_word(62) -p8l_lbl43b - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1059 skip43b: -p8l_skip43b - ; source: test_word_lte.p8:1061 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_lte.p8:1062 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_129_afterif - ; source: test_word_lte.p8:1065 if x<=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_lte.p8:1066 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_lte.p8:1068 success++ - inc p8b_main.p8v_success -label_asm_130_afterif - ; source: test_word_lte.p8:1071 if x<=-1 - lda p8v_x+1 - bmi p8l_lbl44a - ; source: test_word_lte.p8:1073 goto skip44a - bra p8l_skip44a - ; source: test_word_lte.p8:1074 lbl44a: fail_word(65) -p8l_lbl44a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1075 skip44a: -p8l_skip44a - ; source: test_word_lte.p8:1077 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1078 if x<=-1 - lda p8v_x+1 - bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1080 goto skip44b - bra p8l_skip44b - ; source: test_word_lte.p8:1081 lbl44b: fail_word(66) -p8l_lbl44b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1082 skip44b: -p8l_skip44b - ; source: test_word_lte.p8:1084 if x<=-1 - lda p8v_x+1 - bpl label_asm_132_afterif - ; source: test_word_lte.p8:1085 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_132_afterif - ; source: test_word_lte.p8:1088 if x<=-1 - lda p8v_x+1 - bpl label_asm_134_else - ; source: test_word_lte.p8:1089 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_lte.p8:1091 success++ - inc p8b_main.p8v_success -label_asm_133_afterif - ; source: test_word_lte.p8:1094 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi p8l_lbl45a - bne + - lda p8b_main.p8s_test_cmp_number.p8v_x - beq p8l_lbl45a -+ - ; source: test_word_lte.p8:1096 goto skip45a - bra p8l_skip45a - ; source: test_word_lte.p8:1097 lbl45a: fail_word(69) -p8l_lbl45a - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1098 skip45a: -p8l_skip45a - ; source: test_word_lte.p8:1100 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1101 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne ++ - lda p8b_main.p8s_test_cmp_number.p8v_x - bne ++ -+ jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1103 goto skip45b - bra p8l_skip45b - ; source: test_word_lte.p8:1104 lbl45b: fail_word(70) -p8l_lbl45b - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1105 skip45b: -p8l_skip45b - ; source: test_word_lte.p8:1107 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_135_afterif - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_135_afterif -+ - ; source: test_word_lte.p8:1108 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_135_afterif - ; source: test_word_lte.p8:1111 if x<=0 - lda p8b_main.p8s_test_cmp_number.p8v_x+1 - bmi + - bne label_asm_137_else - lda p8b_main.p8s_test_cmp_number.p8v_x - bne label_asm_137_else -+ - ; source: test_word_lte.p8:1112 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_lte.p8:1114 success++ - inc p8b_main.p8v_success -label_asm_136_afterif - ; source: test_word_lte.p8:1117 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_lte.p8:1119 goto skip46a - bra p8l_skip46a - ; source: test_word_lte.p8:1120 lbl46a: fail_word(73) -p8l_lbl46a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1121 skip46a: -p8l_skip46a - ; source: test_word_lte.p8:1123 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1124 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1126 goto skip46b - bra p8l_skip46b - ; source: test_word_lte.p8:1127 lbl46b: fail_word(74) -p8l_lbl46b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1128 skip46b: -p8l_skip46b - ; source: test_word_lte.p8:1130 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_138_afterif - ; source: test_word_lte.p8:1131 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_138_afterif - ; source: test_word_lte.p8:1134 if x<=1 - ldy #>1 - lda #<1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_140_else - ; source: test_word_lte.p8:1135 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_lte.p8:1137 success++ - inc p8b_main.p8v_success -label_asm_139_afterif - ; source: test_word_lte.p8:1140 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_lte.p8:1142 goto skip47a - bra p8l_skip47a - ; source: test_word_lte.p8:1143 lbl47a: fail_word(77) -p8l_lbl47a - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1144 skip47a: -p8l_skip47a - ; source: test_word_lte.p8:1146 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1147 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1149 goto skip47b - bra p8l_skip47b - ; source: test_word_lte.p8:1150 lbl47b: fail_word(78) -p8l_lbl47b - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1151 skip47b: -p8l_skip47b - ; source: test_word_lte.p8:1153 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_lte.p8:1154 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_141_afterif - ; source: test_word_lte.p8:1157 if x<=170 - ldy #>$aa - lda #<$aa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_lte.p8:1158 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_lte.p8:1160 success++ - inc p8b_main.p8v_success -label_asm_142_afterif - ; source: test_word_lte.p8:1163 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_lte.p8:1165 goto skip48a - bra p8l_skip48a - ; source: test_word_lte.p8:1166 lbl48a: fail_word(81) -p8l_lbl48a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1167 skip48a: -p8l_skip48a - ; source: test_word_lte.p8:1169 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1170 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1172 goto skip48b - bra p8l_skip48b - ; source: test_word_lte.p8:1173 lbl48b: fail_word(82) -p8l_lbl48b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1174 skip48b: -p8l_skip48b - ; source: test_word_lte.p8:1176 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_lte.p8:1177 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_144_afterif - ; source: test_word_lte.p8:1180 if x<=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_lte.p8:1181 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_lte.p8:1183 success++ - inc p8b_main.p8v_success -label_asm_145_afterif - ; source: test_word_lte.p8:1186 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_lte.p8:1188 goto skip49a - bra p8l_skip49a - ; source: test_word_lte.p8:1189 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1190 skip49a: -p8l_skip49a - ; source: test_word_lte.p8:1192 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1193 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1195 goto skip49b - bra p8l_skip49b - ; source: test_word_lte.p8:1196 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1197 skip49b: -p8l_skip49b - ; source: test_word_lte.p8:1199 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_lte.p8:1200 success++ - inc p8b_main.p8v_success -label_asm_147_afterif - ; source: test_word_lte.p8:1203 if x<=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_lte.p8:1204 success++ - inc p8b_main.p8v_success - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_lte.p8:1206 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_word_lte.p8:1208 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_lte.p8:71 sub test_cmp_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_lte.p8:1210 sub test_cmp_var() { - -p8s_test_cmp_var .proc -; statements - ; source: test_word_lte.p8:1211 word @shared x, value - stz p8v_x - stz p8v_x+1 - lda p8v_x - ldy p8v_x+1 - sta p8v_value - sty p8v_value+1 - ; source: test_word_lte.p8:1212 success = 0 - stz p8b_main.p8v_success - ; source: test_word_lte.p8:1213 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:1214 value=-21829 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1216 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_lte.p8:1218 goto skip1a - bra p8l_skip1a - ; source: test_word_lte.p8:1219 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1220 skip1a: -p8l_skip1a - ; source: test_word_lte.p8:1222 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1223 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1225 goto skip1b - bra p8l_skip1b - ; source: test_word_lte.p8:1226 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1227 skip1b: -p8l_skip1b - ; source: test_word_lte.p8:1229 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_150_afterif - ; source: test_word_lte.p8:1230 success++ - inc p8b_main.p8v_success -label_asm_150_afterif - ; source: test_word_lte.p8:1233 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_152_else - ; source: test_word_lte.p8:1234 success++ - inc p8b_main.p8v_success - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_lte.p8:1236 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_word_lte.p8:1238 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1240 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_lte.p8:1242 goto skip2a - bra p8l_skip2a - ; source: test_word_lte.p8:1243 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1244 skip2a: -p8l_skip2a - ; source: test_word_lte.p8:1246 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1247 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1249 goto skip2b - bra p8l_skip2b - ; source: test_word_lte.p8:1250 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1251 skip2b: -p8l_skip2b - ; source: test_word_lte.p8:1253 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_153_afterif - ; source: test_word_lte.p8:1254 success++ - inc p8b_main.p8v_success -label_asm_153_afterif - ; source: test_word_lte.p8:1257 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_155_else - ; source: test_word_lte.p8:1258 success++ - inc p8b_main.p8v_success - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_lte.p8:1260 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_word_lte.p8:1262 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:1264 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_lte.p8:1266 goto skip3a - bra p8l_skip3a - ; source: test_word_lte.p8:1267 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1268 skip3a: -p8l_skip3a - ; source: test_word_lte.p8:1270 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1271 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1273 goto skip3b - bra p8l_skip3b - ; source: test_word_lte.p8:1274 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1275 skip3b: -p8l_skip3b - ; source: test_word_lte.p8:1277 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_156_afterif - ; source: test_word_lte.p8:1278 success++ - inc p8b_main.p8v_success -label_asm_156_afterif - ; source: test_word_lte.p8:1281 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_158_else - ; source: test_word_lte.p8:1282 success++ - inc p8b_main.p8v_success - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_lte.p8:1284 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_word_lte.p8:1286 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1288 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_lte.p8:1290 goto skip4a - bra p8l_skip4a - ; source: test_word_lte.p8:1291 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1292 skip4a: -p8l_skip4a - ; source: test_word_lte.p8:1294 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1295 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1297 goto skip4b - bra p8l_skip4b - ; source: test_word_lte.p8:1298 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1299 skip4b: -p8l_skip4b - ; source: test_word_lte.p8:1301 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_159_afterif - ; source: test_word_lte.p8:1302 success++ - inc p8b_main.p8v_success -label_asm_159_afterif - ; source: test_word_lte.p8:1305 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_161_else - ; source: test_word_lte.p8:1306 success++ - inc p8b_main.p8v_success - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_lte.p8:1308 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_word_lte.p8:1310 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1312 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_lte.p8:1314 goto skip5a - bra p8l_skip5a - ; source: test_word_lte.p8:1315 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1316 skip5a: -p8l_skip5a - ; source: test_word_lte.p8:1318 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1319 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1321 goto skip5b - bra p8l_skip5b - ; source: test_word_lte.p8:1322 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1323 skip5b: -p8l_skip5b - ; source: test_word_lte.p8:1325 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_162_afterif - ; source: test_word_lte.p8:1326 success++ - inc p8b_main.p8v_success -label_asm_162_afterif - ; source: test_word_lte.p8:1329 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_164_else - ; source: test_word_lte.p8:1330 success++ - inc p8b_main.p8v_success - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_lte.p8:1332 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_word_lte.p8:1334 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1336 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_lte.p8:1338 goto skip6a - bra p8l_skip6a - ; source: test_word_lte.p8:1339 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1340 skip6a: -p8l_skip6a - ; source: test_word_lte.p8:1342 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1343 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1345 goto skip6b - bra p8l_skip6b - ; source: test_word_lte.p8:1346 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1347 skip6b: -p8l_skip6b - ; source: test_word_lte.p8:1349 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_165_afterif - ; source: test_word_lte.p8:1350 success++ - inc p8b_main.p8v_success -label_asm_165_afterif - ; source: test_word_lte.p8:1353 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_167_else - ; source: test_word_lte.p8:1354 success++ - inc p8b_main.p8v_success - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_lte.p8:1356 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_word_lte.p8:1358 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1360 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_lte.p8:1362 goto skip7a - bra p8l_skip7a - ; source: test_word_lte.p8:1363 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1364 skip7a: -p8l_skip7a - ; source: test_word_lte.p8:1366 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1367 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1369 goto skip7b - bra p8l_skip7b - ; source: test_word_lte.p8:1370 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1371 skip7b: -p8l_skip7b - ; source: test_word_lte.p8:1373 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_168_afterif - ; source: test_word_lte.p8:1374 success++ - inc p8b_main.p8v_success -label_asm_168_afterif - ; source: test_word_lte.p8:1377 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_170_else - ; source: test_word_lte.p8:1378 success++ - inc p8b_main.p8v_success - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_lte.p8:1380 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_word_lte.p8:1382 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:1383 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1385 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_lte.p8:1387 goto skip8a - bra p8l_skip8a - ; source: test_word_lte.p8:1388 lbl8a: fail_word(85) -p8l_lbl8a - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1389 skip8a: -p8l_skip8a - ; source: test_word_lte.p8:1391 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1392 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1394 goto skip8b - bra p8l_skip8b - ; source: test_word_lte.p8:1395 lbl8b: fail_word(86) -p8l_lbl8b - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1396 skip8b: -p8l_skip8b - ; source: test_word_lte.p8:1398 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_171_afterif - ; source: test_word_lte.p8:1399 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_171_afterif - ; source: test_word_lte.p8:1402 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_173_else - ; source: test_word_lte.p8:1403 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_lte.p8:1405 success++ - inc p8b_main.p8v_success -label_asm_172_afterif - ; source: test_word_lte.p8:1407 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1409 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_lte.p8:1411 goto skip9a - bra p8l_skip9a - ; source: test_word_lte.p8:1412 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1413 skip9a: -p8l_skip9a - ; source: test_word_lte.p8:1415 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1416 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1418 goto skip9b - bra p8l_skip9b - ; source: test_word_lte.p8:1419 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1420 skip9b: -p8l_skip9b - ; source: test_word_lte.p8:1422 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_174_afterif - ; source: test_word_lte.p8:1423 success++ - inc p8b_main.p8v_success -label_asm_174_afterif - ; source: test_word_lte.p8:1426 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_176_else - ; source: test_word_lte.p8:1427 success++ - inc p8b_main.p8v_success - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_lte.p8:1429 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_word_lte.p8:1431 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:1433 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_lte.p8:1435 goto skip10a - bra p8l_skip10a - ; source: test_word_lte.p8:1436 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1437 skip10a: -p8l_skip10a - ; source: test_word_lte.p8:1439 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1440 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1442 goto skip10b - bra p8l_skip10b - ; source: test_word_lte.p8:1443 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1444 skip10b: -p8l_skip10b - ; source: test_word_lte.p8:1446 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_177_afterif - ; source: test_word_lte.p8:1447 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_word_lte.p8:1450 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_179_else - ; source: test_word_lte.p8:1451 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_lte.p8:1453 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_word_lte.p8:1455 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1457 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_lte.p8:1459 goto skip11a - bra p8l_skip11a - ; source: test_word_lte.p8:1460 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1461 skip11a: -p8l_skip11a - ; source: test_word_lte.p8:1463 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1464 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1466 goto skip11b - bra p8l_skip11b - ; source: test_word_lte.p8:1467 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1468 skip11b: -p8l_skip11b - ; source: test_word_lte.p8:1470 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_180_afterif - ; source: test_word_lte.p8:1471 success++ - inc p8b_main.p8v_success -label_asm_180_afterif - ; source: test_word_lte.p8:1474 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_182_else - ; source: test_word_lte.p8:1475 success++ - inc p8b_main.p8v_success - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_lte.p8:1477 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_word_lte.p8:1479 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1481 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_lte.p8:1483 goto skip12a - bra p8l_skip12a - ; source: test_word_lte.p8:1484 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1485 skip12a: -p8l_skip12a - ; source: test_word_lte.p8:1487 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1488 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1490 goto skip12b - bra p8l_skip12b - ; source: test_word_lte.p8:1491 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1492 skip12b: -p8l_skip12b - ; source: test_word_lte.p8:1494 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_183_afterif - ; source: test_word_lte.p8:1495 success++ - inc p8b_main.p8v_success -label_asm_183_afterif - ; source: test_word_lte.p8:1498 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_185_else - ; source: test_word_lte.p8:1499 success++ - inc p8b_main.p8v_success - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_lte.p8:1501 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_word_lte.p8:1503 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1505 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_lte.p8:1507 goto skip13a - bra p8l_skip13a - ; source: test_word_lte.p8:1508 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1509 skip13a: -p8l_skip13a - ; source: test_word_lte.p8:1511 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1512 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1514 goto skip13b - bra p8l_skip13b - ; source: test_word_lte.p8:1515 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1516 skip13b: -p8l_skip13b - ; source: test_word_lte.p8:1518 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_186_afterif - ; source: test_word_lte.p8:1519 success++ - inc p8b_main.p8v_success -label_asm_186_afterif - ; source: test_word_lte.p8:1522 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_188_else - ; source: test_word_lte.p8:1523 success++ - inc p8b_main.p8v_success - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_lte.p8:1525 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_word_lte.p8:1527 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1529 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_lte.p8:1531 goto skip14a - bra p8l_skip14a - ; source: test_word_lte.p8:1532 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1533 skip14a: -p8l_skip14a - ; source: test_word_lte.p8:1535 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1536 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1538 goto skip14b - bra p8l_skip14b - ; source: test_word_lte.p8:1539 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1540 skip14b: -p8l_skip14b - ; source: test_word_lte.p8:1542 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_189_afterif - ; source: test_word_lte.p8:1543 success++ - inc p8b_main.p8v_success -label_asm_189_afterif - ; source: test_word_lte.p8:1546 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_191_else - ; source: test_word_lte.p8:1547 success++ - inc p8b_main.p8v_success - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_lte.p8:1549 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_word_lte.p8:1551 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_lte.p8:1552 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1554 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_lte.p8:1556 goto skip15a - bra p8l_skip15a - ; source: test_word_lte.p8:1557 lbl15a: fail_word(89) -p8l_lbl15a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1558 skip15a: -p8l_skip15a - ; source: test_word_lte.p8:1560 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1561 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1563 goto skip15b - bra p8l_skip15b - ; source: test_word_lte.p8:1564 lbl15b: fail_word(90) -p8l_lbl15b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1565 skip15b: -p8l_skip15b - ; source: test_word_lte.p8:1567 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_192_afterif - ; source: test_word_lte.p8:1568 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_192_afterif - ; source: test_word_lte.p8:1571 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_194_else - ; source: test_word_lte.p8:1572 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_lte.p8:1574 success++ - inc p8b_main.p8v_success -label_asm_193_afterif - ; source: test_word_lte.p8:1576 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1578 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_lte.p8:1580 goto skip16a - bra p8l_skip16a - ; source: test_word_lte.p8:1581 lbl16a: fail_word(93) -p8l_lbl16a - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1582 skip16a: -p8l_skip16a - ; source: test_word_lte.p8:1584 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1585 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1587 goto skip16b - bra p8l_skip16b - ; source: test_word_lte.p8:1588 lbl16b: fail_word(94) -p8l_lbl16b - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1589 skip16b: -p8l_skip16b - ; source: test_word_lte.p8:1591 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_195_afterif - ; source: test_word_lte.p8:1592 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_195_afterif - ; source: test_word_lte.p8:1595 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_197_else - ; source: test_word_lte.p8:1596 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_lte.p8:1598 success++ - inc p8b_main.p8v_success -label_asm_196_afterif - ; source: test_word_lte.p8:1600 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:1602 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_lte.p8:1604 goto skip17a - bra p8l_skip17a - ; source: test_word_lte.p8:1605 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1606 skip17a: -p8l_skip17a - ; source: test_word_lte.p8:1608 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1609 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1611 goto skip17b - bra p8l_skip17b - ; source: test_word_lte.p8:1612 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1613 skip17b: -p8l_skip17b - ; source: test_word_lte.p8:1615 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_198_afterif - ; source: test_word_lte.p8:1616 success++ - inc p8b_main.p8v_success -label_asm_198_afterif - ; source: test_word_lte.p8:1619 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_200_else - ; source: test_word_lte.p8:1620 success++ - inc p8b_main.p8v_success - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_lte.p8:1622 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_word_lte.p8:1624 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1626 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_lte.p8:1628 goto skip18a - bra p8l_skip18a - ; source: test_word_lte.p8:1629 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1630 skip18a: -p8l_skip18a - ; source: test_word_lte.p8:1632 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1633 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1635 goto skip18b - bra p8l_skip18b - ; source: test_word_lte.p8:1636 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1637 skip18b: -p8l_skip18b - ; source: test_word_lte.p8:1639 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_201_afterif - ; source: test_word_lte.p8:1640 success++ - inc p8b_main.p8v_success -label_asm_201_afterif - ; source: test_word_lte.p8:1643 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_203_else - ; source: test_word_lte.p8:1644 success++ - inc p8b_main.p8v_success - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_lte.p8:1646 cx16.r0L++ - inc cx16.r0L -label_asm_202_afterif - ; source: test_word_lte.p8:1648 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1650 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_lte.p8:1652 goto skip19a - bra p8l_skip19a - ; source: test_word_lte.p8:1653 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1654 skip19a: -p8l_skip19a - ; source: test_word_lte.p8:1656 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1657 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1659 goto skip19b - bra p8l_skip19b - ; source: test_word_lte.p8:1660 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1661 skip19b: -p8l_skip19b - ; source: test_word_lte.p8:1663 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_204_afterif - ; source: test_word_lte.p8:1664 success++ - inc p8b_main.p8v_success -label_asm_204_afterif - ; source: test_word_lte.p8:1667 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_206_else - ; source: test_word_lte.p8:1668 success++ - inc p8b_main.p8v_success - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_lte.p8:1670 cx16.r0L++ - inc cx16.r0L -label_asm_205_afterif - ; source: test_word_lte.p8:1672 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1674 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_lte.p8:1676 goto skip20a - bra p8l_skip20a - ; source: test_word_lte.p8:1677 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1678 skip20a: -p8l_skip20a - ; source: test_word_lte.p8:1680 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1681 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1683 goto skip20b - bra p8l_skip20b - ; source: test_word_lte.p8:1684 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1685 skip20b: -p8l_skip20b - ; source: test_word_lte.p8:1687 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_207_afterif - ; source: test_word_lte.p8:1688 success++ - inc p8b_main.p8v_success -label_asm_207_afterif - ; source: test_word_lte.p8:1691 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_209_else - ; source: test_word_lte.p8:1692 success++ - inc p8b_main.p8v_success - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_lte.p8:1694 cx16.r0L++ - inc cx16.r0L -label_asm_208_afterif - ; source: test_word_lte.p8:1696 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1698 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_lte.p8:1700 goto skip21a - bra p8l_skip21a - ; source: test_word_lte.p8:1701 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1702 skip21a: -p8l_skip21a - ; source: test_word_lte.p8:1704 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1705 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1707 goto skip21b - bra p8l_skip21b - ; source: test_word_lte.p8:1708 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1709 skip21b: -p8l_skip21b - ; source: test_word_lte.p8:1711 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_210_afterif - ; source: test_word_lte.p8:1712 success++ - inc p8b_main.p8v_success -label_asm_210_afterif - ; source: test_word_lte.p8:1715 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_212_else - ; source: test_word_lte.p8:1716 success++ - inc p8b_main.p8v_success - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_lte.p8:1718 cx16.r0L++ - inc cx16.r0L -label_asm_211_afterif - ; source: test_word_lte.p8:1720 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:1721 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1723 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_lte.p8:1725 goto skip22a - bra p8l_skip22a - ; source: test_word_lte.p8:1726 lbl22a: fail_word(97) -p8l_lbl22a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1727 skip22a: -p8l_skip22a - ; source: test_word_lte.p8:1729 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1730 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1732 goto skip22b - bra p8l_skip22b - ; source: test_word_lte.p8:1733 lbl22b: fail_word(98) -p8l_lbl22b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1734 skip22b: -p8l_skip22b - ; source: test_word_lte.p8:1736 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_213_afterif - ; source: test_word_lte.p8:1737 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_213_afterif - ; source: test_word_lte.p8:1740 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_215_else - ; source: test_word_lte.p8:1741 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_lte.p8:1743 success++ - inc p8b_main.p8v_success -label_asm_214_afterif - ; source: test_word_lte.p8:1745 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1747 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_lte.p8:1749 goto skip23a - bra p8l_skip23a - ; source: test_word_lte.p8:1750 lbl23a: fail_word(101) -p8l_lbl23a - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1751 skip23a: -p8l_skip23a - ; source: test_word_lte.p8:1753 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1754 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1756 goto skip23b - bra p8l_skip23b - ; source: test_word_lte.p8:1757 lbl23b: fail_word(102) -p8l_lbl23b - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1758 skip23b: -p8l_skip23b - ; source: test_word_lte.p8:1760 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_216_afterif - ; source: test_word_lte.p8:1761 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_216_afterif - ; source: test_word_lte.p8:1764 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_218_else - ; source: test_word_lte.p8:1765 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_lte.p8:1767 success++ - inc p8b_main.p8v_success -label_asm_217_afterif - ; source: test_word_lte.p8:1769 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:1771 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_lte.p8:1773 goto skip24a - bra p8l_skip24a - ; source: test_word_lte.p8:1774 lbl24a: fail_word(105) -p8l_lbl24a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1775 skip24a: -p8l_skip24a - ; source: test_word_lte.p8:1777 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1778 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1780 goto skip24b - bra p8l_skip24b - ; source: test_word_lte.p8:1781 lbl24b: fail_word(106) -p8l_lbl24b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1782 skip24b: -p8l_skip24b - ; source: test_word_lte.p8:1784 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_219_afterif - ; source: test_word_lte.p8:1785 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_219_afterif - ; source: test_word_lte.p8:1788 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_221_else - ; source: test_word_lte.p8:1789 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_lte.p8:1791 success++ - inc p8b_main.p8v_success -label_asm_220_afterif - ; source: test_word_lte.p8:1793 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1795 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_lte.p8:1797 goto skip25a - bra p8l_skip25a - ; source: test_word_lte.p8:1798 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1799 skip25a: -p8l_skip25a - ; source: test_word_lte.p8:1801 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1802 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1804 goto skip25b - bra p8l_skip25b - ; source: test_word_lte.p8:1805 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1806 skip25b: -p8l_skip25b - ; source: test_word_lte.p8:1808 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_222_afterif - ; source: test_word_lte.p8:1809 success++ - inc p8b_main.p8v_success -label_asm_222_afterif - ; source: test_word_lte.p8:1812 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_224_else - ; source: test_word_lte.p8:1813 success++ - inc p8b_main.p8v_success - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_lte.p8:1815 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_word_lte.p8:1817 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1819 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_lte.p8:1821 goto skip26a - bra p8l_skip26a - ; source: test_word_lte.p8:1822 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1823 skip26a: -p8l_skip26a - ; source: test_word_lte.p8:1825 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1826 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1828 goto skip26b - bra p8l_skip26b - ; source: test_word_lte.p8:1829 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1830 skip26b: -p8l_skip26b - ; source: test_word_lte.p8:1832 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_225_afterif - ; source: test_word_lte.p8:1833 success++ - inc p8b_main.p8v_success -label_asm_225_afterif - ; source: test_word_lte.p8:1836 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_227_else - ; source: test_word_lte.p8:1837 success++ - inc p8b_main.p8v_success - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_lte.p8:1839 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_word_lte.p8:1841 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1843 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_lte.p8:1845 goto skip27a - bra p8l_skip27a - ; source: test_word_lte.p8:1846 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1847 skip27a: -p8l_skip27a - ; source: test_word_lte.p8:1849 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1850 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1852 goto skip27b - bra p8l_skip27b - ; source: test_word_lte.p8:1853 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1854 skip27b: -p8l_skip27b - ; source: test_word_lte.p8:1856 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_228_afterif - ; source: test_word_lte.p8:1857 success++ - inc p8b_main.p8v_success -label_asm_228_afterif - ; source: test_word_lte.p8:1860 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_230_else - ; source: test_word_lte.p8:1861 success++ - inc p8b_main.p8v_success - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_lte.p8:1863 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_word_lte.p8:1865 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1867 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_lte.p8:1869 goto skip28a - bra p8l_skip28a - ; source: test_word_lte.p8:1870 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1871 skip28a: -p8l_skip28a - ; source: test_word_lte.p8:1873 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1874 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1876 goto skip28b - bra p8l_skip28b - ; source: test_word_lte.p8:1877 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1878 skip28b: -p8l_skip28b - ; source: test_word_lte.p8:1880 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_231_afterif - ; source: test_word_lte.p8:1881 success++ - inc p8b_main.p8v_success -label_asm_231_afterif - ; source: test_word_lte.p8:1884 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_233_else - ; source: test_word_lte.p8:1885 success++ - inc p8b_main.p8v_success - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_lte.p8:1887 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_word_lte.p8:1889 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:1890 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1892 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_lte.p8:1894 goto skip29a - bra p8l_skip29a - ; source: test_word_lte.p8:1895 lbl29a: fail_word(109) -p8l_lbl29a - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1896 skip29a: -p8l_skip29a - ; source: test_word_lte.p8:1898 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1899 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1901 goto skip29b - bra p8l_skip29b - ; source: test_word_lte.p8:1902 lbl29b: fail_word(110) -p8l_lbl29b - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1903 skip29b: -p8l_skip29b - ; source: test_word_lte.p8:1905 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_234_afterif - ; source: test_word_lte.p8:1906 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_234_afterif - ; source: test_word_lte.p8:1909 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_236_else - ; source: test_word_lte.p8:1910 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_lte.p8:1912 success++ - inc p8b_main.p8v_success -label_asm_235_afterif - ; source: test_word_lte.p8:1914 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1916 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_lte.p8:1918 goto skip30a - bra p8l_skip30a - ; source: test_word_lte.p8:1919 lbl30a: fail_word(113) -p8l_lbl30a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1920 skip30a: -p8l_skip30a - ; source: test_word_lte.p8:1922 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1923 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1925 goto skip30b - bra p8l_skip30b - ; source: test_word_lte.p8:1926 lbl30b: fail_word(114) -p8l_lbl30b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1927 skip30b: -p8l_skip30b - ; source: test_word_lte.p8:1929 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_237_afterif - ; source: test_word_lte.p8:1930 fail_word(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_237_afterif - ; source: test_word_lte.p8:1933 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_239_else - ; source: test_word_lte.p8:1934 fail_word(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_lte.p8:1936 success++ - inc p8b_main.p8v_success -label_asm_238_afterif - ; source: test_word_lte.p8:1938 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:1940 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_lte.p8:1942 goto skip31a - bra p8l_skip31a - ; source: test_word_lte.p8:1943 lbl31a: fail_word(117) -p8l_lbl31a - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1944 skip31a: -p8l_skip31a - ; source: test_word_lte.p8:1946 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1947 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1949 goto skip31b - bra p8l_skip31b - ; source: test_word_lte.p8:1950 lbl31b: fail_word(118) -p8l_lbl31b - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1951 skip31b: -p8l_skip31b - ; source: test_word_lte.p8:1953 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_240_afterif - ; source: test_word_lte.p8:1954 fail_word(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_240_afterif - ; source: test_word_lte.p8:1957 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_242_else - ; source: test_word_lte.p8:1958 fail_word(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_lte.p8:1960 success++ - inc p8b_main.p8v_success -label_asm_241_afterif - ; source: test_word_lte.p8:1962 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1964 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_lte.p8:1966 goto skip32a - bra p8l_skip32a - ; source: test_word_lte.p8:1967 lbl32a: fail_word(121) -p8l_lbl32a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1968 skip32a: -p8l_skip32a - ; source: test_word_lte.p8:1970 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1971 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1973 goto skip32b - bra p8l_skip32b - ; source: test_word_lte.p8:1974 lbl32b: fail_word(122) -p8l_lbl32b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:1975 skip32b: -p8l_skip32b - ; source: test_word_lte.p8:1977 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_243_afterif - ; source: test_word_lte.p8:1978 fail_word(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_243_afterif - ; source: test_word_lte.p8:1981 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_245_else - ; source: test_word_lte.p8:1982 fail_word(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_lte.p8:1984 success++ - inc p8b_main.p8v_success -label_asm_244_afterif - ; source: test_word_lte.p8:1986 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:1988 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_lte.p8:1990 goto skip33a - bra p8l_skip33a - ; source: test_word_lte.p8:1991 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1992 skip33a: -p8l_skip33a - ; source: test_word_lte.p8:1994 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:1995 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:1997 goto skip33b - bra p8l_skip33b - ; source: test_word_lte.p8:1998 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:1999 skip33b: -p8l_skip33b - ; source: test_word_lte.p8:2001 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_246_afterif - ; source: test_word_lte.p8:2002 success++ - inc p8b_main.p8v_success -label_asm_246_afterif - ; source: test_word_lte.p8:2005 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_248_else - ; source: test_word_lte.p8:2006 success++ - inc p8b_main.p8v_success - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_lte.p8:2008 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_word_lte.p8:2010 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2012 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_lte.p8:2014 goto skip34a - bra p8l_skip34a - ; source: test_word_lte.p8:2015 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2016 skip34a: -p8l_skip34a - ; source: test_word_lte.p8:2018 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2019 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2021 goto skip34b - bra p8l_skip34b - ; source: test_word_lte.p8:2022 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2023 skip34b: -p8l_skip34b - ; source: test_word_lte.p8:2025 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_249_afterif - ; source: test_word_lte.p8:2026 success++ - inc p8b_main.p8v_success -label_asm_249_afterif - ; source: test_word_lte.p8:2029 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_251_else - ; source: test_word_lte.p8:2030 success++ - inc p8b_main.p8v_success - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_lte.p8:2032 cx16.r0L++ - inc cx16.r0L -label_asm_250_afterif - ; source: test_word_lte.p8:2034 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2036 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_lte.p8:2038 goto skip35a - bra p8l_skip35a - ; source: test_word_lte.p8:2039 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2040 skip35a: -p8l_skip35a - ; source: test_word_lte.p8:2042 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2043 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2045 goto skip35b - bra p8l_skip35b - ; source: test_word_lte.p8:2046 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2047 skip35b: -p8l_skip35b - ; source: test_word_lte.p8:2049 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_252_afterif - ; source: test_word_lte.p8:2050 success++ - inc p8b_main.p8v_success -label_asm_252_afterif - ; source: test_word_lte.p8:2053 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_254_else - ; source: test_word_lte.p8:2054 success++ - inc p8b_main.p8v_success - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_lte.p8:2056 cx16.r0L++ - inc cx16.r0L -label_asm_253_afterif - ; source: test_word_lte.p8:2058 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:2059 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2061 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_lte.p8:2063 goto skip36a - bra p8l_skip36a - ; source: test_word_lte.p8:2064 lbl36a: fail_word(125) -p8l_lbl36a - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2065 skip36a: -p8l_skip36a - ; source: test_word_lte.p8:2067 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2068 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2070 goto skip36b - bra p8l_skip36b - ; source: test_word_lte.p8:2071 lbl36b: fail_word(126) -p8l_lbl36b - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2072 skip36b: -p8l_skip36b - ; source: test_word_lte.p8:2074 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_255_afterif - ; source: test_word_lte.p8:2075 fail_word(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_255_afterif - ; source: test_word_lte.p8:2078 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_257_else - ; source: test_word_lte.p8:2079 fail_word(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_lte.p8:2081 success++ - inc p8b_main.p8v_success -label_asm_256_afterif - ; source: test_word_lte.p8:2083 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2085 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_lte.p8:2087 goto skip37a - bra p8l_skip37a - ; source: test_word_lte.p8:2088 lbl37a: fail_word(129) -p8l_lbl37a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2089 skip37a: -p8l_skip37a - ; source: test_word_lte.p8:2091 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2092 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2094 goto skip37b - bra p8l_skip37b - ; source: test_word_lte.p8:2095 lbl37b: fail_word(130) -p8l_lbl37b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2096 skip37b: -p8l_skip37b - ; source: test_word_lte.p8:2098 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_258_afterif - ; source: test_word_lte.p8:2099 fail_word(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_258_afterif - ; source: test_word_lte.p8:2102 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_260_else - ; source: test_word_lte.p8:2103 fail_word(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_lte.p8:2105 success++ - inc p8b_main.p8v_success -label_asm_259_afterif - ; source: test_word_lte.p8:2107 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:2109 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_lte.p8:2111 goto skip38a - bra p8l_skip38a - ; source: test_word_lte.p8:2112 lbl38a: fail_word(133) -p8l_lbl38a - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2113 skip38a: -p8l_skip38a - ; source: test_word_lte.p8:2115 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2116 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2118 goto skip38b - bra p8l_skip38b - ; source: test_word_lte.p8:2119 lbl38b: fail_word(134) -p8l_lbl38b - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2120 skip38b: -p8l_skip38b - ; source: test_word_lte.p8:2122 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_261_afterif - ; source: test_word_lte.p8:2123 fail_word(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_261_afterif - ; source: test_word_lte.p8:2126 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_263_else - ; source: test_word_lte.p8:2127 fail_word(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_lte.p8:2129 success++ - inc p8b_main.p8v_success -label_asm_262_afterif - ; source: test_word_lte.p8:2131 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2133 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_lte.p8:2135 goto skip39a - bra p8l_skip39a - ; source: test_word_lte.p8:2136 lbl39a: fail_word(137) -p8l_lbl39a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2137 skip39a: -p8l_skip39a - ; source: test_word_lte.p8:2139 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2140 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2142 goto skip39b - bra p8l_skip39b - ; source: test_word_lte.p8:2143 lbl39b: fail_word(138) -p8l_lbl39b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2144 skip39b: -p8l_skip39b - ; source: test_word_lte.p8:2146 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_264_afterif - ; source: test_word_lte.p8:2147 fail_word(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_264_afterif - ; source: test_word_lte.p8:2150 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_266_else - ; source: test_word_lte.p8:2151 fail_word(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_lte.p8:2153 success++ - inc p8b_main.p8v_success -label_asm_265_afterif - ; source: test_word_lte.p8:2155 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2157 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_lte.p8:2159 goto skip40a - bra p8l_skip40a - ; source: test_word_lte.p8:2160 lbl40a: fail_word(141) -p8l_lbl40a - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2161 skip40a: -p8l_skip40a - ; source: test_word_lte.p8:2163 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2164 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2166 goto skip40b - bra p8l_skip40b - ; source: test_word_lte.p8:2167 lbl40b: fail_word(142) -p8l_lbl40b - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2168 skip40b: -p8l_skip40b - ; source: test_word_lte.p8:2170 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_267_afterif - ; source: test_word_lte.p8:2171 fail_word(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_267_afterif - ; source: test_word_lte.p8:2174 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_269_else - ; source: test_word_lte.p8:2175 fail_word(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_lte.p8:2177 success++ - inc p8b_main.p8v_success -label_asm_268_afterif - ; source: test_word_lte.p8:2179 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2181 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_lte.p8:2183 goto skip41a - bra p8l_skip41a - ; source: test_word_lte.p8:2184 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2185 skip41a: -p8l_skip41a - ; source: test_word_lte.p8:2187 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2188 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2190 goto skip41b - bra p8l_skip41b - ; source: test_word_lte.p8:2191 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2192 skip41b: -p8l_skip41b - ; source: test_word_lte.p8:2194 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_270_afterif - ; source: test_word_lte.p8:2195 success++ - inc p8b_main.p8v_success -label_asm_270_afterif - ; source: test_word_lte.p8:2198 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_272_else - ; source: test_word_lte.p8:2199 success++ - inc p8b_main.p8v_success - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_lte.p8:2201 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_word_lte.p8:2203 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2205 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_lte.p8:2207 goto skip42a - bra p8l_skip42a - ; source: test_word_lte.p8:2208 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2209 skip42a: -p8l_skip42a - ; source: test_word_lte.p8:2211 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2212 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2214 goto skip42b - bra p8l_skip42b - ; source: test_word_lte.p8:2215 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2216 skip42b: -p8l_skip42b - ; source: test_word_lte.p8:2218 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_273_afterif - ; source: test_word_lte.p8:2219 success++ - inc p8b_main.p8v_success -label_asm_273_afterif - ; source: test_word_lte.p8:2222 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_275_else - ; source: test_word_lte.p8:2223 success++ - inc p8b_main.p8v_success - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_lte.p8:2225 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_word_lte.p8:2227 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:2228 value=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2230 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_lte.p8:2232 goto skip43a - bra p8l_skip43a - ; source: test_word_lte.p8:2233 lbl43a: fail_word(145) -p8l_lbl43a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2234 skip43a: -p8l_skip43a - ; source: test_word_lte.p8:2236 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2237 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2239 goto skip43b - bra p8l_skip43b - ; source: test_word_lte.p8:2240 lbl43b: fail_word(146) -p8l_lbl43b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2241 skip43b: -p8l_skip43b - ; source: test_word_lte.p8:2243 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_276_afterif - ; source: test_word_lte.p8:2244 fail_word(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_276_afterif - ; source: test_word_lte.p8:2247 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_278_else - ; source: test_word_lte.p8:2248 fail_word(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_lte.p8:2250 success++ - inc p8b_main.p8v_success -label_asm_277_afterif - ; source: test_word_lte.p8:2252 value=-1 - lda #<-1 - ldy #>-1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2254 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_lte.p8:2256 goto skip44a - bra p8l_skip44a - ; source: test_word_lte.p8:2257 lbl44a: fail_word(149) -p8l_lbl44a - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2258 skip44a: -p8l_skip44a - ; source: test_word_lte.p8:2260 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2261 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2263 goto skip44b - bra p8l_skip44b - ; source: test_word_lte.p8:2264 lbl44b: fail_word(150) -p8l_lbl44b - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2265 skip44b: -p8l_skip44b - ; source: test_word_lte.p8:2267 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_279_afterif - ; source: test_word_lte.p8:2268 fail_word(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_279_afterif - ; source: test_word_lte.p8:2271 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_281_else - ; source: test_word_lte.p8:2272 fail_word(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_lte.p8:2274 success++ - inc p8b_main.p8v_success -label_asm_280_afterif - ; source: test_word_lte.p8:2276 value=0 - stz p8v_value - stz p8v_value+1 - ; source: test_word_lte.p8:2278 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_lte.p8:2280 goto skip45a - bra p8l_skip45a - ; source: test_word_lte.p8:2281 lbl45a: fail_word(153) -p8l_lbl45a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2282 skip45a: -p8l_skip45a - ; source: test_word_lte.p8:2284 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2285 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2287 goto skip45b - bra p8l_skip45b - ; source: test_word_lte.p8:2288 lbl45b: fail_word(154) -p8l_lbl45b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2289 skip45b: -p8l_skip45b - ; source: test_word_lte.p8:2291 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_282_afterif - ; source: test_word_lte.p8:2292 fail_word(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_282_afterif - ; source: test_word_lte.p8:2295 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_284_else - ; source: test_word_lte.p8:2296 fail_word(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_lte.p8:2298 success++ - inc p8b_main.p8v_success -label_asm_283_afterif - ; source: test_word_lte.p8:2300 value=1 - lda #<1 - ldy #>1 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2302 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_lte.p8:2304 goto skip46a - bra p8l_skip46a - ; source: test_word_lte.p8:2305 lbl46a: fail_word(157) -p8l_lbl46a - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2306 skip46a: -p8l_skip46a - ; source: test_word_lte.p8:2308 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2309 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2311 goto skip46b - bra p8l_skip46b - ; source: test_word_lte.p8:2312 lbl46b: fail_word(158) -p8l_lbl46b - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2313 skip46b: -p8l_skip46b - ; source: test_word_lte.p8:2315 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_285_afterif - ; source: test_word_lte.p8:2316 fail_word(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_285_afterif - ; source: test_word_lte.p8:2319 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_287_else - ; source: test_word_lte.p8:2320 fail_word(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_lte.p8:2322 success++ - inc p8b_main.p8v_success -label_asm_286_afterif - ; source: test_word_lte.p8:2324 value=170 - lda #<$aa - ldy #>$aa - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2326 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_lte.p8:2328 goto skip47a - bra p8l_skip47a - ; source: test_word_lte.p8:2329 lbl47a: fail_word(161) -p8l_lbl47a - ldy #>$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2330 skip47a: -p8l_skip47a - ; source: test_word_lte.p8:2332 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2333 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2335 goto skip47b - bra p8l_skip47b - ; source: test_word_lte.p8:2336 lbl47b: fail_word(162) -p8l_lbl47b - ldy #>$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2337 skip47b: -p8l_skip47b - ; source: test_word_lte.p8:2339 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_288_afterif - ; source: test_word_lte.p8:2340 fail_word(163) - ldy #>$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_288_afterif - ; source: test_word_lte.p8:2343 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_290_else - ; source: test_word_lte.p8:2344 fail_word(164) - ldy #>$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_lte.p8:2346 success++ - inc p8b_main.p8v_success -label_asm_289_afterif - ; source: test_word_lte.p8:2348 value=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2350 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_lte.p8:2352 goto skip48a - bra p8l_skip48a - ; source: test_word_lte.p8:2353 lbl48a: fail_word(165) -p8l_lbl48a - ldy #>$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2354 skip48a: -p8l_skip48a - ; source: test_word_lte.p8:2356 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2357 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2359 goto skip48b - bra p8l_skip48b - ; source: test_word_lte.p8:2360 lbl48b: fail_word(166) -p8l_lbl48b - ldy #>$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2361 skip48b: -p8l_skip48b - ; source: test_word_lte.p8:2363 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_291_afterif - ; source: test_word_lte.p8:2364 fail_word(167) - ldy #>$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_291_afterif - ; source: test_word_lte.p8:2367 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_293_else - ; source: test_word_lte.p8:2368 fail_word(168) - ldy #>$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_lte.p8:2370 success++ - inc p8b_main.p8v_success -label_asm_292_afterif - ; source: test_word_lte.p8:2372 value=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_value - sty p8v_value+1 - - ; source: test_word_lte.p8:2374 if x<=value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_lte.p8:2376 goto skip49a - bra p8l_skip49a - ; source: test_word_lte.p8:2377 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2378 skip49a: -p8l_skip49a - ; source: test_word_lte.p8:2380 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2381 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2383 goto skip49b - bra p8l_skip49b - ; source: test_word_lte.p8:2384 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2385 skip49b: -p8l_skip49b - ; source: test_word_lte.p8:2387 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_294_afterif - ; source: test_word_lte.p8:2388 success++ - inc p8b_main.p8v_success -label_asm_294_afterif - ; source: test_word_lte.p8:2391 if x<=value - ldy p8v_value+1 - lda p8v_value - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_296_else - ; source: test_word_lte.p8:2392 success++ - inc p8b_main.p8v_success - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_lte.p8:2394 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_word_lte.p8:2396 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_lte.p8:1210 sub test_cmp_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_value .sint ? -p8v_x .sint ? - .send BSS - .pend - ; source: test_word_lte.p8:2398 sub test_cmp_array() { - -p8s_test_cmp_array .proc -; statements - ; source: test_word_lte.p8:2399 word @shared x - ; source: test_word_lte.p8:2400 word[] values = [0, 0] - ; source: test_word_lte.p8:2399 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_lte.p8:2401 success = 0 - stz p8b_main.p8v_success - ; source: test_word_lte.p8:2402 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:2403 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:2405 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_lte.p8:2407 goto skip1a - bra p8l_skip1a - ; source: test_word_lte.p8:2408 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2409 skip1a: -p8l_skip1a - ; source: test_word_lte.p8:2411 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2412 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2414 goto skip1b - bra p8l_skip1b - ; source: test_word_lte.p8:2415 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2416 skip1b: -p8l_skip1b - ; source: test_word_lte.p8:2418 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_297_afterif - ; source: test_word_lte.p8:2419 success++ - inc p8b_main.p8v_success -label_asm_297_afterif - ; source: test_word_lte.p8:2422 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_299_else - ; source: test_word_lte.p8:2423 success++ - inc p8b_main.p8v_success - bra label_asm_298_afterif -label_asm_299_else - ; source: test_word_lte.p8:2425 cx16.r0L++ - inc cx16.r0L -label_asm_298_afterif - ; source: test_word_lte.p8:2427 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2429 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_lte.p8:2431 goto skip2a - bra p8l_skip2a - ; source: test_word_lte.p8:2432 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2433 skip2a: -p8l_skip2a - ; source: test_word_lte.p8:2435 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2436 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2438 goto skip2b - bra p8l_skip2b - ; source: test_word_lte.p8:2439 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2440 skip2b: -p8l_skip2b - ; source: test_word_lte.p8:2442 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_300_afterif - ; source: test_word_lte.p8:2443 success++ - inc p8b_main.p8v_success -label_asm_300_afterif - ; source: test_word_lte.p8:2446 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_302_else - ; source: test_word_lte.p8:2447 success++ - inc p8b_main.p8v_success - bra label_asm_301_afterif -label_asm_302_else - ; source: test_word_lte.p8:2449 cx16.r0L++ - inc cx16.r0L -label_asm_301_afterif - ; source: test_word_lte.p8:2451 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:2453 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_lte.p8:2455 goto skip3a - bra p8l_skip3a - ; source: test_word_lte.p8:2456 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2457 skip3a: -p8l_skip3a - ; source: test_word_lte.p8:2459 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2460 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2462 goto skip3b - bra p8l_skip3b - ; source: test_word_lte.p8:2463 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2464 skip3b: -p8l_skip3b - ; source: test_word_lte.p8:2466 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_303_afterif - ; source: test_word_lte.p8:2467 success++ - inc p8b_main.p8v_success -label_asm_303_afterif - ; source: test_word_lte.p8:2470 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_305_else - ; source: test_word_lte.p8:2471 success++ - inc p8b_main.p8v_success - bra label_asm_304_afterif -label_asm_305_else - ; source: test_word_lte.p8:2473 cx16.r0L++ - inc cx16.r0L -label_asm_304_afterif - ; source: test_word_lte.p8:2475 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2477 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_lte.p8:2479 goto skip4a - bra p8l_skip4a - ; source: test_word_lte.p8:2480 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2481 skip4a: -p8l_skip4a - ; source: test_word_lte.p8:2483 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2484 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2486 goto skip4b - bra p8l_skip4b - ; source: test_word_lte.p8:2487 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2488 skip4b: -p8l_skip4b - ; source: test_word_lte.p8:2490 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_306_afterif - ; source: test_word_lte.p8:2491 success++ - inc p8b_main.p8v_success -label_asm_306_afterif - ; source: test_word_lte.p8:2494 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_308_else - ; source: test_word_lte.p8:2495 success++ - inc p8b_main.p8v_success - bra label_asm_307_afterif -label_asm_308_else - ; source: test_word_lte.p8:2497 cx16.r0L++ - inc cx16.r0L -label_asm_307_afterif - ; source: test_word_lte.p8:2499 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:2501 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_lte.p8:2503 goto skip5a - bra p8l_skip5a - ; source: test_word_lte.p8:2504 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2505 skip5a: -p8l_skip5a - ; source: test_word_lte.p8:2507 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2508 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2510 goto skip5b - bra p8l_skip5b - ; source: test_word_lte.p8:2511 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2512 skip5b: -p8l_skip5b - ; source: test_word_lte.p8:2514 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_309_afterif - ; source: test_word_lte.p8:2515 success++ - inc p8b_main.p8v_success -label_asm_309_afterif - ; source: test_word_lte.p8:2518 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_311_else - ; source: test_word_lte.p8:2519 success++ - inc p8b_main.p8v_success - bra label_asm_310_afterif -label_asm_311_else - ; source: test_word_lte.p8:2521 cx16.r0L++ - inc cx16.r0L -label_asm_310_afterif - ; source: test_word_lte.p8:2523 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:2525 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_lte.p8:2527 goto skip6a - bra p8l_skip6a - ; source: test_word_lte.p8:2528 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2529 skip6a: -p8l_skip6a - ; source: test_word_lte.p8:2531 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2532 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2534 goto skip6b - bra p8l_skip6b - ; source: test_word_lte.p8:2535 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2536 skip6b: -p8l_skip6b - ; source: test_word_lte.p8:2538 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_312_afterif - ; source: test_word_lte.p8:2539 success++ - inc p8b_main.p8v_success -label_asm_312_afterif - ; source: test_word_lte.p8:2542 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_314_else - ; source: test_word_lte.p8:2543 success++ - inc p8b_main.p8v_success - bra label_asm_313_afterif -label_asm_314_else - ; source: test_word_lte.p8:2545 cx16.r0L++ - inc cx16.r0L -label_asm_313_afterif - ; source: test_word_lte.p8:2547 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:2549 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_lte.p8:2551 goto skip7a - bra p8l_skip7a - ; source: test_word_lte.p8:2552 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2553 skip7a: -p8l_skip7a - ; source: test_word_lte.p8:2555 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2556 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2558 goto skip7b - bra p8l_skip7b - ; source: test_word_lte.p8:2559 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2560 skip7b: -p8l_skip7b - ; source: test_word_lte.p8:2562 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_315_afterif - ; source: test_word_lte.p8:2563 success++ - inc p8b_main.p8v_success -label_asm_315_afterif - ; source: test_word_lte.p8:2566 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_317_else - ; source: test_word_lte.p8:2567 success++ - inc p8b_main.p8v_success - bra label_asm_316_afterif -label_asm_317_else - ; source: test_word_lte.p8:2569 cx16.r0L++ - inc cx16.r0L -label_asm_316_afterif - ; source: test_word_lte.p8:2571 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:2572 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:2574 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_lte.p8:2576 goto skip8a - bra p8l_skip8a - ; source: test_word_lte.p8:2577 lbl8a: fail_word(169) -p8l_lbl8a - ldy #>$a9 - lda #<$a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2578 skip8a: -p8l_skip8a - ; source: test_word_lte.p8:2580 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2581 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2583 goto skip8b - bra p8l_skip8b - ; source: test_word_lte.p8:2584 lbl8b: fail_word(170) -p8l_lbl8b - ldy #>$aa - lda #<$aa - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2585 skip8b: -p8l_skip8b - ; source: test_word_lte.p8:2587 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_318_afterif - ; source: test_word_lte.p8:2588 fail_word(171) - ldy #>$ab - lda #<$ab - jsr p8b_main.p8s_fail_word -label_asm_318_afterif - ; source: test_word_lte.p8:2591 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_320_else - ; source: test_word_lte.p8:2592 fail_word(172) - ldy #>$ac - lda #<$ac - jsr p8b_main.p8s_fail_word - bra label_asm_319_afterif -label_asm_320_else - ; source: test_word_lte.p8:2594 success++ - inc p8b_main.p8v_success -label_asm_319_afterif - ; source: test_word_lte.p8:2596 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2598 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_lte.p8:2600 goto skip9a - bra p8l_skip9a - ; source: test_word_lte.p8:2601 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2602 skip9a: -p8l_skip9a - ; source: test_word_lte.p8:2604 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2605 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2607 goto skip9b - bra p8l_skip9b - ; source: test_word_lte.p8:2608 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2609 skip9b: -p8l_skip9b - ; source: test_word_lte.p8:2611 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_321_afterif - ; source: test_word_lte.p8:2612 success++ - inc p8b_main.p8v_success -label_asm_321_afterif - ; source: test_word_lte.p8:2615 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_323_else - ; source: test_word_lte.p8:2616 success++ - inc p8b_main.p8v_success - bra label_asm_322_afterif -label_asm_323_else - ; source: test_word_lte.p8:2618 cx16.r0L++ - inc cx16.r0L -label_asm_322_afterif - ; source: test_word_lte.p8:2620 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:2622 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_lte.p8:2624 goto skip10a - bra p8l_skip10a - ; source: test_word_lte.p8:2625 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2626 skip10a: -p8l_skip10a - ; source: test_word_lte.p8:2628 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2629 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2631 goto skip10b - bra p8l_skip10b - ; source: test_word_lte.p8:2632 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2633 skip10b: -p8l_skip10b - ; source: test_word_lte.p8:2635 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_324_afterif - ; source: test_word_lte.p8:2636 success++ - inc p8b_main.p8v_success -label_asm_324_afterif - ; source: test_word_lte.p8:2639 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_326_else - ; source: test_word_lte.p8:2640 success++ - inc p8b_main.p8v_success - bra label_asm_325_afterif -label_asm_326_else - ; source: test_word_lte.p8:2642 cx16.r0L++ - inc cx16.r0L -label_asm_325_afterif - ; source: test_word_lte.p8:2644 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2646 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_lte.p8:2648 goto skip11a - bra p8l_skip11a - ; source: test_word_lte.p8:2649 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2650 skip11a: -p8l_skip11a - ; source: test_word_lte.p8:2652 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2653 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2655 goto skip11b - bra p8l_skip11b - ; source: test_word_lte.p8:2656 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2657 skip11b: -p8l_skip11b - ; source: test_word_lte.p8:2659 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_327_afterif - ; source: test_word_lte.p8:2660 success++ - inc p8b_main.p8v_success -label_asm_327_afterif - ; source: test_word_lte.p8:2663 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_329_else - ; source: test_word_lte.p8:2664 success++ - inc p8b_main.p8v_success - bra label_asm_328_afterif -label_asm_329_else - ; source: test_word_lte.p8:2666 cx16.r0L++ - inc cx16.r0L -label_asm_328_afterif - ; source: test_word_lte.p8:2668 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:2670 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_lte.p8:2672 goto skip12a - bra p8l_skip12a - ; source: test_word_lte.p8:2673 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2674 skip12a: -p8l_skip12a - ; source: test_word_lte.p8:2676 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2677 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2679 goto skip12b - bra p8l_skip12b - ; source: test_word_lte.p8:2680 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2681 skip12b: -p8l_skip12b - ; source: test_word_lte.p8:2683 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_330_afterif - ; source: test_word_lte.p8:2684 success++ - inc p8b_main.p8v_success -label_asm_330_afterif - ; source: test_word_lte.p8:2687 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_332_else - ; source: test_word_lte.p8:2688 success++ - inc p8b_main.p8v_success - bra label_asm_331_afterif -label_asm_332_else - ; source: test_word_lte.p8:2690 cx16.r0L++ - inc cx16.r0L -label_asm_331_afterif - ; source: test_word_lte.p8:2692 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:2694 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_lte.p8:2696 goto skip13a - bra p8l_skip13a - ; source: test_word_lte.p8:2697 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2698 skip13a: -p8l_skip13a - ; source: test_word_lte.p8:2700 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2701 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2703 goto skip13b - bra p8l_skip13b - ; source: test_word_lte.p8:2704 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2705 skip13b: -p8l_skip13b - ; source: test_word_lte.p8:2707 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_333_afterif - ; source: test_word_lte.p8:2708 success++ - inc p8b_main.p8v_success -label_asm_333_afterif - ; source: test_word_lte.p8:2711 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_335_else - ; source: test_word_lte.p8:2712 success++ - inc p8b_main.p8v_success - bra label_asm_334_afterif -label_asm_335_else - ; source: test_word_lte.p8:2714 cx16.r0L++ - inc cx16.r0L -label_asm_334_afterif - ; source: test_word_lte.p8:2716 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:2718 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_lte.p8:2720 goto skip14a - bra p8l_skip14a - ; source: test_word_lte.p8:2721 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2722 skip14a: -p8l_skip14a - ; source: test_word_lte.p8:2724 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2725 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2727 goto skip14b - bra p8l_skip14b - ; source: test_word_lte.p8:2728 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2729 skip14b: -p8l_skip14b - ; source: test_word_lte.p8:2731 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_336_afterif - ; source: test_word_lte.p8:2732 success++ - inc p8b_main.p8v_success -label_asm_336_afterif - ; source: test_word_lte.p8:2735 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_338_else - ; source: test_word_lte.p8:2736 success++ - inc p8b_main.p8v_success - bra label_asm_337_afterif -label_asm_338_else - ; source: test_word_lte.p8:2738 cx16.r0L++ - inc cx16.r0L -label_asm_337_afterif - ; source: test_word_lte.p8:2740 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_lte.p8:2741 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:2743 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_lte.p8:2745 goto skip15a - bra p8l_skip15a - ; source: test_word_lte.p8:2746 lbl15a: fail_word(173) -p8l_lbl15a - ldy #>$ad - lda #<$ad - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2747 skip15a: -p8l_skip15a - ; source: test_word_lte.p8:2749 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2750 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2752 goto skip15b - bra p8l_skip15b - ; source: test_word_lte.p8:2753 lbl15b: fail_word(174) -p8l_lbl15b - ldy #>$ae - lda #<$ae - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2754 skip15b: -p8l_skip15b - ; source: test_word_lte.p8:2756 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_339_afterif - ; source: test_word_lte.p8:2757 fail_word(175) - ldy #>$af - lda #<$af - jsr p8b_main.p8s_fail_word -label_asm_339_afterif - ; source: test_word_lte.p8:2760 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_341_else - ; source: test_word_lte.p8:2761 fail_word(176) - ldy #>$b0 - lda #<$b0 - jsr p8b_main.p8s_fail_word - bra label_asm_340_afterif -label_asm_341_else - ; source: test_word_lte.p8:2763 success++ - inc p8b_main.p8v_success -label_asm_340_afterif - ; source: test_word_lte.p8:2765 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2767 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_lte.p8:2769 goto skip16a - bra p8l_skip16a - ; source: test_word_lte.p8:2770 lbl16a: fail_word(177) -p8l_lbl16a - ldy #>$b1 - lda #<$b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2771 skip16a: -p8l_skip16a - ; source: test_word_lte.p8:2773 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2774 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2776 goto skip16b - bra p8l_skip16b - ; source: test_word_lte.p8:2777 lbl16b: fail_word(178) -p8l_lbl16b - ldy #>$b2 - lda #<$b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2778 skip16b: -p8l_skip16b - ; source: test_word_lte.p8:2780 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_342_afterif - ; source: test_word_lte.p8:2781 fail_word(179) - ldy #>$b3 - lda #<$b3 - jsr p8b_main.p8s_fail_word -label_asm_342_afterif - ; source: test_word_lte.p8:2784 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_344_else - ; source: test_word_lte.p8:2785 fail_word(180) - ldy #>$b4 - lda #<$b4 - jsr p8b_main.p8s_fail_word - bra label_asm_343_afterif -label_asm_344_else - ; source: test_word_lte.p8:2787 success++ - inc p8b_main.p8v_success -label_asm_343_afterif - ; source: test_word_lte.p8:2789 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:2791 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_lte.p8:2793 goto skip17a - bra p8l_skip17a - ; source: test_word_lte.p8:2794 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2795 skip17a: -p8l_skip17a - ; source: test_word_lte.p8:2797 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2798 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2800 goto skip17b - bra p8l_skip17b - ; source: test_word_lte.p8:2801 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2802 skip17b: -p8l_skip17b - ; source: test_word_lte.p8:2804 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_345_afterif - ; source: test_word_lte.p8:2805 success++ - inc p8b_main.p8v_success -label_asm_345_afterif - ; source: test_word_lte.p8:2808 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_347_else - ; source: test_word_lte.p8:2809 success++ - inc p8b_main.p8v_success - bra label_asm_346_afterif -label_asm_347_else - ; source: test_word_lte.p8:2811 cx16.r0L++ - inc cx16.r0L -label_asm_346_afterif - ; source: test_word_lte.p8:2813 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2815 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_lte.p8:2817 goto skip18a - bra p8l_skip18a - ; source: test_word_lte.p8:2818 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2819 skip18a: -p8l_skip18a - ; source: test_word_lte.p8:2821 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2822 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2824 goto skip18b - bra p8l_skip18b - ; source: test_word_lte.p8:2825 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2826 skip18b: -p8l_skip18b - ; source: test_word_lte.p8:2828 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_348_afterif - ; source: test_word_lte.p8:2829 success++ - inc p8b_main.p8v_success -label_asm_348_afterif - ; source: test_word_lte.p8:2832 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_350_else - ; source: test_word_lte.p8:2833 success++ - inc p8b_main.p8v_success - bra label_asm_349_afterif -label_asm_350_else - ; source: test_word_lte.p8:2835 cx16.r0L++ - inc cx16.r0L -label_asm_349_afterif - ; source: test_word_lte.p8:2837 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:2839 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_lte.p8:2841 goto skip19a - bra p8l_skip19a - ; source: test_word_lte.p8:2842 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2843 skip19a: -p8l_skip19a - ; source: test_word_lte.p8:2845 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2846 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2848 goto skip19b - bra p8l_skip19b - ; source: test_word_lte.p8:2849 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2850 skip19b: -p8l_skip19b - ; source: test_word_lte.p8:2852 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_351_afterif - ; source: test_word_lte.p8:2853 success++ - inc p8b_main.p8v_success -label_asm_351_afterif - ; source: test_word_lte.p8:2856 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_353_else - ; source: test_word_lte.p8:2857 success++ - inc p8b_main.p8v_success - bra label_asm_352_afterif -label_asm_353_else - ; source: test_word_lte.p8:2859 cx16.r0L++ - inc cx16.r0L -label_asm_352_afterif - ; source: test_word_lte.p8:2861 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:2863 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_lte.p8:2865 goto skip20a - bra p8l_skip20a - ; source: test_word_lte.p8:2866 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2867 skip20a: -p8l_skip20a - ; source: test_word_lte.p8:2869 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2870 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2872 goto skip20b - bra p8l_skip20b - ; source: test_word_lte.p8:2873 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2874 skip20b: -p8l_skip20b - ; source: test_word_lte.p8:2876 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_354_afterif - ; source: test_word_lte.p8:2877 success++ - inc p8b_main.p8v_success -label_asm_354_afterif - ; source: test_word_lte.p8:2880 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_356_else - ; source: test_word_lte.p8:2881 success++ - inc p8b_main.p8v_success - bra label_asm_355_afterif -label_asm_356_else - ; source: test_word_lte.p8:2883 cx16.r0L++ - inc cx16.r0L -label_asm_355_afterif - ; source: test_word_lte.p8:2885 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:2887 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_lte.p8:2889 goto skip21a - bra p8l_skip21a - ; source: test_word_lte.p8:2890 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2891 skip21a: -p8l_skip21a - ; source: test_word_lte.p8:2893 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2894 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2896 goto skip21b - bra p8l_skip21b - ; source: test_word_lte.p8:2897 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2898 skip21b: -p8l_skip21b - ; source: test_word_lte.p8:2900 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_357_afterif - ; source: test_word_lte.p8:2901 success++ - inc p8b_main.p8v_success -label_asm_357_afterif - ; source: test_word_lte.p8:2904 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_359_else - ; source: test_word_lte.p8:2905 success++ - inc p8b_main.p8v_success - bra label_asm_358_afterif -label_asm_359_else - ; source: test_word_lte.p8:2907 cx16.r0L++ - inc cx16.r0L -label_asm_358_afterif - ; source: test_word_lte.p8:2909 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:2910 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:2912 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_lte.p8:2914 goto skip22a - bra p8l_skip22a - ; source: test_word_lte.p8:2915 lbl22a: fail_word(181) -p8l_lbl22a - ldy #>$b5 - lda #<$b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2916 skip22a: -p8l_skip22a - ; source: test_word_lte.p8:2918 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2919 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2921 goto skip22b - bra p8l_skip22b - ; source: test_word_lte.p8:2922 lbl22b: fail_word(182) -p8l_lbl22b - ldy #>$b6 - lda #<$b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2923 skip22b: -p8l_skip22b - ; source: test_word_lte.p8:2925 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_360_afterif - ; source: test_word_lte.p8:2926 fail_word(183) - ldy #>$b7 - lda #<$b7 - jsr p8b_main.p8s_fail_word -label_asm_360_afterif - ; source: test_word_lte.p8:2929 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_362_else - ; source: test_word_lte.p8:2930 fail_word(184) - ldy #>$b8 - lda #<$b8 - jsr p8b_main.p8s_fail_word - bra label_asm_361_afterif -label_asm_362_else - ; source: test_word_lte.p8:2932 success++ - inc p8b_main.p8v_success -label_asm_361_afterif - ; source: test_word_lte.p8:2934 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2936 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_lte.p8:2938 goto skip23a - bra p8l_skip23a - ; source: test_word_lte.p8:2939 lbl23a: fail_word(185) -p8l_lbl23a - ldy #>$b9 - lda #<$b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2940 skip23a: -p8l_skip23a - ; source: test_word_lte.p8:2942 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2943 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2945 goto skip23b - bra p8l_skip23b - ; source: test_word_lte.p8:2946 lbl23b: fail_word(186) -p8l_lbl23b - ldy #>$ba - lda #<$ba - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2947 skip23b: -p8l_skip23b - ; source: test_word_lte.p8:2949 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_363_afterif - ; source: test_word_lte.p8:2950 fail_word(187) - ldy #>$bb - lda #<$bb - jsr p8b_main.p8s_fail_word -label_asm_363_afterif - ; source: test_word_lte.p8:2953 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_365_else - ; source: test_word_lte.p8:2954 fail_word(188) - ldy #>$bc - lda #<$bc - jsr p8b_main.p8s_fail_word - bra label_asm_364_afterif -label_asm_365_else - ; source: test_word_lte.p8:2956 success++ - inc p8b_main.p8v_success -label_asm_364_afterif - ; source: test_word_lte.p8:2958 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:2960 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_lte.p8:2962 goto skip24a - bra p8l_skip24a - ; source: test_word_lte.p8:2963 lbl24a: fail_word(189) -p8l_lbl24a - ldy #>$bd - lda #<$bd - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2964 skip24a: -p8l_skip24a - ; source: test_word_lte.p8:2966 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2967 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2969 goto skip24b - bra p8l_skip24b - ; source: test_word_lte.p8:2970 lbl24b: fail_word(190) -p8l_lbl24b - ldy #>$be - lda #<$be - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:2971 skip24b: -p8l_skip24b - ; source: test_word_lte.p8:2973 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_366_afterif - ; source: test_word_lte.p8:2974 fail_word(191) - ldy #>$bf - lda #<$bf - jsr p8b_main.p8s_fail_word -label_asm_366_afterif - ; source: test_word_lte.p8:2977 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_368_else - ; source: test_word_lte.p8:2978 fail_word(192) - ldy #>$c0 - lda #<$c0 - jsr p8b_main.p8s_fail_word - bra label_asm_367_afterif -label_asm_368_else - ; source: test_word_lte.p8:2980 success++ - inc p8b_main.p8v_success -label_asm_367_afterif - ; source: test_word_lte.p8:2982 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:2984 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_lte.p8:2986 goto skip25a - bra p8l_skip25a - ; source: test_word_lte.p8:2987 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2988 skip25a: -p8l_skip25a - ; source: test_word_lte.p8:2990 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:2991 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:2993 goto skip25b - bra p8l_skip25b - ; source: test_word_lte.p8:2994 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:2995 skip25b: -p8l_skip25b - ; source: test_word_lte.p8:2997 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_369_afterif - ; source: test_word_lte.p8:2998 success++ - inc p8b_main.p8v_success -label_asm_369_afterif - ; source: test_word_lte.p8:3001 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_371_else - ; source: test_word_lte.p8:3002 success++ - inc p8b_main.p8v_success - bra label_asm_370_afterif -label_asm_371_else - ; source: test_word_lte.p8:3004 cx16.r0L++ - inc cx16.r0L -label_asm_370_afterif - ; source: test_word_lte.p8:3006 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:3008 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_lte.p8:3010 goto skip26a - bra p8l_skip26a - ; source: test_word_lte.p8:3011 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3012 skip26a: -p8l_skip26a - ; source: test_word_lte.p8:3014 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3015 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3017 goto skip26b - bra p8l_skip26b - ; source: test_word_lte.p8:3018 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3019 skip26b: -p8l_skip26b - ; source: test_word_lte.p8:3021 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_372_afterif - ; source: test_word_lte.p8:3022 success++ - inc p8b_main.p8v_success -label_asm_372_afterif - ; source: test_word_lte.p8:3025 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_374_else - ; source: test_word_lte.p8:3026 success++ - inc p8b_main.p8v_success - bra label_asm_373_afterif -label_asm_374_else - ; source: test_word_lte.p8:3028 cx16.r0L++ - inc cx16.r0L -label_asm_373_afterif - ; source: test_word_lte.p8:3030 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:3032 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_lte.p8:3034 goto skip27a - bra p8l_skip27a - ; source: test_word_lte.p8:3035 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3036 skip27a: -p8l_skip27a - ; source: test_word_lte.p8:3038 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3039 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3041 goto skip27b - bra p8l_skip27b - ; source: test_word_lte.p8:3042 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3043 skip27b: -p8l_skip27b - ; source: test_word_lte.p8:3045 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_375_afterif - ; source: test_word_lte.p8:3046 success++ - inc p8b_main.p8v_success -label_asm_375_afterif - ; source: test_word_lte.p8:3049 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_377_else - ; source: test_word_lte.p8:3050 success++ - inc p8b_main.p8v_success - bra label_asm_376_afterif -label_asm_377_else - ; source: test_word_lte.p8:3052 cx16.r0L++ - inc cx16.r0L -label_asm_376_afterif - ; source: test_word_lte.p8:3054 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:3056 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_lte.p8:3058 goto skip28a - bra p8l_skip28a - ; source: test_word_lte.p8:3059 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3060 skip28a: -p8l_skip28a - ; source: test_word_lte.p8:3062 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3063 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3065 goto skip28b - bra p8l_skip28b - ; source: test_word_lte.p8:3066 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3067 skip28b: -p8l_skip28b - ; source: test_word_lte.p8:3069 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_378_afterif - ; source: test_word_lte.p8:3070 success++ - inc p8b_main.p8v_success -label_asm_378_afterif - ; source: test_word_lte.p8:3073 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_380_else - ; source: test_word_lte.p8:3074 success++ - inc p8b_main.p8v_success - bra label_asm_379_afterif -label_asm_380_else - ; source: test_word_lte.p8:3076 cx16.r0L++ - inc cx16.r0L -label_asm_379_afterif - ; source: test_word_lte.p8:3078 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:3079 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:3081 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_lte.p8:3083 goto skip29a - bra p8l_skip29a - ; source: test_word_lte.p8:3084 lbl29a: fail_word(193) -p8l_lbl29a - ldy #>$c1 - lda #<$c1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3085 skip29a: -p8l_skip29a - ; source: test_word_lte.p8:3087 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3088 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3090 goto skip29b - bra p8l_skip29b - ; source: test_word_lte.p8:3091 lbl29b: fail_word(194) -p8l_lbl29b - ldy #>$c2 - lda #<$c2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3092 skip29b: -p8l_skip29b - ; source: test_word_lte.p8:3094 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_381_afterif - ; source: test_word_lte.p8:3095 fail_word(195) - ldy #>$c3 - lda #<$c3 - jsr p8b_main.p8s_fail_word -label_asm_381_afterif - ; source: test_word_lte.p8:3098 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_383_else - ; source: test_word_lte.p8:3099 fail_word(196) - ldy #>$c4 - lda #<$c4 - jsr p8b_main.p8s_fail_word - bra label_asm_382_afterif -label_asm_383_else - ; source: test_word_lte.p8:3101 success++ - inc p8b_main.p8v_success -label_asm_382_afterif - ; source: test_word_lte.p8:3103 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:3105 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_lte.p8:3107 goto skip30a - bra p8l_skip30a - ; source: test_word_lte.p8:3108 lbl30a: fail_word(197) -p8l_lbl30a - ldy #>$c5 - lda #<$c5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3109 skip30a: -p8l_skip30a - ; source: test_word_lte.p8:3111 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3112 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3114 goto skip30b - bra p8l_skip30b - ; source: test_word_lte.p8:3115 lbl30b: fail_word(198) -p8l_lbl30b - ldy #>$c6 - lda #<$c6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3116 skip30b: -p8l_skip30b - ; source: test_word_lte.p8:3118 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_384_afterif - ; source: test_word_lte.p8:3119 fail_word(199) - ldy #>$c7 - lda #<$c7 - jsr p8b_main.p8s_fail_word -label_asm_384_afterif - ; source: test_word_lte.p8:3122 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_386_else - ; source: test_word_lte.p8:3123 fail_word(200) - ldy #>$c8 - lda #<$c8 - jsr p8b_main.p8s_fail_word - bra label_asm_385_afterif -label_asm_386_else - ; source: test_word_lte.p8:3125 success++ - inc p8b_main.p8v_success -label_asm_385_afterif - ; source: test_word_lte.p8:3127 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:3129 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_lte.p8:3131 goto skip31a - bra p8l_skip31a - ; source: test_word_lte.p8:3132 lbl31a: fail_word(201) -p8l_lbl31a - ldy #>$c9 - lda #<$c9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3133 skip31a: -p8l_skip31a - ; source: test_word_lte.p8:3135 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3136 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3138 goto skip31b - bra p8l_skip31b - ; source: test_word_lte.p8:3139 lbl31b: fail_word(202) -p8l_lbl31b - ldy #>$ca - lda #<$ca - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3140 skip31b: -p8l_skip31b - ; source: test_word_lte.p8:3142 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_387_afterif - ; source: test_word_lte.p8:3143 fail_word(203) - ldy #>$cb - lda #<$cb - jsr p8b_main.p8s_fail_word -label_asm_387_afterif - ; source: test_word_lte.p8:3146 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_389_else - ; source: test_word_lte.p8:3147 fail_word(204) - ldy #>$cc - lda #<$cc - jsr p8b_main.p8s_fail_word - bra label_asm_388_afterif -label_asm_389_else - ; source: test_word_lte.p8:3149 success++ - inc p8b_main.p8v_success -label_asm_388_afterif - ; source: test_word_lte.p8:3151 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:3153 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_lte.p8:3155 goto skip32a - bra p8l_skip32a - ; source: test_word_lte.p8:3156 lbl32a: fail_word(205) -p8l_lbl32a - ldy #>$cd - lda #<$cd - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3157 skip32a: -p8l_skip32a - ; source: test_word_lte.p8:3159 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3160 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3162 goto skip32b - bra p8l_skip32b - ; source: test_word_lte.p8:3163 lbl32b: fail_word(206) -p8l_lbl32b - ldy #>$ce - lda #<$ce - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3164 skip32b: -p8l_skip32b - ; source: test_word_lte.p8:3166 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_390_afterif - ; source: test_word_lte.p8:3167 fail_word(207) - ldy #>$cf - lda #<$cf - jsr p8b_main.p8s_fail_word -label_asm_390_afterif - ; source: test_word_lte.p8:3170 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_392_else - ; source: test_word_lte.p8:3171 fail_word(208) - ldy #>$d0 - lda #<$d0 - jsr p8b_main.p8s_fail_word - bra label_asm_391_afterif -label_asm_392_else - ; source: test_word_lte.p8:3173 success++ - inc p8b_main.p8v_success -label_asm_391_afterif - ; source: test_word_lte.p8:3175 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:3177 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_lte.p8:3179 goto skip33a - bra p8l_skip33a - ; source: test_word_lte.p8:3180 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3181 skip33a: -p8l_skip33a - ; source: test_word_lte.p8:3183 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3184 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3186 goto skip33b - bra p8l_skip33b - ; source: test_word_lte.p8:3187 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3188 skip33b: -p8l_skip33b - ; source: test_word_lte.p8:3190 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_393_afterif - ; source: test_word_lte.p8:3191 success++ - inc p8b_main.p8v_success -label_asm_393_afterif - ; source: test_word_lte.p8:3194 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_395_else - ; source: test_word_lte.p8:3195 success++ - inc p8b_main.p8v_success - bra label_asm_394_afterif -label_asm_395_else - ; source: test_word_lte.p8:3197 cx16.r0L++ - inc cx16.r0L -label_asm_394_afterif - ; source: test_word_lte.p8:3199 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:3201 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_lte.p8:3203 goto skip34a - bra p8l_skip34a - ; source: test_word_lte.p8:3204 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3205 skip34a: -p8l_skip34a - ; source: test_word_lte.p8:3207 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3208 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3210 goto skip34b - bra p8l_skip34b - ; source: test_word_lte.p8:3211 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3212 skip34b: -p8l_skip34b - ; source: test_word_lte.p8:3214 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_396_afterif - ; source: test_word_lte.p8:3215 success++ - inc p8b_main.p8v_success -label_asm_396_afterif - ; source: test_word_lte.p8:3218 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_398_else - ; source: test_word_lte.p8:3219 success++ - inc p8b_main.p8v_success - bra label_asm_397_afterif -label_asm_398_else - ; source: test_word_lte.p8:3221 cx16.r0L++ - inc cx16.r0L -label_asm_397_afterif - ; source: test_word_lte.p8:3223 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:3225 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_lte.p8:3227 goto skip35a - bra p8l_skip35a - ; source: test_word_lte.p8:3228 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3229 skip35a: -p8l_skip35a - ; source: test_word_lte.p8:3231 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3232 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3234 goto skip35b - bra p8l_skip35b - ; source: test_word_lte.p8:3235 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3236 skip35b: -p8l_skip35b - ; source: test_word_lte.p8:3238 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_399_afterif - ; source: test_word_lte.p8:3239 success++ - inc p8b_main.p8v_success -label_asm_399_afterif - ; source: test_word_lte.p8:3242 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_401_else - ; source: test_word_lte.p8:3243 success++ - inc p8b_main.p8v_success - bra label_asm_400_afterif -label_asm_401_else - ; source: test_word_lte.p8:3245 cx16.r0L++ - inc cx16.r0L -label_asm_400_afterif - ; source: test_word_lte.p8:3247 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:3248 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:3250 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_lte.p8:3252 goto skip36a - bra p8l_skip36a - ; source: test_word_lte.p8:3253 lbl36a: fail_word(209) -p8l_lbl36a - ldy #>$d1 - lda #<$d1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3254 skip36a: -p8l_skip36a - ; source: test_word_lte.p8:3256 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3257 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3259 goto skip36b - bra p8l_skip36b - ; source: test_word_lte.p8:3260 lbl36b: fail_word(210) -p8l_lbl36b - ldy #>$d2 - lda #<$d2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3261 skip36b: -p8l_skip36b - ; source: test_word_lte.p8:3263 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_402_afterif - ; source: test_word_lte.p8:3264 fail_word(211) - ldy #>$d3 - lda #<$d3 - jsr p8b_main.p8s_fail_word -label_asm_402_afterif - ; source: test_word_lte.p8:3267 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_404_else - ; source: test_word_lte.p8:3268 fail_word(212) - ldy #>$d4 - lda #<$d4 - jsr p8b_main.p8s_fail_word - bra label_asm_403_afterif -label_asm_404_else - ; source: test_word_lte.p8:3270 success++ - inc p8b_main.p8v_success -label_asm_403_afterif - ; source: test_word_lte.p8:3272 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:3274 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_lte.p8:3276 goto skip37a - bra p8l_skip37a - ; source: test_word_lte.p8:3277 lbl37a: fail_word(213) -p8l_lbl37a - ldy #>$d5 - lda #<$d5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3278 skip37a: -p8l_skip37a - ; source: test_word_lte.p8:3280 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3281 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3283 goto skip37b - bra p8l_skip37b - ; source: test_word_lte.p8:3284 lbl37b: fail_word(214) -p8l_lbl37b - ldy #>$d6 - lda #<$d6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3285 skip37b: -p8l_skip37b - ; source: test_word_lte.p8:3287 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_405_afterif - ; source: test_word_lte.p8:3288 fail_word(215) - ldy #>$d7 - lda #<$d7 - jsr p8b_main.p8s_fail_word -label_asm_405_afterif - ; source: test_word_lte.p8:3291 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_407_else - ; source: test_word_lte.p8:3292 fail_word(216) - ldy #>$d8 - lda #<$d8 - jsr p8b_main.p8s_fail_word - bra label_asm_406_afterif -label_asm_407_else - ; source: test_word_lte.p8:3294 success++ - inc p8b_main.p8v_success -label_asm_406_afterif - ; source: test_word_lte.p8:3296 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:3298 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_lte.p8:3300 goto skip38a - bra p8l_skip38a - ; source: test_word_lte.p8:3301 lbl38a: fail_word(217) -p8l_lbl38a - ldy #>$d9 - lda #<$d9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3302 skip38a: -p8l_skip38a - ; source: test_word_lte.p8:3304 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3305 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3307 goto skip38b - bra p8l_skip38b - ; source: test_word_lte.p8:3308 lbl38b: fail_word(218) -p8l_lbl38b - ldy #>$da - lda #<$da - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3309 skip38b: -p8l_skip38b - ; source: test_word_lte.p8:3311 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_408_afterif - ; source: test_word_lte.p8:3312 fail_word(219) - ldy #>$db - lda #<$db - jsr p8b_main.p8s_fail_word -label_asm_408_afterif - ; source: test_word_lte.p8:3315 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_410_else - ; source: test_word_lte.p8:3316 fail_word(220) - ldy #>$dc - lda #<$dc - jsr p8b_main.p8s_fail_word - bra label_asm_409_afterif -label_asm_410_else - ; source: test_word_lte.p8:3318 success++ - inc p8b_main.p8v_success -label_asm_409_afterif - ; source: test_word_lte.p8:3320 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:3322 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_lte.p8:3324 goto skip39a - bra p8l_skip39a - ; source: test_word_lte.p8:3325 lbl39a: fail_word(221) -p8l_lbl39a - ldy #>$dd - lda #<$dd - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3326 skip39a: -p8l_skip39a - ; source: test_word_lte.p8:3328 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3329 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3331 goto skip39b - bra p8l_skip39b - ; source: test_word_lte.p8:3332 lbl39b: fail_word(222) -p8l_lbl39b - ldy #>$de - lda #<$de - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3333 skip39b: -p8l_skip39b - ; source: test_word_lte.p8:3335 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_411_afterif - ; source: test_word_lte.p8:3336 fail_word(223) - ldy #>$df - lda #<$df - jsr p8b_main.p8s_fail_word -label_asm_411_afterif - ; source: test_word_lte.p8:3339 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_413_else - ; source: test_word_lte.p8:3340 fail_word(224) - ldy #>$e0 - lda #<$e0 - jsr p8b_main.p8s_fail_word - bra label_asm_412_afterif -label_asm_413_else - ; source: test_word_lte.p8:3342 success++ - inc p8b_main.p8v_success -label_asm_412_afterif - ; source: test_word_lte.p8:3344 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:3346 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_lte.p8:3348 goto skip40a - bra p8l_skip40a - ; source: test_word_lte.p8:3349 lbl40a: fail_word(225) -p8l_lbl40a - ldy #>$e1 - lda #<$e1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3350 skip40a: -p8l_skip40a - ; source: test_word_lte.p8:3352 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3353 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3355 goto skip40b - bra p8l_skip40b - ; source: test_word_lte.p8:3356 lbl40b: fail_word(226) -p8l_lbl40b - ldy #>$e2 - lda #<$e2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3357 skip40b: -p8l_skip40b - ; source: test_word_lte.p8:3359 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_414_afterif - ; source: test_word_lte.p8:3360 fail_word(227) - ldy #>$e3 - lda #<$e3 - jsr p8b_main.p8s_fail_word -label_asm_414_afterif - ; source: test_word_lte.p8:3363 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_416_else - ; source: test_word_lte.p8:3364 fail_word(228) - ldy #>$e4 - lda #<$e4 - jsr p8b_main.p8s_fail_word - bra label_asm_415_afterif -label_asm_416_else - ; source: test_word_lte.p8:3366 success++ - inc p8b_main.p8v_success -label_asm_415_afterif - ; source: test_word_lte.p8:3368 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:3370 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_lte.p8:3372 goto skip41a - bra p8l_skip41a - ; source: test_word_lte.p8:3373 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3374 skip41a: -p8l_skip41a - ; source: test_word_lte.p8:3376 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3377 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3379 goto skip41b - bra p8l_skip41b - ; source: test_word_lte.p8:3380 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3381 skip41b: -p8l_skip41b - ; source: test_word_lte.p8:3383 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_417_afterif - ; source: test_word_lte.p8:3384 success++ - inc p8b_main.p8v_success -label_asm_417_afterif - ; source: test_word_lte.p8:3387 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_419_else - ; source: test_word_lte.p8:3388 success++ - inc p8b_main.p8v_success - bra label_asm_418_afterif -label_asm_419_else - ; source: test_word_lte.p8:3390 cx16.r0L++ - inc cx16.r0L -label_asm_418_afterif - ; source: test_word_lte.p8:3392 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:3394 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_lte.p8:3396 goto skip42a - bra p8l_skip42a - ; source: test_word_lte.p8:3397 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3398 skip42a: -p8l_skip42a - ; source: test_word_lte.p8:3400 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3401 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3403 goto skip42b - bra p8l_skip42b - ; source: test_word_lte.p8:3404 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3405 skip42b: -p8l_skip42b - ; source: test_word_lte.p8:3407 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_420_afterif - ; source: test_word_lte.p8:3408 success++ - inc p8b_main.p8v_success -label_asm_420_afterif - ; source: test_word_lte.p8:3411 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_422_else - ; source: test_word_lte.p8:3412 success++ - inc p8b_main.p8v_success - bra label_asm_421_afterif -label_asm_422_else - ; source: test_word_lte.p8:3414 cx16.r0L++ - inc cx16.r0L -label_asm_421_afterif - ; source: test_word_lte.p8:3416 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:3417 values[1]=-21829 - ldy #2 - lda #<-$5545 - sta p8v_values,y - lda #>-$5545 - sta p8v_values+1,y - ; source: test_word_lte.p8:3419 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_lte.p8:3421 goto skip43a - bra p8l_skip43a - ; source: test_word_lte.p8:3422 lbl43a: fail_word(229) -p8l_lbl43a - ldy #>$e5 - lda #<$e5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3423 skip43a: -p8l_skip43a - ; source: test_word_lte.p8:3425 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3426 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3428 goto skip43b - bra p8l_skip43b - ; source: test_word_lte.p8:3429 lbl43b: fail_word(230) -p8l_lbl43b - ldy #>$e6 - lda #<$e6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3430 skip43b: -p8l_skip43b - ; source: test_word_lte.p8:3432 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_423_afterif - ; source: test_word_lte.p8:3433 fail_word(231) - ldy #>$e7 - lda #<$e7 - jsr p8b_main.p8s_fail_word -label_asm_423_afterif - ; source: test_word_lte.p8:3436 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_425_else - ; source: test_word_lte.p8:3437 fail_word(232) - ldy #>$e8 - lda #<$e8 - jsr p8b_main.p8s_fail_word - bra label_asm_424_afterif -label_asm_425_else - ; source: test_word_lte.p8:3439 success++ - inc p8b_main.p8v_success -label_asm_424_afterif - ; source: test_word_lte.p8:3441 values[1]=-1 - ldy #2 - lda #<-1 - sta p8v_values,y - lda #>-1 - sta p8v_values+1,y - ; source: test_word_lte.p8:3443 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_lte.p8:3445 goto skip44a - bra p8l_skip44a - ; source: test_word_lte.p8:3446 lbl44a: fail_word(233) -p8l_lbl44a - ldy #>$e9 - lda #<$e9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3447 skip44a: -p8l_skip44a - ; source: test_word_lte.p8:3449 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3450 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3452 goto skip44b - bra p8l_skip44b - ; source: test_word_lte.p8:3453 lbl44b: fail_word(234) -p8l_lbl44b - ldy #>$ea - lda #<$ea - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3454 skip44b: -p8l_skip44b - ; source: test_word_lte.p8:3456 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_426_afterif - ; source: test_word_lte.p8:3457 fail_word(235) - ldy #>$eb - lda #<$eb - jsr p8b_main.p8s_fail_word -label_asm_426_afterif - ; source: test_word_lte.p8:3460 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_428_else - ; source: test_word_lte.p8:3461 fail_word(236) - ldy #>$ec - lda #<$ec - jsr p8b_main.p8s_fail_word - bra label_asm_427_afterif -label_asm_428_else - ; source: test_word_lte.p8:3463 success++ - inc p8b_main.p8v_success -label_asm_427_afterif - ; source: test_word_lte.p8:3465 values[1]=0 - ldy #2 - lda #0 - sta p8v_values,y - sta p8v_values+1,y - ; source: test_word_lte.p8:3467 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_lte.p8:3469 goto skip45a - bra p8l_skip45a - ; source: test_word_lte.p8:3470 lbl45a: fail_word(237) -p8l_lbl45a - ldy #>$ed - lda #<$ed - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3471 skip45a: -p8l_skip45a - ; source: test_word_lte.p8:3473 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3474 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3476 goto skip45b - bra p8l_skip45b - ; source: test_word_lte.p8:3477 lbl45b: fail_word(238) -p8l_lbl45b - ldy #>$ee - lda #<$ee - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3478 skip45b: -p8l_skip45b - ; source: test_word_lte.p8:3480 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_429_afterif - ; source: test_word_lte.p8:3481 fail_word(239) - ldy #>$ef - lda #<$ef - jsr p8b_main.p8s_fail_word -label_asm_429_afterif - ; source: test_word_lte.p8:3484 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_431_else - ; source: test_word_lte.p8:3485 fail_word(240) - ldy #>$f0 - lda #<$f0 - jsr p8b_main.p8s_fail_word - bra label_asm_430_afterif -label_asm_431_else - ; source: test_word_lte.p8:3487 success++ - inc p8b_main.p8v_success -label_asm_430_afterif - ; source: test_word_lte.p8:3489 values[1]=1 - ldy #2 - lda #<1 - sta p8v_values,y - lda #>1 - sta p8v_values+1,y - ; source: test_word_lte.p8:3491 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_lte.p8:3493 goto skip46a - bra p8l_skip46a - ; source: test_word_lte.p8:3494 lbl46a: fail_word(241) -p8l_lbl46a - ldy #>$f1 - lda #<$f1 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3495 skip46a: -p8l_skip46a - ; source: test_word_lte.p8:3497 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3498 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3500 goto skip46b - bra p8l_skip46b - ; source: test_word_lte.p8:3501 lbl46b: fail_word(242) -p8l_lbl46b - ldy #>$f2 - lda #<$f2 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3502 skip46b: -p8l_skip46b - ; source: test_word_lte.p8:3504 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_432_afterif - ; source: test_word_lte.p8:3505 fail_word(243) - ldy #>$f3 - lda #<$f3 - jsr p8b_main.p8s_fail_word -label_asm_432_afterif - ; source: test_word_lte.p8:3508 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_434_else - ; source: test_word_lte.p8:3509 fail_word(244) - ldy #>$f4 - lda #<$f4 - jsr p8b_main.p8s_fail_word - bra label_asm_433_afterif -label_asm_434_else - ; source: test_word_lte.p8:3511 success++ - inc p8b_main.p8v_success -label_asm_433_afterif - ; source: test_word_lte.p8:3513 values[1]=170 - ldy #2 - lda #<$aa - sta p8v_values,y - lda #>$aa - sta p8v_values+1,y - ; source: test_word_lte.p8:3515 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_lte.p8:3517 goto skip47a - bra p8l_skip47a - ; source: test_word_lte.p8:3518 lbl47a: fail_word(245) -p8l_lbl47a - ldy #>$f5 - lda #<$f5 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3519 skip47a: -p8l_skip47a - ; source: test_word_lte.p8:3521 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3522 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3524 goto skip47b - bra p8l_skip47b - ; source: test_word_lte.p8:3525 lbl47b: fail_word(246) -p8l_lbl47b - ldy #>$f6 - lda #<$f6 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3526 skip47b: -p8l_skip47b - ; source: test_word_lte.p8:3528 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_435_afterif - ; source: test_word_lte.p8:3529 fail_word(247) - ldy #>$f7 - lda #<$f7 - jsr p8b_main.p8s_fail_word -label_asm_435_afterif - ; source: test_word_lte.p8:3532 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_437_else - ; source: test_word_lte.p8:3533 fail_word(248) - ldy #>$f8 - lda #<$f8 - jsr p8b_main.p8s_fail_word - bra label_asm_436_afterif -label_asm_437_else - ; source: test_word_lte.p8:3535 success++ - inc p8b_main.p8v_success -label_asm_436_afterif - ; source: test_word_lte.p8:3537 values[1]=30464 - ldy #2 - lda #<$7700 - sta p8v_values,y - lda #>$7700 - sta p8v_values+1,y - ; source: test_word_lte.p8:3539 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_lte.p8:3541 goto skip48a - bra p8l_skip48a - ; source: test_word_lte.p8:3542 lbl48a: fail_word(249) -p8l_lbl48a - ldy #>$f9 - lda #<$f9 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3543 skip48a: -p8l_skip48a - ; source: test_word_lte.p8:3545 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3546 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3548 goto skip48b - bra p8l_skip48b - ; source: test_word_lte.p8:3549 lbl48b: fail_word(250) -p8l_lbl48b - ldy #>$fa - lda #<$fa - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3550 skip48b: -p8l_skip48b - ; source: test_word_lte.p8:3552 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_438_afterif - ; source: test_word_lte.p8:3553 fail_word(251) - ldy #>$fb - lda #<$fb - jsr p8b_main.p8s_fail_word -label_asm_438_afterif - ; source: test_word_lte.p8:3556 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_440_else - ; source: test_word_lte.p8:3557 fail_word(252) - ldy #>$fc - lda #<$fc - jsr p8b_main.p8s_fail_word - bra label_asm_439_afterif -label_asm_440_else - ; source: test_word_lte.p8:3559 success++ - inc p8b_main.p8v_success -label_asm_439_afterif - ; source: test_word_lte.p8:3561 values[1]=32767 - ldy #2 - lda #<$7fff - sta p8v_values,y - lda #>$7fff - sta p8v_values+1,y - ; source: test_word_lte.p8:3563 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_lte.p8:3565 goto skip49a - bra p8l_skip49a - ; source: test_word_lte.p8:3566 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3567 skip49a: -p8l_skip49a - ; source: test_word_lte.p8:3569 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3570 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3572 goto skip49b - bra p8l_skip49b - ; source: test_word_lte.p8:3573 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3574 skip49b: -p8l_skip49b - ; source: test_word_lte.p8:3576 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_441_afterif - ; source: test_word_lte.p8:3577 success++ - inc p8b_main.p8v_success -label_asm_441_afterif - ; source: test_word_lte.p8:3580 if x<=values[1] - lda p8v_values+2 - ldy p8v_values+2+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_443_else - ; source: test_word_lte.p8:3581 success++ - inc p8b_main.p8v_success - bra label_asm_442_afterif -label_asm_443_else - ; source: test_word_lte.p8:3583 cx16.r0L++ - inc cx16.r0L -label_asm_442_afterif - ; source: test_word_lte.p8:3585 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_lte.p8:2398 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -p8v_values .sint $0000, $0000 - .pend - ; source: test_word_lte.p8:3587 sub test_cmp_expr() { - -p8s_test_cmp_expr .proc -; statements - ; source: test_word_lte.p8:3588 word @shared x - ; source: test_word_lte.p8:3591 float @shared f4 = 1.0 - ; source: test_word_lte.p8:3592 float @shared f5 = 1.0 - ; source: test_word_lte.p8:3588 word @shared x - stz p8v_x - stz p8v_x+1 - ; source: test_word_lte.p8:3589 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_lte.p8:3590 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_lte.p8:3591 float @shared f4 = 1.0 - lda #prog8_float_const_0 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #p8v_f4 - jsr floats.copy_float - ; source: test_word_lte.p8:3592 float @shared f5 = 1.0 - lda #p8v_f5 - jsr floats.copy_float - ; source: test_word_lte.p8:3593 success = 0 - stz p8b_main.p8v_success - ; source: test_word_lte.p8:3594 x=-21829 - lda #<-$5545 - ldy #>-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:3596 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_lte.p8:3598 goto skip1a - bra p8l_skip1a - ; source: test_word_lte.p8:3599 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3600 skip1a: -p8l_skip1a - ; source: test_word_lte.p8:3602 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3603 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3605 goto skip1b - bra p8l_skip1b - ; source: test_word_lte.p8:3606 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3607 skip1b: -p8l_skip1b - ; source: test_word_lte.p8:3609 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_444_afterif - ; source: test_word_lte.p8:3610 success++ - inc p8b_main.p8v_success -label_asm_444_afterif - ; source: test_word_lte.p8:3613 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_446_else - ; source: test_word_lte.p8:3614 success++ - inc p8b_main.p8v_success - bra label_asm_445_afterif -label_asm_446_else - ; source: test_word_lte.p8:3616 cx16.r0L++ - inc cx16.r0L -label_asm_445_afterif - ; source: test_word_lte.p8:3619 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_lte.p8:3621 goto skip2a - bra p8l_skip2a - ; source: test_word_lte.p8:3622 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3623 skip2a: -p8l_skip2a - ; source: test_word_lte.p8:3625 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3626 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3628 goto skip2b - bra p8l_skip2b - ; source: test_word_lte.p8:3629 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3630 skip2b: -p8l_skip2b - ; source: test_word_lte.p8:3632 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_447_afterif - ; source: test_word_lte.p8:3633 success++ - inc p8b_main.p8v_success -label_asm_447_afterif - ; source: test_word_lte.p8:3636 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_449_else - ; source: test_word_lte.p8:3637 success++ - inc p8b_main.p8v_success - bra label_asm_448_afterif -label_asm_449_else - ; source: test_word_lte.p8:3639 cx16.r0L++ - inc cx16.r0L -label_asm_448_afterif - ; source: test_word_lte.p8:3642 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_lte.p8:3644 goto skip3a - bra p8l_skip3a - ; source: test_word_lte.p8:3645 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3646 skip3a: -p8l_skip3a - ; source: test_word_lte.p8:3648 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3649 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3651 goto skip3b - bra p8l_skip3b - ; source: test_word_lte.p8:3652 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3653 skip3b: -p8l_skip3b - ; source: test_word_lte.p8:3655 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_450_afterif - ; source: test_word_lte.p8:3656 success++ - inc p8b_main.p8v_success -label_asm_450_afterif - ; source: test_word_lte.p8:3659 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_452_else - ; source: test_word_lte.p8:3660 success++ - inc p8b_main.p8v_success - bra label_asm_451_afterif -label_asm_452_else - ; source: test_word_lte.p8:3662 cx16.r0L++ - inc cx16.r0L -label_asm_451_afterif - ; source: test_word_lte.p8:3665 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_lte.p8:3667 goto skip4a - bra p8l_skip4a - ; source: test_word_lte.p8:3668 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3669 skip4a: -p8l_skip4a - ; source: test_word_lte.p8:3671 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3672 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3674 goto skip4b - bra p8l_skip4b - ; source: test_word_lte.p8:3675 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3676 skip4b: -p8l_skip4b - ; source: test_word_lte.p8:3678 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_453_afterif - ; source: test_word_lte.p8:3679 success++ - inc p8b_main.p8v_success -label_asm_453_afterif - ; source: test_word_lte.p8:3682 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_455_else - ; source: test_word_lte.p8:3683 success++ - inc p8b_main.p8v_success - bra label_asm_454_afterif -label_asm_455_else - ; source: test_word_lte.p8:3685 cx16.r0L++ - inc cx16.r0L -label_asm_454_afterif - ; source: test_word_lte.p8:3688 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_lte.p8:3690 goto skip5a - bra p8l_skip5a - ; source: test_word_lte.p8:3691 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3692 skip5a: -p8l_skip5a - ; source: test_word_lte.p8:3694 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3695 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3697 goto skip5b - bra p8l_skip5b - ; source: test_word_lte.p8:3698 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3699 skip5b: -p8l_skip5b - ; source: test_word_lte.p8:3701 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_456_afterif - ; source: test_word_lte.p8:3702 success++ - inc p8b_main.p8v_success -label_asm_456_afterif - ; source: test_word_lte.p8:3705 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_458_else - ; source: test_word_lte.p8:3706 success++ - inc p8b_main.p8v_success - bra label_asm_457_afterif -label_asm_458_else - ; source: test_word_lte.p8:3708 cx16.r0L++ - inc cx16.r0L -label_asm_457_afterif - ; source: test_word_lte.p8:3711 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_lte.p8:3713 goto skip6a - bra p8l_skip6a - ; source: test_word_lte.p8:3714 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3715 skip6a: -p8l_skip6a - ; source: test_word_lte.p8:3717 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3718 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3720 goto skip6b - bra p8l_skip6b - ; source: test_word_lte.p8:3721 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3722 skip6b: -p8l_skip6b - ; source: test_word_lte.p8:3724 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_459_afterif - ; source: test_word_lte.p8:3725 success++ - inc p8b_main.p8v_success -label_asm_459_afterif - ; source: test_word_lte.p8:3728 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_461_else - ; source: test_word_lte.p8:3729 success++ - inc p8b_main.p8v_success - bra label_asm_460_afterif -label_asm_461_else - ; source: test_word_lte.p8:3731 cx16.r0L++ - inc cx16.r0L -label_asm_460_afterif - ; source: test_word_lte.p8:3734 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_lte.p8:3736 goto skip7a - bra p8l_skip7a - ; source: test_word_lte.p8:3737 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3738 skip7a: -p8l_skip7a - ; source: test_word_lte.p8:3740 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3741 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3743 goto skip7b - bra p8l_skip7b - ; source: test_word_lte.p8:3744 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3745 skip7b: -p8l_skip7b - ; source: test_word_lte.p8:3747 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_462_afterif - ; source: test_word_lte.p8:3748 success++ - inc p8b_main.p8v_success -label_asm_462_afterif - ; source: test_word_lte.p8:3751 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_464_else - ; source: test_word_lte.p8:3752 success++ - inc p8b_main.p8v_success - bra label_asm_463_afterif -label_asm_464_else - ; source: test_word_lte.p8:3754 cx16.r0L++ - inc cx16.r0L -label_asm_463_afterif - ; source: test_word_lte.p8:3756 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:3758 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_lte.p8:3760 goto skip8a - bra p8l_skip8a - ; source: test_word_lte.p8:3761 lbl8a: fail_word(253) -p8l_lbl8a - ldy #>$fd - lda #<$fd - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3762 skip8a: -p8l_skip8a - ; source: test_word_lte.p8:3764 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3765 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3767 goto skip8b - bra p8l_skip8b - ; source: test_word_lte.p8:3768 lbl8b: fail_word(254) -p8l_lbl8b - ldy #>$fe - lda #<$fe - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3769 skip8b: -p8l_skip8b - ; source: test_word_lte.p8:3771 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_465_afterif - ; source: test_word_lte.p8:3772 fail_word(255) - ldy #>$ff - lda #<$ff - jsr p8b_main.p8s_fail_word -label_asm_465_afterif - ; source: test_word_lte.p8:3775 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_467_else - ; source: test_word_lte.p8:3776 fail_word(256) - ldy #>$0100 - lda #<$0100 - jsr p8b_main.p8s_fail_word - bra label_asm_466_afterif -label_asm_467_else - ; source: test_word_lte.p8:3778 success++ - inc p8b_main.p8v_success -label_asm_466_afterif - ; source: test_word_lte.p8:3781 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_lte.p8:3783 goto skip9a - bra p8l_skip9a - ; source: test_word_lte.p8:3784 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3785 skip9a: -p8l_skip9a - ; source: test_word_lte.p8:3787 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3788 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3790 goto skip9b - bra p8l_skip9b - ; source: test_word_lte.p8:3791 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3792 skip9b: -p8l_skip9b - ; source: test_word_lte.p8:3794 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_468_afterif - ; source: test_word_lte.p8:3795 success++ - inc p8b_main.p8v_success -label_asm_468_afterif - ; source: test_word_lte.p8:3798 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_470_else - ; source: test_word_lte.p8:3799 success++ - inc p8b_main.p8v_success - bra label_asm_469_afterif -label_asm_470_else - ; source: test_word_lte.p8:3801 cx16.r0L++ - inc cx16.r0L -label_asm_469_afterif - ; source: test_word_lte.p8:3804 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_lte.p8:3806 goto skip10a - bra p8l_skip10a - ; source: test_word_lte.p8:3807 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3808 skip10a: -p8l_skip10a - ; source: test_word_lte.p8:3810 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3811 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3813 goto skip10b - bra p8l_skip10b - ; source: test_word_lte.p8:3814 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3815 skip10b: -p8l_skip10b - ; source: test_word_lte.p8:3817 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_471_afterif - ; source: test_word_lte.p8:3818 success++ - inc p8b_main.p8v_success -label_asm_471_afterif - ; source: test_word_lte.p8:3821 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_473_else - ; source: test_word_lte.p8:3822 success++ - inc p8b_main.p8v_success - bra label_asm_472_afterif -label_asm_473_else - ; source: test_word_lte.p8:3824 cx16.r0L++ - inc cx16.r0L -label_asm_472_afterif - ; source: test_word_lte.p8:3827 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_lte.p8:3829 goto skip11a - bra p8l_skip11a - ; source: test_word_lte.p8:3830 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3831 skip11a: -p8l_skip11a - ; source: test_word_lte.p8:3833 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3834 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3836 goto skip11b - bra p8l_skip11b - ; source: test_word_lte.p8:3837 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3838 skip11b: -p8l_skip11b - ; source: test_word_lte.p8:3840 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_474_afterif - ; source: test_word_lte.p8:3841 success++ - inc p8b_main.p8v_success -label_asm_474_afterif - ; source: test_word_lte.p8:3844 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_476_else - ; source: test_word_lte.p8:3845 success++ - inc p8b_main.p8v_success - bra label_asm_475_afterif -label_asm_476_else - ; source: test_word_lte.p8:3847 cx16.r0L++ - inc cx16.r0L -label_asm_475_afterif - ; source: test_word_lte.p8:3850 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_lte.p8:3852 goto skip12a - bra p8l_skip12a - ; source: test_word_lte.p8:3853 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3854 skip12a: -p8l_skip12a - ; source: test_word_lte.p8:3856 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3857 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3859 goto skip12b - bra p8l_skip12b - ; source: test_word_lte.p8:3860 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3861 skip12b: -p8l_skip12b - ; source: test_word_lte.p8:3863 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_477_afterif - ; source: test_word_lte.p8:3864 success++ - inc p8b_main.p8v_success -label_asm_477_afterif - ; source: test_word_lte.p8:3867 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_479_else - ; source: test_word_lte.p8:3868 success++ - inc p8b_main.p8v_success - bra label_asm_478_afterif -label_asm_479_else - ; source: test_word_lte.p8:3870 cx16.r0L++ - inc cx16.r0L -label_asm_478_afterif - ; source: test_word_lte.p8:3873 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_lte.p8:3875 goto skip13a - bra p8l_skip13a - ; source: test_word_lte.p8:3876 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3877 skip13a: -p8l_skip13a - ; source: test_word_lte.p8:3879 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3880 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3882 goto skip13b - bra p8l_skip13b - ; source: test_word_lte.p8:3883 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3884 skip13b: -p8l_skip13b - ; source: test_word_lte.p8:3886 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_480_afterif - ; source: test_word_lte.p8:3887 success++ - inc p8b_main.p8v_success -label_asm_480_afterif - ; source: test_word_lte.p8:3890 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_482_else - ; source: test_word_lte.p8:3891 success++ - inc p8b_main.p8v_success - bra label_asm_481_afterif -label_asm_482_else - ; source: test_word_lte.p8:3893 cx16.r0L++ - inc cx16.r0L -label_asm_481_afterif - ; source: test_word_lte.p8:3896 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_lte.p8:3898 goto skip14a - bra p8l_skip14a - ; source: test_word_lte.p8:3899 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3900 skip14a: -p8l_skip14a - ; source: test_word_lte.p8:3902 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3903 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3905 goto skip14b - bra p8l_skip14b - ; source: test_word_lte.p8:3906 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3907 skip14b: -p8l_skip14b - ; source: test_word_lte.p8:3909 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_483_afterif - ; source: test_word_lte.p8:3910 success++ - inc p8b_main.p8v_success -label_asm_483_afterif - ; source: test_word_lte.p8:3913 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_485_else - ; source: test_word_lte.p8:3914 success++ - inc p8b_main.p8v_success - bra label_asm_484_afterif -label_asm_485_else - ; source: test_word_lte.p8:3916 cx16.r0L++ - inc cx16.r0L -label_asm_484_afterif - ; source: test_word_lte.p8:3918 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_lte.p8:3920 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_lte.p8:3922 goto skip15a - bra p8l_skip15a - ; source: test_word_lte.p8:3923 lbl15a: fail_word(257) -p8l_lbl15a - ldy #>$0101 - lda #<$0101 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3924 skip15a: -p8l_skip15a - ; source: test_word_lte.p8:3926 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3927 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3929 goto skip15b - bra p8l_skip15b - ; source: test_word_lte.p8:3930 lbl15b: fail_word(258) -p8l_lbl15b - ldy #>$0102 - lda #<$0102 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3931 skip15b: -p8l_skip15b - ; source: test_word_lte.p8:3933 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_486_afterif - ; source: test_word_lte.p8:3934 fail_word(259) - ldy #>$0103 - lda #<$0103 - jsr p8b_main.p8s_fail_word -label_asm_486_afterif - ; source: test_word_lte.p8:3937 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_488_else - ; source: test_word_lte.p8:3938 fail_word(260) - ldy #>$0104 - lda #<$0104 - jsr p8b_main.p8s_fail_word - bra label_asm_487_afterif -label_asm_488_else - ; source: test_word_lte.p8:3940 success++ - inc p8b_main.p8v_success -label_asm_487_afterif - ; source: test_word_lte.p8:3943 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_lte.p8:3945 goto skip16a - bra p8l_skip16a - ; source: test_word_lte.p8:3946 lbl16a: fail_word(261) -p8l_lbl16a - ldy #>$0105 - lda #<$0105 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3947 skip16a: -p8l_skip16a - ; source: test_word_lte.p8:3949 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3950 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3952 goto skip16b - bra p8l_skip16b - ; source: test_word_lte.p8:3953 lbl16b: fail_word(262) -p8l_lbl16b - ldy #>$0106 - lda #<$0106 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:3954 skip16b: -p8l_skip16b - ; source: test_word_lte.p8:3956 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_489_afterif - ; source: test_word_lte.p8:3957 fail_word(263) - ldy #>$0107 - lda #<$0107 - jsr p8b_main.p8s_fail_word -label_asm_489_afterif - ; source: test_word_lte.p8:3960 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_491_else - ; source: test_word_lte.p8:3961 fail_word(264) - ldy #>$0108 - lda #<$0108 - jsr p8b_main.p8s_fail_word - bra label_asm_490_afterif -label_asm_491_else - ; source: test_word_lte.p8:3963 success++ - inc p8b_main.p8v_success -label_asm_490_afterif - ; source: test_word_lte.p8:3966 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_lte.p8:3968 goto skip17a - bra p8l_skip17a - ; source: test_word_lte.p8:3969 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3970 skip17a: -p8l_skip17a - ; source: test_word_lte.p8:3972 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3973 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3975 goto skip17b - bra p8l_skip17b - ; source: test_word_lte.p8:3976 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3977 skip17b: -p8l_skip17b - ; source: test_word_lte.p8:3979 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_492_afterif - ; source: test_word_lte.p8:3980 success++ - inc p8b_main.p8v_success -label_asm_492_afterif - ; source: test_word_lte.p8:3983 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_494_else - ; source: test_word_lte.p8:3984 success++ - inc p8b_main.p8v_success - bra label_asm_493_afterif -label_asm_494_else - ; source: test_word_lte.p8:3986 cx16.r0L++ - inc cx16.r0L -label_asm_493_afterif - ; source: test_word_lte.p8:3989 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_lte.p8:3991 goto skip18a - bra p8l_skip18a - ; source: test_word_lte.p8:3992 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:3993 skip18a: -p8l_skip18a - ; source: test_word_lte.p8:3995 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:3996 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:3998 goto skip18b - bra p8l_skip18b - ; source: test_word_lte.p8:3999 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4000 skip18b: -p8l_skip18b - ; source: test_word_lte.p8:4002 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_495_afterif - ; source: test_word_lte.p8:4003 success++ - inc p8b_main.p8v_success -label_asm_495_afterif - ; source: test_word_lte.p8:4006 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_497_else - ; source: test_word_lte.p8:4007 success++ - inc p8b_main.p8v_success - bra label_asm_496_afterif -label_asm_497_else - ; source: test_word_lte.p8:4009 cx16.r0L++ - inc cx16.r0L -label_asm_496_afterif - ; source: test_word_lte.p8:4012 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_lte.p8:4014 goto skip19a - bra p8l_skip19a - ; source: test_word_lte.p8:4015 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4016 skip19a: -p8l_skip19a - ; source: test_word_lte.p8:4018 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4019 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4021 goto skip19b - bra p8l_skip19b - ; source: test_word_lte.p8:4022 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4023 skip19b: -p8l_skip19b - ; source: test_word_lte.p8:4025 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_498_afterif - ; source: test_word_lte.p8:4026 success++ - inc p8b_main.p8v_success -label_asm_498_afterif - ; source: test_word_lte.p8:4029 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_500_else - ; source: test_word_lte.p8:4030 success++ - inc p8b_main.p8v_success - bra label_asm_499_afterif -label_asm_500_else - ; source: test_word_lte.p8:4032 cx16.r0L++ - inc cx16.r0L -label_asm_499_afterif - ; source: test_word_lte.p8:4035 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_lte.p8:4037 goto skip20a - bra p8l_skip20a - ; source: test_word_lte.p8:4038 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4039 skip20a: -p8l_skip20a - ; source: test_word_lte.p8:4041 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4042 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4044 goto skip20b - bra p8l_skip20b - ; source: test_word_lte.p8:4045 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4046 skip20b: -p8l_skip20b - ; source: test_word_lte.p8:4048 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_501_afterif - ; source: test_word_lte.p8:4049 success++ - inc p8b_main.p8v_success -label_asm_501_afterif - ; source: test_word_lte.p8:4052 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_503_else - ; source: test_word_lte.p8:4053 success++ - inc p8b_main.p8v_success - bra label_asm_502_afterif -label_asm_503_else - ; source: test_word_lte.p8:4055 cx16.r0L++ - inc cx16.r0L -label_asm_502_afterif - ; source: test_word_lte.p8:4058 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_lte.p8:4060 goto skip21a - bra p8l_skip21a - ; source: test_word_lte.p8:4061 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4062 skip21a: -p8l_skip21a - ; source: test_word_lte.p8:4064 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4065 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4067 goto skip21b - bra p8l_skip21b - ; source: test_word_lte.p8:4068 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4069 skip21b: -p8l_skip21b - ; source: test_word_lte.p8:4071 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_504_afterif - ; source: test_word_lte.p8:4072 success++ - inc p8b_main.p8v_success -label_asm_504_afterif - ; source: test_word_lte.p8:4075 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_506_else - ; source: test_word_lte.p8:4076 success++ - inc p8b_main.p8v_success - bra label_asm_505_afterif -label_asm_506_else - ; source: test_word_lte.p8:4078 cx16.r0L++ - inc cx16.r0L -label_asm_505_afterif - ; source: test_word_lte.p8:4080 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:4082 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_lte.p8:4084 goto skip22a - bra p8l_skip22a - ; source: test_word_lte.p8:4085 lbl22a: fail_word(265) -p8l_lbl22a - ldy #>$0109 - lda #<$0109 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4086 skip22a: -p8l_skip22a - ; source: test_word_lte.p8:4088 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4089 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4091 goto skip22b - bra p8l_skip22b - ; source: test_word_lte.p8:4092 lbl22b: fail_word(266) -p8l_lbl22b - ldy #>$010a - lda #<$010a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4093 skip22b: -p8l_skip22b - ; source: test_word_lte.p8:4095 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_507_afterif - ; source: test_word_lte.p8:4096 fail_word(267) - ldy #>$010b - lda #<$010b - jsr p8b_main.p8s_fail_word -label_asm_507_afterif - ; source: test_word_lte.p8:4099 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_509_else - ; source: test_word_lte.p8:4100 fail_word(268) - ldy #>$010c - lda #<$010c - jsr p8b_main.p8s_fail_word - bra label_asm_508_afterif -label_asm_509_else - ; source: test_word_lte.p8:4102 success++ - inc p8b_main.p8v_success -label_asm_508_afterif - ; source: test_word_lte.p8:4105 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_lte.p8:4107 goto skip23a - bra p8l_skip23a - ; source: test_word_lte.p8:4108 lbl23a: fail_word(269) -p8l_lbl23a - ldy #>$010d - lda #<$010d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4109 skip23a: -p8l_skip23a - ; source: test_word_lte.p8:4111 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4112 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4114 goto skip23b - bra p8l_skip23b - ; source: test_word_lte.p8:4115 lbl23b: fail_word(270) -p8l_lbl23b - ldy #>$010e - lda #<$010e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4116 skip23b: -p8l_skip23b - ; source: test_word_lte.p8:4118 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_510_afterif - ; source: test_word_lte.p8:4119 fail_word(271) - ldy #>$010f - lda #<$010f - jsr p8b_main.p8s_fail_word -label_asm_510_afterif - ; source: test_word_lte.p8:4122 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_512_else - ; source: test_word_lte.p8:4123 fail_word(272) - ldy #>$0110 - lda #<$0110 - jsr p8b_main.p8s_fail_word - bra label_asm_511_afterif -label_asm_512_else - ; source: test_word_lte.p8:4125 success++ - inc p8b_main.p8v_success -label_asm_511_afterif - ; source: test_word_lte.p8:4128 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_lte.p8:4130 goto skip24a - bra p8l_skip24a - ; source: test_word_lte.p8:4131 lbl24a: fail_word(273) -p8l_lbl24a - ldy #>$0111 - lda #<$0111 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4132 skip24a: -p8l_skip24a - ; source: test_word_lte.p8:4134 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4135 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4137 goto skip24b - bra p8l_skip24b - ; source: test_word_lte.p8:4138 lbl24b: fail_word(274) -p8l_lbl24b - ldy #>$0112 - lda #<$0112 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4139 skip24b: -p8l_skip24b - ; source: test_word_lte.p8:4141 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_513_afterif - ; source: test_word_lte.p8:4142 fail_word(275) - ldy #>$0113 - lda #<$0113 - jsr p8b_main.p8s_fail_word -label_asm_513_afterif - ; source: test_word_lte.p8:4145 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_515_else - ; source: test_word_lte.p8:4146 fail_word(276) - ldy #>$0114 - lda #<$0114 - jsr p8b_main.p8s_fail_word - bra label_asm_514_afterif -label_asm_515_else - ; source: test_word_lte.p8:4148 success++ - inc p8b_main.p8v_success -label_asm_514_afterif - ; source: test_word_lte.p8:4151 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_lte.p8:4153 goto skip25a - bra p8l_skip25a - ; source: test_word_lte.p8:4154 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4155 skip25a: -p8l_skip25a - ; source: test_word_lte.p8:4157 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4158 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4160 goto skip25b - bra p8l_skip25b - ; source: test_word_lte.p8:4161 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4162 skip25b: -p8l_skip25b - ; source: test_word_lte.p8:4164 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_516_afterif - ; source: test_word_lte.p8:4165 success++ - inc p8b_main.p8v_success -label_asm_516_afterif - ; source: test_word_lte.p8:4168 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_518_else - ; source: test_word_lte.p8:4169 success++ - inc p8b_main.p8v_success - bra label_asm_517_afterif -label_asm_518_else - ; source: test_word_lte.p8:4171 cx16.r0L++ - inc cx16.r0L -label_asm_517_afterif - ; source: test_word_lte.p8:4174 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_lte.p8:4176 goto skip26a - bra p8l_skip26a - ; source: test_word_lte.p8:4177 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4178 skip26a: -p8l_skip26a - ; source: test_word_lte.p8:4180 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4181 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4183 goto skip26b - bra p8l_skip26b - ; source: test_word_lte.p8:4184 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4185 skip26b: -p8l_skip26b - ; source: test_word_lte.p8:4187 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_519_afterif - ; source: test_word_lte.p8:4188 success++ - inc p8b_main.p8v_success -label_asm_519_afterif - ; source: test_word_lte.p8:4191 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_521_else - ; source: test_word_lte.p8:4192 success++ - inc p8b_main.p8v_success - bra label_asm_520_afterif -label_asm_521_else - ; source: test_word_lte.p8:4194 cx16.r0L++ - inc cx16.r0L -label_asm_520_afterif - ; source: test_word_lte.p8:4197 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_lte.p8:4199 goto skip27a - bra p8l_skip27a - ; source: test_word_lte.p8:4200 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4201 skip27a: -p8l_skip27a - ; source: test_word_lte.p8:4203 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4204 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4206 goto skip27b - bra p8l_skip27b - ; source: test_word_lte.p8:4207 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4208 skip27b: -p8l_skip27b - ; source: test_word_lte.p8:4210 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_522_afterif - ; source: test_word_lte.p8:4211 success++ - inc p8b_main.p8v_success -label_asm_522_afterif - ; source: test_word_lte.p8:4214 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_524_else - ; source: test_word_lte.p8:4215 success++ - inc p8b_main.p8v_success - bra label_asm_523_afterif -label_asm_524_else - ; source: test_word_lte.p8:4217 cx16.r0L++ - inc cx16.r0L -label_asm_523_afterif - ; source: test_word_lte.p8:4220 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_lte.p8:4222 goto skip28a - bra p8l_skip28a - ; source: test_word_lte.p8:4223 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4224 skip28a: -p8l_skip28a - ; source: test_word_lte.p8:4226 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4227 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4229 goto skip28b - bra p8l_skip28b - ; source: test_word_lte.p8:4230 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4231 skip28b: -p8l_skip28b - ; source: test_word_lte.p8:4233 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_525_afterif - ; source: test_word_lte.p8:4234 success++ - inc p8b_main.p8v_success -label_asm_525_afterif - ; source: test_word_lte.p8:4237 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_527_else - ; source: test_word_lte.p8:4238 success++ - inc p8b_main.p8v_success - bra label_asm_526_afterif -label_asm_527_else - ; source: test_word_lte.p8:4240 cx16.r0L++ - inc cx16.r0L -label_asm_526_afterif - ; source: test_word_lte.p8:4242 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:4244 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_lte.p8:4246 goto skip29a - bra p8l_skip29a - ; source: test_word_lte.p8:4247 lbl29a: fail_word(277) -p8l_lbl29a - ldy #>$0115 - lda #<$0115 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4248 skip29a: -p8l_skip29a - ; source: test_word_lte.p8:4250 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4251 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4253 goto skip29b - bra p8l_skip29b - ; source: test_word_lte.p8:4254 lbl29b: fail_word(278) -p8l_lbl29b - ldy #>$0116 - lda #<$0116 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4255 skip29b: -p8l_skip29b - ; source: test_word_lte.p8:4257 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_528_afterif - ; source: test_word_lte.p8:4258 fail_word(279) - ldy #>$0117 - lda #<$0117 - jsr p8b_main.p8s_fail_word -label_asm_528_afterif - ; source: test_word_lte.p8:4261 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_530_else - ; source: test_word_lte.p8:4262 fail_word(280) - ldy #>$0118 - lda #<$0118 - jsr p8b_main.p8s_fail_word - bra label_asm_529_afterif -label_asm_530_else - ; source: test_word_lte.p8:4264 success++ - inc p8b_main.p8v_success -label_asm_529_afterif - ; source: test_word_lte.p8:4267 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_lte.p8:4269 goto skip30a - bra p8l_skip30a - ; source: test_word_lte.p8:4270 lbl30a: fail_word(281) -p8l_lbl30a - ldy #>$0119 - lda #<$0119 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4271 skip30a: -p8l_skip30a - ; source: test_word_lte.p8:4273 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4274 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4276 goto skip30b - bra p8l_skip30b - ; source: test_word_lte.p8:4277 lbl30b: fail_word(282) -p8l_lbl30b - ldy #>$011a - lda #<$011a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4278 skip30b: -p8l_skip30b - ; source: test_word_lte.p8:4280 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_531_afterif - ; source: test_word_lte.p8:4281 fail_word(283) - ldy #>$011b - lda #<$011b - jsr p8b_main.p8s_fail_word -label_asm_531_afterif - ; source: test_word_lte.p8:4284 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_533_else - ; source: test_word_lte.p8:4285 fail_word(284) - ldy #>$011c - lda #<$011c - jsr p8b_main.p8s_fail_word - bra label_asm_532_afterif -label_asm_533_else - ; source: test_word_lte.p8:4287 success++ - inc p8b_main.p8v_success -label_asm_532_afterif - ; source: test_word_lte.p8:4290 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_lte.p8:4292 goto skip31a - bra p8l_skip31a - ; source: test_word_lte.p8:4293 lbl31a: fail_word(285) -p8l_lbl31a - ldy #>$011d - lda #<$011d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4294 skip31a: -p8l_skip31a - ; source: test_word_lte.p8:4296 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4297 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4299 goto skip31b - bra p8l_skip31b - ; source: test_word_lte.p8:4300 lbl31b: fail_word(286) -p8l_lbl31b - ldy #>$011e - lda #<$011e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4301 skip31b: -p8l_skip31b - ; source: test_word_lte.p8:4303 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_534_afterif - ; source: test_word_lte.p8:4304 fail_word(287) - ldy #>$011f - lda #<$011f - jsr p8b_main.p8s_fail_word -label_asm_534_afterif - ; source: test_word_lte.p8:4307 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_536_else - ; source: test_word_lte.p8:4308 fail_word(288) - ldy #>$0120 - lda #<$0120 - jsr p8b_main.p8s_fail_word - bra label_asm_535_afterif -label_asm_536_else - ; source: test_word_lte.p8:4310 success++ - inc p8b_main.p8v_success -label_asm_535_afterif - ; source: test_word_lte.p8:4313 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_lte.p8:4315 goto skip32a - bra p8l_skip32a - ; source: test_word_lte.p8:4316 lbl32a: fail_word(289) -p8l_lbl32a - ldy #>$0121 - lda #<$0121 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4317 skip32a: -p8l_skip32a - ; source: test_word_lte.p8:4319 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4320 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4322 goto skip32b - bra p8l_skip32b - ; source: test_word_lte.p8:4323 lbl32b: fail_word(290) -p8l_lbl32b - ldy #>$0122 - lda #<$0122 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4324 skip32b: -p8l_skip32b - ; source: test_word_lte.p8:4326 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_537_afterif - ; source: test_word_lte.p8:4327 fail_word(291) - ldy #>$0123 - lda #<$0123 - jsr p8b_main.p8s_fail_word -label_asm_537_afterif - ; source: test_word_lte.p8:4330 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_539_else - ; source: test_word_lte.p8:4331 fail_word(292) - ldy #>$0124 - lda #<$0124 - jsr p8b_main.p8s_fail_word - bra label_asm_538_afterif -label_asm_539_else - ; source: test_word_lte.p8:4333 success++ - inc p8b_main.p8v_success -label_asm_538_afterif - ; source: test_word_lte.p8:4336 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_lte.p8:4338 goto skip33a - bra p8l_skip33a - ; source: test_word_lte.p8:4339 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4340 skip33a: -p8l_skip33a - ; source: test_word_lte.p8:4342 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4343 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4345 goto skip33b - bra p8l_skip33b - ; source: test_word_lte.p8:4346 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4347 skip33b: -p8l_skip33b - ; source: test_word_lte.p8:4349 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_540_afterif - ; source: test_word_lte.p8:4350 success++ - inc p8b_main.p8v_success -label_asm_540_afterif - ; source: test_word_lte.p8:4353 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_542_else - ; source: test_word_lte.p8:4354 success++ - inc p8b_main.p8v_success - bra label_asm_541_afterif -label_asm_542_else - ; source: test_word_lte.p8:4356 cx16.r0L++ - inc cx16.r0L -label_asm_541_afterif - ; source: test_word_lte.p8:4359 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_lte.p8:4361 goto skip34a - bra p8l_skip34a - ; source: test_word_lte.p8:4362 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4363 skip34a: -p8l_skip34a - ; source: test_word_lte.p8:4365 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4366 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4368 goto skip34b - bra p8l_skip34b - ; source: test_word_lte.p8:4369 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4370 skip34b: -p8l_skip34b - ; source: test_word_lte.p8:4372 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_543_afterif - ; source: test_word_lte.p8:4373 success++ - inc p8b_main.p8v_success -label_asm_543_afterif - ; source: test_word_lte.p8:4376 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_545_else - ; source: test_word_lte.p8:4377 success++ - inc p8b_main.p8v_success - bra label_asm_544_afterif -label_asm_545_else - ; source: test_word_lte.p8:4379 cx16.r0L++ - inc cx16.r0L -label_asm_544_afterif - ; source: test_word_lte.p8:4382 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_lte.p8:4384 goto skip35a - bra p8l_skip35a - ; source: test_word_lte.p8:4385 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4386 skip35a: -p8l_skip35a - ; source: test_word_lte.p8:4388 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4389 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4391 goto skip35b - bra p8l_skip35b - ; source: test_word_lte.p8:4392 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4393 skip35b: -p8l_skip35b - ; source: test_word_lte.p8:4395 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_546_afterif - ; source: test_word_lte.p8:4396 success++ - inc p8b_main.p8v_success -label_asm_546_afterif - ; source: test_word_lte.p8:4399 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_548_else - ; source: test_word_lte.p8:4400 success++ - inc p8b_main.p8v_success - bra label_asm_547_afterif -label_asm_548_else - ; source: test_word_lte.p8:4402 cx16.r0L++ - inc cx16.r0L -label_asm_547_afterif - ; source: test_word_lte.p8:4404 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:4406 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_lte.p8:4408 goto skip36a - bra p8l_skip36a - ; source: test_word_lte.p8:4409 lbl36a: fail_word(293) -p8l_lbl36a - ldy #>$0125 - lda #<$0125 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4410 skip36a: -p8l_skip36a - ; source: test_word_lte.p8:4412 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4413 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4415 goto skip36b - bra p8l_skip36b - ; source: test_word_lte.p8:4416 lbl36b: fail_word(294) -p8l_lbl36b - ldy #>$0126 - lda #<$0126 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4417 skip36b: -p8l_skip36b - ; source: test_word_lte.p8:4419 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_549_afterif - ; source: test_word_lte.p8:4420 fail_word(295) - ldy #>$0127 - lda #<$0127 - jsr p8b_main.p8s_fail_word -label_asm_549_afterif - ; source: test_word_lte.p8:4423 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_551_else - ; source: test_word_lte.p8:4424 fail_word(296) - ldy #>$0128 - lda #<$0128 - jsr p8b_main.p8s_fail_word - bra label_asm_550_afterif -label_asm_551_else - ; source: test_word_lte.p8:4426 success++ - inc p8b_main.p8v_success -label_asm_550_afterif - ; source: test_word_lte.p8:4429 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_lte.p8:4431 goto skip37a - bra p8l_skip37a - ; source: test_word_lte.p8:4432 lbl37a: fail_word(297) -p8l_lbl37a - ldy #>$0129 - lda #<$0129 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4433 skip37a: -p8l_skip37a - ; source: test_word_lte.p8:4435 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4436 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4438 goto skip37b - bra p8l_skip37b - ; source: test_word_lte.p8:4439 lbl37b: fail_word(298) -p8l_lbl37b - ldy #>$012a - lda #<$012a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4440 skip37b: -p8l_skip37b - ; source: test_word_lte.p8:4442 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_552_afterif - ; source: test_word_lte.p8:4443 fail_word(299) - ldy #>$012b - lda #<$012b - jsr p8b_main.p8s_fail_word -label_asm_552_afterif - ; source: test_word_lte.p8:4446 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_554_else - ; source: test_word_lte.p8:4447 fail_word(300) - ldy #>$012c - lda #<$012c - jsr p8b_main.p8s_fail_word - bra label_asm_553_afterif -label_asm_554_else - ; source: test_word_lte.p8:4449 success++ - inc p8b_main.p8v_success -label_asm_553_afterif - ; source: test_word_lte.p8:4452 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_lte.p8:4454 goto skip38a - bra p8l_skip38a - ; source: test_word_lte.p8:4455 lbl38a: fail_word(301) -p8l_lbl38a - ldy #>$012d - lda #<$012d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4456 skip38a: -p8l_skip38a - ; source: test_word_lte.p8:4458 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4459 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4461 goto skip38b - bra p8l_skip38b - ; source: test_word_lte.p8:4462 lbl38b: fail_word(302) -p8l_lbl38b - ldy #>$012e - lda #<$012e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4463 skip38b: -p8l_skip38b - ; source: test_word_lte.p8:4465 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_555_afterif - ; source: test_word_lte.p8:4466 fail_word(303) - ldy #>$012f - lda #<$012f - jsr p8b_main.p8s_fail_word -label_asm_555_afterif - ; source: test_word_lte.p8:4469 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_557_else - ; source: test_word_lte.p8:4470 fail_word(304) - ldy #>$0130 - lda #<$0130 - jsr p8b_main.p8s_fail_word - bra label_asm_556_afterif -label_asm_557_else - ; source: test_word_lte.p8:4472 success++ - inc p8b_main.p8v_success -label_asm_556_afterif - ; source: test_word_lte.p8:4475 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_lte.p8:4477 goto skip39a - bra p8l_skip39a - ; source: test_word_lte.p8:4478 lbl39a: fail_word(305) -p8l_lbl39a - ldy #>$0131 - lda #<$0131 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4479 skip39a: -p8l_skip39a - ; source: test_word_lte.p8:4481 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4482 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4484 goto skip39b - bra p8l_skip39b - ; source: test_word_lte.p8:4485 lbl39b: fail_word(306) -p8l_lbl39b - ldy #>$0132 - lda #<$0132 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4486 skip39b: -p8l_skip39b - ; source: test_word_lte.p8:4488 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_558_afterif - ; source: test_word_lte.p8:4489 fail_word(307) - ldy #>$0133 - lda #<$0133 - jsr p8b_main.p8s_fail_word -label_asm_558_afterif - ; source: test_word_lte.p8:4492 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_560_else - ; source: test_word_lte.p8:4493 fail_word(308) - ldy #>$0134 - lda #<$0134 - jsr p8b_main.p8s_fail_word - bra label_asm_559_afterif -label_asm_560_else - ; source: test_word_lte.p8:4495 success++ - inc p8b_main.p8v_success -label_asm_559_afterif - ; source: test_word_lte.p8:4498 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_lte.p8:4500 goto skip40a - bra p8l_skip40a - ; source: test_word_lte.p8:4501 lbl40a: fail_word(309) -p8l_lbl40a - ldy #>$0135 - lda #<$0135 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4502 skip40a: -p8l_skip40a - ; source: test_word_lte.p8:4504 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4505 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4507 goto skip40b - bra p8l_skip40b - ; source: test_word_lte.p8:4508 lbl40b: fail_word(310) -p8l_lbl40b - ldy #>$0136 - lda #<$0136 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4509 skip40b: -p8l_skip40b - ; source: test_word_lte.p8:4511 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_561_afterif - ; source: test_word_lte.p8:4512 fail_word(311) - ldy #>$0137 - lda #<$0137 - jsr p8b_main.p8s_fail_word -label_asm_561_afterif - ; source: test_word_lte.p8:4515 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_563_else - ; source: test_word_lte.p8:4516 fail_word(312) - ldy #>$0138 - lda #<$0138 - jsr p8b_main.p8s_fail_word - bra label_asm_562_afterif -label_asm_563_else - ; source: test_word_lte.p8:4518 success++ - inc p8b_main.p8v_success -label_asm_562_afterif - ; source: test_word_lte.p8:4521 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_lte.p8:4523 goto skip41a - bra p8l_skip41a - ; source: test_word_lte.p8:4524 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4525 skip41a: -p8l_skip41a - ; source: test_word_lte.p8:4527 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4528 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4530 goto skip41b - bra p8l_skip41b - ; source: test_word_lte.p8:4531 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4532 skip41b: -p8l_skip41b - ; source: test_word_lte.p8:4534 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_564_afterif - ; source: test_word_lte.p8:4535 success++ - inc p8b_main.p8v_success -label_asm_564_afterif - ; source: test_word_lte.p8:4538 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_566_else - ; source: test_word_lte.p8:4539 success++ - inc p8b_main.p8v_success - bra label_asm_565_afterif -label_asm_566_else - ; source: test_word_lte.p8:4541 cx16.r0L++ - inc cx16.r0L -label_asm_565_afterif - ; source: test_word_lte.p8:4544 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_lte.p8:4546 goto skip42a - bra p8l_skip42a - ; source: test_word_lte.p8:4547 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4548 skip42a: -p8l_skip42a - ; source: test_word_lte.p8:4550 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4551 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4553 goto skip42b - bra p8l_skip42b - ; source: test_word_lte.p8:4554 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4555 skip42b: -p8l_skip42b - ; source: test_word_lte.p8:4557 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_567_afterif - ; source: test_word_lte.p8:4558 success++ - inc p8b_main.p8v_success -label_asm_567_afterif - ; source: test_word_lte.p8:4561 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_569_else - ; source: test_word_lte.p8:4562 success++ - inc p8b_main.p8v_success - bra label_asm_568_afterif -label_asm_569_else - ; source: test_word_lte.p8:4564 cx16.r0L++ - inc cx16.r0L -label_asm_568_afterif - ; source: test_word_lte.p8:4566 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_lte.p8:4568 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_lte.p8:4570 goto skip43a - bra p8l_skip43a - ; source: test_word_lte.p8:4571 lbl43a: fail_word(313) -p8l_lbl43a - ldy #>$0139 - lda #<$0139 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4572 skip43a: -p8l_skip43a - ; source: test_word_lte.p8:4574 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4575 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4577 goto skip43b - bra p8l_skip43b - ; source: test_word_lte.p8:4578 lbl43b: fail_word(314) -p8l_lbl43b - ldy #>$013a - lda #<$013a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4579 skip43b: -p8l_skip43b - ; source: test_word_lte.p8:4581 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_570_afterif - ; source: test_word_lte.p8:4582 fail_word(315) - ldy #>$013b - lda #<$013b - jsr p8b_main.p8s_fail_word -label_asm_570_afterif - ; source: test_word_lte.p8:4585 if x<=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_572_else - ; source: test_word_lte.p8:4586 fail_word(316) - ldy #>$013c - lda #<$013c - jsr p8b_main.p8s_fail_word - bra label_asm_571_afterif -label_asm_572_else - ; source: test_word_lte.p8:4588 success++ - inc p8b_main.p8v_success -label_asm_571_afterif - ; source: test_word_lte.p8:4591 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_lte.p8:4593 goto skip44a - bra p8l_skip44a - ; source: test_word_lte.p8:4594 lbl44a: fail_word(317) -p8l_lbl44a - ldy #>$013d - lda #<$013d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4595 skip44a: -p8l_skip44a - ; source: test_word_lte.p8:4597 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4598 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4600 goto skip44b - bra p8l_skip44b - ; source: test_word_lte.p8:4601 lbl44b: fail_word(318) -p8l_lbl44b - ldy #>$013e - lda #<$013e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4602 skip44b: -p8l_skip44b - ; source: test_word_lte.p8:4604 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_573_afterif - ; source: test_word_lte.p8:4605 fail_word(319) - ldy #>$013f - lda #<$013f - jsr p8b_main.p8s_fail_word -label_asm_573_afterif - ; source: test_word_lte.p8:4608 if x<=cx16.r4s+-1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<1 - tax - tya - sbc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_575_else - ; source: test_word_lte.p8:4609 fail_word(320) - ldy #>$0140 - lda #<$0140 - jsr p8b_main.p8s_fail_word - bra label_asm_574_afterif -label_asm_575_else - ; source: test_word_lte.p8:4611 success++ - inc p8b_main.p8v_success -label_asm_574_afterif - ; source: test_word_lte.p8:4614 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_lte.p8:4616 goto skip45a - bra p8l_skip45a - ; source: test_word_lte.p8:4617 lbl45a: fail_word(321) -p8l_lbl45a - ldy #>$0141 - lda #<$0141 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4618 skip45a: -p8l_skip45a - ; source: test_word_lte.p8:4620 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4621 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4623 goto skip45b - bra p8l_skip45b - ; source: test_word_lte.p8:4624 lbl45b: fail_word(322) -p8l_lbl45b - ldy #>$0142 - lda #<$0142 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4625 skip45b: -p8l_skip45b - ; source: test_word_lte.p8:4627 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_576_afterif - ; source: test_word_lte.p8:4628 fail_word(323) - ldy #>$0143 - lda #<$0143 - jsr p8b_main.p8s_fail_word -label_asm_576_afterif - ; source: test_word_lte.p8:4631 if x<=cx16.r4s+0-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_578_else - ; source: test_word_lte.p8:4632 fail_word(324) - ldy #>$0144 - lda #<$0144 - jsr p8b_main.p8s_fail_word - bra label_asm_577_afterif -label_asm_578_else - ; source: test_word_lte.p8:4634 success++ - inc p8b_main.p8v_success -label_asm_577_afterif - ; source: test_word_lte.p8:4637 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_lte.p8:4639 goto skip46a - bra p8l_skip46a - ; source: test_word_lte.p8:4640 lbl46a: fail_word(325) -p8l_lbl46a - ldy #>$0145 - lda #<$0145 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4641 skip46a: -p8l_skip46a - ; source: test_word_lte.p8:4643 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4644 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4646 goto skip46b - bra p8l_skip46b - ; source: test_word_lte.p8:4647 lbl46b: fail_word(326) -p8l_lbl46b - ldy #>$0146 - lda #<$0146 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4648 skip46b: -p8l_skip46b - ; source: test_word_lte.p8:4650 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_579_afterif - ; source: test_word_lte.p8:4651 fail_word(327) - ldy #>$0147 - lda #<$0147 - jsr p8b_main.p8s_fail_word -label_asm_579_afterif - ; source: test_word_lte.p8:4654 if x<=cx16.r4s+1-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<1 - tax - tya - adc #>1 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_581_else - ; source: test_word_lte.p8:4655 fail_word(328) - ldy #>$0148 - lda #<$0148 - jsr p8b_main.p8s_fail_word - bra label_asm_580_afterif -label_asm_581_else - ; source: test_word_lte.p8:4657 success++ - inc p8b_main.p8v_success -label_asm_580_afterif - ; source: test_word_lte.p8:4660 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_lte.p8:4662 goto skip47a - bra p8l_skip47a - ; source: test_word_lte.p8:4663 lbl47a: fail_word(329) -p8l_lbl47a - ldy #>$0149 - lda #<$0149 - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4664 skip47a: -p8l_skip47a - ; source: test_word_lte.p8:4666 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4667 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4669 goto skip47b - bra p8l_skip47b - ; source: test_word_lte.p8:4670 lbl47b: fail_word(330) -p8l_lbl47b - ldy #>$014a - lda #<$014a - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4671 skip47b: -p8l_skip47b - ; source: test_word_lte.p8:4673 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_582_afterif - ; source: test_word_lte.p8:4674 fail_word(331) - ldy #>$014b - lda #<$014b - jsr p8b_main.p8s_fail_word -label_asm_582_afterif - ; source: test_word_lte.p8:4677 if x<=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_584_else - ; source: test_word_lte.p8:4678 fail_word(332) - ldy #>$014c - lda #<$014c - jsr p8b_main.p8s_fail_word - bra label_asm_583_afterif -label_asm_584_else - ; source: test_word_lte.p8:4680 success++ - inc p8b_main.p8v_success -label_asm_583_afterif - ; source: test_word_lte.p8:4683 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_lte.p8:4685 goto skip48a - bra p8l_skip48a - ; source: test_word_lte.p8:4686 lbl48a: fail_word(333) -p8l_lbl48a - ldy #>$014d - lda #<$014d - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4687 skip48a: -p8l_skip48a - ; source: test_word_lte.p8:4689 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4690 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4692 goto skip48b - bra p8l_skip48b - ; source: test_word_lte.p8:4693 lbl48b: fail_word(334) -p8l_lbl48b - ldy #>$014e - lda #<$014e - jsr p8b_main.p8s_fail_word - ; source: test_word_lte.p8:4694 skip48b: -p8l_skip48b - ; source: test_word_lte.p8:4696 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_585_afterif - ; source: test_word_lte.p8:4697 fail_word(335) - ldy #>$014f - lda #<$014f - jsr p8b_main.p8s_fail_word -label_asm_585_afterif - ; source: test_word_lte.p8:4700 if x<=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_587_else - ; source: test_word_lte.p8:4701 fail_word(336) - ldy #>$0150 - lda #<$0150 - jsr p8b_main.p8s_fail_word - bra label_asm_586_afterif -label_asm_587_else - ; source: test_word_lte.p8:4703 success++ - inc p8b_main.p8v_success -label_asm_586_afterif - ; source: test_word_lte.p8:4706 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_lte.p8:4708 goto skip49a - bra p8l_skip49a - ; source: test_word_lte.p8:4709 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4710 skip49a: -p8l_skip49a - ; source: test_word_lte.p8:4712 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_lte.p8:4713 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_lte.p8:4715 goto skip49b - bra p8l_skip49b - ; source: test_word_lte.p8:4716 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - ; source: test_word_lte.p8:4717 skip49b: -p8l_skip49b - ; source: test_word_lte.p8:4719 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_588_afterif - ; source: test_word_lte.p8:4720 success++ - inc p8b_main.p8v_success -label_asm_588_afterif - ; source: test_word_lte.p8:4723 if x<=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_590_else - ; source: test_word_lte.p8:4724 success++ - inc p8b_main.p8v_success - bra label_asm_589_afterif -label_asm_590_else - ; source: test_word_lte.p8:4726 cx16.r0L++ - inc cx16.r0L -label_asm_589_afterif - ; source: test_word_lte.p8:4728 verify_success(133) - lda #$85 - jmp p8b_main.p8s_verify_success - ; source: test_word_lte.p8:3587 sub test_cmp_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_f4 .fill 5 -p8v_f5 .fill 5 -p8v_x .sint ? - .send BSS - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $54, $45, $53, $54 - .byte $53, $20, $46, $4f, $52, $3a, $20, $00 -string_10 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"\n<=number: " - .byte $0d, $3c, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_3 ; PETSCII:"\n<=var: " - .byte $0d, $3c, $3d, $56, $41, $52, $3a, $20, $00 -string_4 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_5 ; PETSCII:"\n<=expr: " - .byte $0d, $3c, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_7 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_8 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_9 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 - - ; source: test_word_lte.p8:14 txt.print("\nless-equal tests for: ") - ; source: test_word_lte.p8:18 txt.print("\n<=number: ") - ; source: test_word_lte.p8:20 txt.print("\n<=var: ") - ; source: test_word_lte.p8:22 txt.print("\n<=array[]: ") - ; source: test_word_lte.p8:24 txt.print("\n<=expr: ") - ; source: test_word_lte.p8:33 txt.print(" **failed** ") - ; source: test_word_lte.p8:35 txt.print(" success, expected ") - ; source: test_word_lte.p8:41 txt.print(" **fail#") - ; source: test_word_lte.p8:43 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -prog8_float_const_0 .byte $81, $00, $00, $00, $00 ; float 1.0 -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_lte.p8 b/compiler/test/comparisons/test_word_lte.p8 deleted file mode 100644 index 102866f57..000000000 --- a/compiler/test/comparisons/test_word_lte.p8 +++ /dev/null @@ -1,4732 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\nless-equal tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=number: ") - test_cmp_number() - txt.print("\n<=var: ") - test_cmp_var() - txt.print("\n<=array[]: ") - test_cmp_array() - txt.print("\n<=expr: ") - test_cmp_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_byte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_ubyte(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_float(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_number() { - word @shared x - success = 0 - x=-21829 - ; direct jump - if x<=-21829 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=-21829 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=-21829 - success++ - - ; with else - if x<=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=-1 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=-1 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=-1 - success++ - - ; with else - if x<=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=0 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=0 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=1 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=170 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=170 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=170 - success++ - - ; with else - if x<=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=30464 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=32767 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=32767 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - x=-1 - ; direct jump - if x<=-21829 - goto lbl8a - goto skip8a -lbl8a: fail_word(1) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=-21829 - goto cx16.r3 - goto skip8b -lbl8b: fail_word(2) -skip8b: - ; no else - if x<=-21829 - fail_word(3) - - ; with else - if x<=-21829 - fail_word(4) - else - success++ - - ; direct jump - if x<=-1 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=-1 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=-1 - success++ - - ; with else - if x<=-1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=0 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=0 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=1 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=170 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=170 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=170 - success++ - - ; with else - if x<=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=30464 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=32767 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=32767 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x<=-21829 - goto lbl15a - goto skip15a -lbl15a: fail_word(5) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=-21829 - goto cx16.r3 - goto skip15b -lbl15b: fail_word(6) -skip15b: - ; no else - if x<=-21829 - fail_word(7) - - ; with else - if x<=-21829 - fail_word(8) - else - success++ - - ; direct jump - if x<=-1 - goto lbl16a - goto skip16a -lbl16a: fail_word(9) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=-1 - goto cx16.r3 - goto skip16b -lbl16b: fail_word(10) -skip16b: - ; no else - if x<=-1 - fail_word(11) - - ; with else - if x<=-1 - fail_word(12) - else - success++ - - ; direct jump - if x<=0 - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x<=0 - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x<=0 - success++ - - ; with else - if x<=0 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=1 - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x<=1 - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=170 - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x<=170 - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x<=170 - success++ - - ; with else - if x<=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x<=30464 - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=32767 - goto lbl21a - goto skip21a -lbl21a: success++ -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x<=32767 - goto cx16.r3 - goto skip21b -lbl21b: success++ -skip21b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=-21829 - goto lbl22a - goto skip22a -lbl22a: fail_word(13) -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x<=-21829 - goto cx16.r3 - goto skip22b -lbl22b: fail_word(14) -skip22b: - ; no else - if x<=-21829 - fail_word(15) - - ; with else - if x<=-21829 - fail_word(16) - else - success++ - - ; direct jump - if x<=-1 - goto lbl23a - goto skip23a -lbl23a: fail_word(17) -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x<=-1 - goto cx16.r3 - goto skip23b -lbl23b: fail_word(18) -skip23b: - ; no else - if x<=-1 - fail_word(19) - - ; with else - if x<=-1 - fail_word(20) - else - success++ - - ; direct jump - if x<=0 - goto lbl24a - goto skip24a -lbl24a: fail_word(21) -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x<=0 - goto cx16.r3 - goto skip24b -lbl24b: fail_word(22) -skip24b: - ; no else - if x<=0 - fail_word(23) - - ; with else - if x<=0 - fail_word(24) - else - success++ - - ; direct jump - if x<=1 - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x<=1 - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x<=1 - success++ - - ; with else - if x<=1 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=170 - goto lbl26a - goto skip26a -lbl26a: success++ -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x<=170 - goto cx16.r3 - goto skip26b -lbl26b: success++ -skip26b: - ; no else - if x<=170 - success++ - - ; with else - if x<=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl27a - goto skip27a -lbl27a: success++ -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x<=30464 - goto cx16.r3 - goto skip27b -lbl27b: success++ -skip27b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=32767 - goto lbl28a - goto skip28a -lbl28a: success++ -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x<=32767 - goto cx16.r3 - goto skip28b -lbl28b: success++ -skip28b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - x=170 - ; direct jump - if x<=-21829 - goto lbl29a - goto skip29a -lbl29a: fail_word(25) -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x<=-21829 - goto cx16.r3 - goto skip29b -lbl29b: fail_word(26) -skip29b: - ; no else - if x<=-21829 - fail_word(27) - - ; with else - if x<=-21829 - fail_word(28) - else - success++ - - ; direct jump - if x<=-1 - goto lbl30a - goto skip30a -lbl30a: fail_word(29) -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x<=-1 - goto cx16.r3 - goto skip30b -lbl30b: fail_word(30) -skip30b: - ; no else - if x<=-1 - fail_word(31) - - ; with else - if x<=-1 - fail_word(32) - else - success++ - - ; direct jump - if x<=0 - goto lbl31a - goto skip31a -lbl31a: fail_word(33) -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x<=0 - goto cx16.r3 - goto skip31b -lbl31b: fail_word(34) -skip31b: - ; no else - if x<=0 - fail_word(35) - - ; with else - if x<=0 - fail_word(36) - else - success++ - - ; direct jump - if x<=1 - goto lbl32a - goto skip32a -lbl32a: fail_word(37) -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x<=1 - goto cx16.r3 - goto skip32b -lbl32b: fail_word(38) -skip32b: - ; no else - if x<=1 - fail_word(39) - - ; with else - if x<=1 - fail_word(40) - else - success++ - - ; direct jump - if x<=170 - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x<=170 - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x<=170 - success++ - - ; with else - if x<=170 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=30464 - goto lbl34a - goto skip34a -lbl34a: success++ -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x<=30464 - goto cx16.r3 - goto skip34b -lbl34b: success++ -skip34b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=32767 - goto lbl35a - goto skip35a -lbl35a: success++ -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x<=32767 - goto cx16.r3 - goto skip35b -lbl35b: success++ -skip35b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x<=-21829 - goto lbl36a - goto skip36a -lbl36a: fail_word(41) -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x<=-21829 - goto cx16.r3 - goto skip36b -lbl36b: fail_word(42) -skip36b: - ; no else - if x<=-21829 - fail_word(43) - - ; with else - if x<=-21829 - fail_word(44) - else - success++ - - ; direct jump - if x<=-1 - goto lbl37a - goto skip37a -lbl37a: fail_word(45) -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x<=-1 - goto cx16.r3 - goto skip37b -lbl37b: fail_word(46) -skip37b: - ; no else - if x<=-1 - fail_word(47) - - ; with else - if x<=-1 - fail_word(48) - else - success++ - - ; direct jump - if x<=0 - goto lbl38a - goto skip38a -lbl38a: fail_word(49) -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x<=0 - goto cx16.r3 - goto skip38b -lbl38b: fail_word(50) -skip38b: - ; no else - if x<=0 - fail_word(51) - - ; with else - if x<=0 - fail_word(52) - else - success++ - - ; direct jump - if x<=1 - goto lbl39a - goto skip39a -lbl39a: fail_word(53) -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x<=1 - goto cx16.r3 - goto skip39b -lbl39b: fail_word(54) -skip39b: - ; no else - if x<=1 - fail_word(55) - - ; with else - if x<=1 - fail_word(56) - else - success++ - - ; direct jump - if x<=170 - goto lbl40a - goto skip40a -lbl40a: fail_word(57) -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x<=170 - goto cx16.r3 - goto skip40b -lbl40b: fail_word(58) -skip40b: - ; no else - if x<=170 - fail_word(59) - - ; with else - if x<=170 - fail_word(60) - else - success++ - - ; direct jump - if x<=30464 - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x<=30464 - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x<=30464 - success++ - - ; with else - if x<=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if x<=32767 - goto lbl42a - goto skip42a -lbl42a: success++ -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x<=32767 - goto cx16.r3 - goto skip42b -lbl42b: success++ -skip42b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - x=32767 - ; direct jump - if x<=-21829 - goto lbl43a - goto skip43a -lbl43a: fail_word(61) -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x<=-21829 - goto cx16.r3 - goto skip43b -lbl43b: fail_word(62) -skip43b: - ; no else - if x<=-21829 - fail_word(63) - - ; with else - if x<=-21829 - fail_word(64) - else - success++ - - ; direct jump - if x<=-1 - goto lbl44a - goto skip44a -lbl44a: fail_word(65) -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x<=-1 - goto cx16.r3 - goto skip44b -lbl44b: fail_word(66) -skip44b: - ; no else - if x<=-1 - fail_word(67) - - ; with else - if x<=-1 - fail_word(68) - else - success++ - - ; direct jump - if x<=0 - goto lbl45a - goto skip45a -lbl45a: fail_word(69) -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x<=0 - goto cx16.r3 - goto skip45b -lbl45b: fail_word(70) -skip45b: - ; no else - if x<=0 - fail_word(71) - - ; with else - if x<=0 - fail_word(72) - else - success++ - - ; direct jump - if x<=1 - goto lbl46a - goto skip46a -lbl46a: fail_word(73) -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x<=1 - goto cx16.r3 - goto skip46b -lbl46b: fail_word(74) -skip46b: - ; no else - if x<=1 - fail_word(75) - - ; with else - if x<=1 - fail_word(76) - else - success++ - - ; direct jump - if x<=170 - goto lbl47a - goto skip47a -lbl47a: fail_word(77) -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x<=170 - goto cx16.r3 - goto skip47b -lbl47b: fail_word(78) -skip47b: - ; no else - if x<=170 - fail_word(79) - - ; with else - if x<=170 - fail_word(80) - else - success++ - - ; direct jump - if x<=30464 - goto lbl48a - goto skip48a -lbl48a: fail_word(81) -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x<=30464 - goto cx16.r3 - goto skip48b -lbl48b: fail_word(82) -skip48b: - ; no else - if x<=30464 - fail_word(83) - - ; with else - if x<=30464 - fail_word(84) - else - success++ - - ; direct jump - if x<=32767 - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x<=32767 - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x<=32767 - success++ - - ; with else - if x<=32767 - success++ - else - cx16.r0L++ - - verify_success(133) -} - sub test_cmp_var() { - word @shared x, value - success = 0 - x=-21829 - value=-21829 - ; direct jump - if x<=value - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=value - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=-1 - ; direct jump - if x<=value - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=value - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x<=value - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=value - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=value - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x<=value - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=value - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=value - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x<=value - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=value - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=-1 - value=-21829 - ; direct jump - if x<=value - goto lbl8a - goto skip8a -lbl8a: fail_word(85) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=value - goto cx16.r3 - goto skip8b -lbl8b: fail_word(86) -skip8b: - ; no else - if x<=value - fail_word(87) - - ; with else - if x<=value - fail_word(88) - else - success++ - - value=-1 - ; direct jump - if x<=value - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=value - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=0 - ; direct jump - if x<=value - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=value - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=value - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x<=value - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=value - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=value - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x<=value - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=value - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=0 - value=-21829 - ; direct jump - if x<=value - goto lbl15a - goto skip15a -lbl15a: fail_word(89) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=value - goto cx16.r3 - goto skip15b -lbl15b: fail_word(90) -skip15b: - ; no else - if x<=value - fail_word(91) - - ; with else - if x<=value - fail_word(92) - else - success++ - - value=-1 - ; direct jump - if x<=value - goto lbl16a - goto skip16a -lbl16a: fail_word(93) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=value - goto cx16.r3 - goto skip16b -lbl16b: fail_word(94) -skip16b: - ; no else - if x<=value - fail_word(95) - - ; with else - if x<=value - fail_word(96) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x<=value - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=1 - ; direct jump - if x<=value - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x<=value - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x<=value - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x<=value - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x<=value - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x<=value - goto lbl21a - goto skip21a -lbl21a: success++ -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x<=value - goto cx16.r3 - goto skip21b -lbl21b: success++ -skip21b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=1 - value=-21829 - ; direct jump - if x<=value - goto lbl22a - goto skip22a -lbl22a: fail_word(97) -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x<=value - goto cx16.r3 - goto skip22b -lbl22b: fail_word(98) -skip22b: - ; no else - if x<=value - fail_word(99) - - ; with else - if x<=value - fail_word(100) - else - success++ - - value=-1 - ; direct jump - if x<=value - goto lbl23a - goto skip23a -lbl23a: fail_word(101) -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x<=value - goto cx16.r3 - goto skip23b -lbl23b: fail_word(102) -skip23b: - ; no else - if x<=value - fail_word(103) - - ; with else - if x<=value - fail_word(104) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl24a - goto skip24a -lbl24a: fail_word(105) -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x<=value - goto cx16.r3 - goto skip24b -lbl24b: fail_word(106) -skip24b: - ; no else - if x<=value - fail_word(107) - - ; with else - if x<=value - fail_word(108) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x<=value - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=170 - ; direct jump - if x<=value - goto lbl26a - goto skip26a -lbl26a: success++ -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x<=value - goto cx16.r3 - goto skip26b -lbl26b: success++ -skip26b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl27a - goto skip27a -lbl27a: success++ -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x<=value - goto cx16.r3 - goto skip27b -lbl27b: success++ -skip27b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x<=value - goto lbl28a - goto skip28a -lbl28a: success++ -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x<=value - goto cx16.r3 - goto skip28b -lbl28b: success++ -skip28b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=170 - value=-21829 - ; direct jump - if x<=value - goto lbl29a - goto skip29a -lbl29a: fail_word(109) -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x<=value - goto cx16.r3 - goto skip29b -lbl29b: fail_word(110) -skip29b: - ; no else - if x<=value - fail_word(111) - - ; with else - if x<=value - fail_word(112) - else - success++ - - value=-1 - ; direct jump - if x<=value - goto lbl30a - goto skip30a -lbl30a: fail_word(113) -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x<=value - goto cx16.r3 - goto skip30b -lbl30b: fail_word(114) -skip30b: - ; no else - if x<=value - fail_word(115) - - ; with else - if x<=value - fail_word(116) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl31a - goto skip31a -lbl31a: fail_word(117) -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x<=value - goto cx16.r3 - goto skip31b -lbl31b: fail_word(118) -skip31b: - ; no else - if x<=value - fail_word(119) - - ; with else - if x<=value - fail_word(120) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl32a - goto skip32a -lbl32a: fail_word(121) -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x<=value - goto cx16.r3 - goto skip32b -lbl32b: fail_word(122) -skip32b: - ; no else - if x<=value - fail_word(123) - - ; with else - if x<=value - fail_word(124) - else - success++ - - value=170 - ; direct jump - if x<=value - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x<=value - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=30464 - ; direct jump - if x<=value - goto lbl34a - goto skip34a -lbl34a: success++ -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x<=value - goto cx16.r3 - goto skip34b -lbl34b: success++ -skip34b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x<=value - goto lbl35a - goto skip35a -lbl35a: success++ -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x<=value - goto cx16.r3 - goto skip35b -lbl35b: success++ -skip35b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=30464 - value=-21829 - ; direct jump - if x<=value - goto lbl36a - goto skip36a -lbl36a: fail_word(125) -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x<=value - goto cx16.r3 - goto skip36b -lbl36b: fail_word(126) -skip36b: - ; no else - if x<=value - fail_word(127) - - ; with else - if x<=value - fail_word(128) - else - success++ - - value=-1 - ; direct jump - if x<=value - goto lbl37a - goto skip37a -lbl37a: fail_word(129) -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x<=value - goto cx16.r3 - goto skip37b -lbl37b: fail_word(130) -skip37b: - ; no else - if x<=value - fail_word(131) - - ; with else - if x<=value - fail_word(132) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl38a - goto skip38a -lbl38a: fail_word(133) -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x<=value - goto cx16.r3 - goto skip38b -lbl38b: fail_word(134) -skip38b: - ; no else - if x<=value - fail_word(135) - - ; with else - if x<=value - fail_word(136) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl39a - goto skip39a -lbl39a: fail_word(137) -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x<=value - goto cx16.r3 - goto skip39b -lbl39b: fail_word(138) -skip39b: - ; no else - if x<=value - fail_word(139) - - ; with else - if x<=value - fail_word(140) - else - success++ - - value=170 - ; direct jump - if x<=value - goto lbl40a - goto skip40a -lbl40a: fail_word(141) -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x<=value - goto cx16.r3 - goto skip40b -lbl40b: fail_word(142) -skip40b: - ; no else - if x<=value - fail_word(143) - - ; with else - if x<=value - fail_word(144) - else - success++ - - value=30464 - ; direct jump - if x<=value - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x<=value - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - value=32767 - ; direct jump - if x<=value - goto lbl42a - goto skip42a -lbl42a: success++ -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x<=value - goto cx16.r3 - goto skip42b -lbl42b: success++ -skip42b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - x=32767 - value=-21829 - ; direct jump - if x<=value - goto lbl43a - goto skip43a -lbl43a: fail_word(145) -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x<=value - goto cx16.r3 - goto skip43b -lbl43b: fail_word(146) -skip43b: - ; no else - if x<=value - fail_word(147) - - ; with else - if x<=value - fail_word(148) - else - success++ - - value=-1 - ; direct jump - if x<=value - goto lbl44a - goto skip44a -lbl44a: fail_word(149) -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x<=value - goto cx16.r3 - goto skip44b -lbl44b: fail_word(150) -skip44b: - ; no else - if x<=value - fail_word(151) - - ; with else - if x<=value - fail_word(152) - else - success++ - - value=0 - ; direct jump - if x<=value - goto lbl45a - goto skip45a -lbl45a: fail_word(153) -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x<=value - goto cx16.r3 - goto skip45b -lbl45b: fail_word(154) -skip45b: - ; no else - if x<=value - fail_word(155) - - ; with else - if x<=value - fail_word(156) - else - success++ - - value=1 - ; direct jump - if x<=value - goto lbl46a - goto skip46a -lbl46a: fail_word(157) -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x<=value - goto cx16.r3 - goto skip46b -lbl46b: fail_word(158) -skip46b: - ; no else - if x<=value - fail_word(159) - - ; with else - if x<=value - fail_word(160) - else - success++ - - value=170 - ; direct jump - if x<=value - goto lbl47a - goto skip47a -lbl47a: fail_word(161) -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x<=value - goto cx16.r3 - goto skip47b -lbl47b: fail_word(162) -skip47b: - ; no else - if x<=value - fail_word(163) - - ; with else - if x<=value - fail_word(164) - else - success++ - - value=30464 - ; direct jump - if x<=value - goto lbl48a - goto skip48a -lbl48a: fail_word(165) -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x<=value - goto cx16.r3 - goto skip48b -lbl48b: fail_word(166) -skip48b: - ; no else - if x<=value - fail_word(167) - - ; with else - if x<=value - fail_word(168) - else - success++ - - value=32767 - ; direct jump - if x<=value - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x<=value - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x<=value - success++ - - ; with else - if x<=value - success++ - else - cx16.r0L++ - - verify_success(133) -} - sub test_cmp_array() { - word @shared x - word[] values = [0, 0] - success = 0 - x=-21829 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=-1 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_word(169) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_word(170) -skip8b: - ; no else - if x<=values[1] - fail_word(171) - - ; with else - if x<=values[1] - fail_word(172) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=0 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_word(173) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_word(174) -skip15b: - ; no else - if x<=values[1] - fail_word(175) - - ; with else - if x<=values[1] - fail_word(176) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl16a - goto skip16a -lbl16a: fail_word(177) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_word(178) -skip16b: - ; no else - if x<=values[1] - fail_word(179) - - ; with else - if x<=values[1] - fail_word(180) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x<=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x<=values[1] - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x<=values[1] - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x<=values[1] - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl21a - goto skip21a -lbl21a: success++ -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x<=values[1] - goto cx16.r3 - goto skip21b -lbl21b: success++ -skip21b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=1 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl22a - goto skip22a -lbl22a: fail_word(181) -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x<=values[1] - goto cx16.r3 - goto skip22b -lbl22b: fail_word(182) -skip22b: - ; no else - if x<=values[1] - fail_word(183) - - ; with else - if x<=values[1] - fail_word(184) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl23a - goto skip23a -lbl23a: fail_word(185) -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x<=values[1] - goto cx16.r3 - goto skip23b -lbl23b: fail_word(186) -skip23b: - ; no else - if x<=values[1] - fail_word(187) - - ; with else - if x<=values[1] - fail_word(188) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl24a - goto skip24a -lbl24a: fail_word(189) -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x<=values[1] - goto cx16.r3 - goto skip24b -lbl24b: fail_word(190) -skip24b: - ; no else - if x<=values[1] - fail_word(191) - - ; with else - if x<=values[1] - fail_word(192) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x<=values[1] - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl26a - goto skip26a -lbl26a: success++ -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x<=values[1] - goto cx16.r3 - goto skip26b -lbl26b: success++ -skip26b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl27a - goto skip27a -lbl27a: success++ -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x<=values[1] - goto cx16.r3 - goto skip27b -lbl27b: success++ -skip27b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl28a - goto skip28a -lbl28a: success++ -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x<=values[1] - goto cx16.r3 - goto skip28b -lbl28b: success++ -skip28b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=170 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl29a - goto skip29a -lbl29a: fail_word(193) -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x<=values[1] - goto cx16.r3 - goto skip29b -lbl29b: fail_word(194) -skip29b: - ; no else - if x<=values[1] - fail_word(195) - - ; with else - if x<=values[1] - fail_word(196) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl30a - goto skip30a -lbl30a: fail_word(197) -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x<=values[1] - goto cx16.r3 - goto skip30b -lbl30b: fail_word(198) -skip30b: - ; no else - if x<=values[1] - fail_word(199) - - ; with else - if x<=values[1] - fail_word(200) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl31a - goto skip31a -lbl31a: fail_word(201) -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x<=values[1] - goto cx16.r3 - goto skip31b -lbl31b: fail_word(202) -skip31b: - ; no else - if x<=values[1] - fail_word(203) - - ; with else - if x<=values[1] - fail_word(204) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl32a - goto skip32a -lbl32a: fail_word(205) -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x<=values[1] - goto cx16.r3 - goto skip32b -lbl32b: fail_word(206) -skip32b: - ; no else - if x<=values[1] - fail_word(207) - - ; with else - if x<=values[1] - fail_word(208) - else - success++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x<=values[1] - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl34a - goto skip34a -lbl34a: success++ -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x<=values[1] - goto cx16.r3 - goto skip34b -lbl34b: success++ -skip34b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl35a - goto skip35a -lbl35a: success++ -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x<=values[1] - goto cx16.r3 - goto skip35b -lbl35b: success++ -skip35b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=30464 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl36a - goto skip36a -lbl36a: fail_word(209) -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x<=values[1] - goto cx16.r3 - goto skip36b -lbl36b: fail_word(210) -skip36b: - ; no else - if x<=values[1] - fail_word(211) - - ; with else - if x<=values[1] - fail_word(212) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl37a - goto skip37a -lbl37a: fail_word(213) -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x<=values[1] - goto cx16.r3 - goto skip37b -lbl37b: fail_word(214) -skip37b: - ; no else - if x<=values[1] - fail_word(215) - - ; with else - if x<=values[1] - fail_word(216) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl38a - goto skip38a -lbl38a: fail_word(217) -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x<=values[1] - goto cx16.r3 - goto skip38b -lbl38b: fail_word(218) -skip38b: - ; no else - if x<=values[1] - fail_word(219) - - ; with else - if x<=values[1] - fail_word(220) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl39a - goto skip39a -lbl39a: fail_word(221) -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x<=values[1] - goto cx16.r3 - goto skip39b -lbl39b: fail_word(222) -skip39b: - ; no else - if x<=values[1] - fail_word(223) - - ; with else - if x<=values[1] - fail_word(224) - else - success++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl40a - goto skip40a -lbl40a: fail_word(225) -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x<=values[1] - goto cx16.r3 - goto skip40b -lbl40b: fail_word(226) -skip40b: - ; no else - if x<=values[1] - fail_word(227) - - ; with else - if x<=values[1] - fail_word(228) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x<=values[1] - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl42a - goto skip42a -lbl42a: success++ -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x<=values[1] - goto cx16.r3 - goto skip42b -lbl42b: success++ -skip42b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - x=32767 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl43a - goto skip43a -lbl43a: fail_word(229) -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x<=values[1] - goto cx16.r3 - goto skip43b -lbl43b: fail_word(230) -skip43b: - ; no else - if x<=values[1] - fail_word(231) - - ; with else - if x<=values[1] - fail_word(232) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl44a - goto skip44a -lbl44a: fail_word(233) -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x<=values[1] - goto cx16.r3 - goto skip44b -lbl44b: fail_word(234) -skip44b: - ; no else - if x<=values[1] - fail_word(235) - - ; with else - if x<=values[1] - fail_word(236) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl45a - goto skip45a -lbl45a: fail_word(237) -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x<=values[1] - goto cx16.r3 - goto skip45b -lbl45b: fail_word(238) -skip45b: - ; no else - if x<=values[1] - fail_word(239) - - ; with else - if x<=values[1] - fail_word(240) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl46a - goto skip46a -lbl46a: fail_word(241) -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x<=values[1] - goto cx16.r3 - goto skip46b -lbl46b: fail_word(242) -skip46b: - ; no else - if x<=values[1] - fail_word(243) - - ; with else - if x<=values[1] - fail_word(244) - else - success++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl47a - goto skip47a -lbl47a: fail_word(245) -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x<=values[1] - goto cx16.r3 - goto skip47b -lbl47b: fail_word(246) -skip47b: - ; no else - if x<=values[1] - fail_word(247) - - ; with else - if x<=values[1] - fail_word(248) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl48a - goto skip48a -lbl48a: fail_word(249) -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x<=values[1] - goto cx16.r3 - goto skip48b -lbl48b: fail_word(250) -skip48b: - ; no else - if x<=values[1] - fail_word(251) - - ; with else - if x<=values[1] - fail_word(252) - else - success++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x<=values[1] - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - verify_success(133) -} - sub test_cmp_expr() { - word @shared x - cx16.r4 = 1 - cx16.r5 = 1 - float @shared f4 = 1.0 - float @shared f5 = 1.0 - success = 0 - x=-21829 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=-1 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: fail_word(253) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: fail_word(254) -skip8b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(255) - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(256) - else - success++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=0 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: fail_word(257) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: fail_word(258) -skip15b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(259) - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(260) - else - success++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: fail_word(261) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: fail_word(262) -skip16b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(263) - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(264) - else - success++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+0-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl21a - goto skip21a -lbl21a: success++ -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip21b -lbl21b: success++ -skip21b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=1 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl22a - goto skip22a -lbl22a: fail_word(265) -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip22b -lbl22b: fail_word(266) -skip22b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(267) - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(268) - else - success++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl23a - goto skip23a -lbl23a: fail_word(269) -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip23b -lbl23b: fail_word(270) -skip23b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(271) - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(272) - else - success++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl24a - goto skip24a -lbl24a: fail_word(273) -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip24b -lbl24b: fail_word(274) -skip24b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - fail_word(275) - - ; with else - if x<=cx16.r4s+0-cx16.r5s - fail_word(276) - else - success++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+1-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl26a - goto skip26a -lbl26a: success++ -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip26b -lbl26b: success++ -skip26b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl27a - goto skip27a -lbl27a: success++ -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip27b -lbl27b: success++ -skip27b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl28a - goto skip28a -lbl28a: success++ -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip28b -lbl28b: success++ -skip28b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=170 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl29a - goto skip29a -lbl29a: fail_word(277) -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip29b -lbl29b: fail_word(278) -skip29b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(279) - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(280) - else - success++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl30a - goto skip30a -lbl30a: fail_word(281) -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip30b -lbl30b: fail_word(282) -skip30b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(283) - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(284) - else - success++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl31a - goto skip31a -lbl31a: fail_word(285) -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip31b -lbl31b: fail_word(286) -skip31b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - fail_word(287) - - ; with else - if x<=cx16.r4s+0-cx16.r5s - fail_word(288) - else - success++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl32a - goto skip32a -lbl32a: fail_word(289) -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip32b -lbl32b: fail_word(290) -skip32b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - fail_word(291) - - ; with else - if x<=cx16.r4s+1-cx16.r5s - fail_word(292) - else - success++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl34a - goto skip34a -lbl34a: success++ -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip34b -lbl34b: success++ -skip34b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl35a - goto skip35a -lbl35a: success++ -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip35b -lbl35b: success++ -skip35b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=30464 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl36a - goto skip36a -lbl36a: fail_word(293) -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip36b -lbl36b: fail_word(294) -skip36b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(295) - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(296) - else - success++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl37a - goto skip37a -lbl37a: fail_word(297) -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip37b -lbl37b: fail_word(298) -skip37b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(299) - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(300) - else - success++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl38a - goto skip38a -lbl38a: fail_word(301) -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip38b -lbl38b: fail_word(302) -skip38b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - fail_word(303) - - ; with else - if x<=cx16.r4s+0-cx16.r5s - fail_word(304) - else - success++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl39a - goto skip39a -lbl39a: fail_word(305) -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip39b -lbl39b: fail_word(306) -skip39b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - fail_word(307) - - ; with else - if x<=cx16.r4s+1-cx16.r5s - fail_word(308) - else - success++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl40a - goto skip40a -lbl40a: fail_word(309) -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip40b -lbl40b: fail_word(310) -skip40b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - fail_word(311) - - ; with else - if x<=cx16.r4s+170-cx16.r5s - fail_word(312) - else - success++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl42a - goto skip42a -lbl42a: success++ -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip42b -lbl42b: success++ -skip42b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - x=32767 - ; direct jump - if x<=cx16.r4s+-21829-cx16.r5s - goto lbl43a - goto skip43a -lbl43a: fail_word(313) -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x<=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip43b -lbl43b: fail_word(314) -skip43b: - ; no else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(315) - - ; with else - if x<=cx16.r4s+-21829-cx16.r5s - fail_word(316) - else - success++ - - ; direct jump - if x<=cx16.r4s+-1-cx16.r5s - goto lbl44a - goto skip44a -lbl44a: fail_word(317) -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x<=cx16.r4s+-1-cx16.r5s - goto cx16.r3 - goto skip44b -lbl44b: fail_word(318) -skip44b: - ; no else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(319) - - ; with else - if x<=cx16.r4s+-1-cx16.r5s - fail_word(320) - else - success++ - - ; direct jump - if x<=cx16.r4s+0-cx16.r5s - goto lbl45a - goto skip45a -lbl45a: fail_word(321) -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x<=cx16.r4s+0-cx16.r5s - goto cx16.r3 - goto skip45b -lbl45b: fail_word(322) -skip45b: - ; no else - if x<=cx16.r4s+0-cx16.r5s - fail_word(323) - - ; with else - if x<=cx16.r4s+0-cx16.r5s - fail_word(324) - else - success++ - - ; direct jump - if x<=cx16.r4s+1-cx16.r5s - goto lbl46a - goto skip46a -lbl46a: fail_word(325) -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x<=cx16.r4s+1-cx16.r5s - goto cx16.r3 - goto skip46b -lbl46b: fail_word(326) -skip46b: - ; no else - if x<=cx16.r4s+1-cx16.r5s - fail_word(327) - - ; with else - if x<=cx16.r4s+1-cx16.r5s - fail_word(328) - else - success++ - - ; direct jump - if x<=cx16.r4s+170-cx16.r5s - goto lbl47a - goto skip47a -lbl47a: fail_word(329) -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x<=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip47b -lbl47b: fail_word(330) -skip47b: - ; no else - if x<=cx16.r4s+170-cx16.r5s - fail_word(331) - - ; with else - if x<=cx16.r4s+170-cx16.r5s - fail_word(332) - else - success++ - - ; direct jump - if x<=cx16.r4s+30464-cx16.r5s - goto lbl48a - goto skip48a -lbl48a: fail_word(333) -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x<=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip48b -lbl48b: fail_word(334) -skip48b: - ; no else - if x<=cx16.r4s+30464-cx16.r5s - fail_word(335) - - ; with else - if x<=cx16.r4s+30464-cx16.r5s - fail_word(336) - else - success++ - - ; direct jump - if x<=cx16.r4s+32767-cx16.r5s - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x<=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x<=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if x<=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - verify_success(133) -} - -} - diff --git a/compiler/test/comparisons/test_word_splitw_equalities.asm b/compiler/test/comparisons/test_word_splitw_equalities.asm deleted file mode 100644 index bc72a4ac3..000000000 --- a/compiler/test/comparisons/test_word_splitw_equalities.asm +++ /dev/null @@ -1,27682 +0,0 @@ -; w65c02 assembly code for 'test_word_splitw_equalities' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:50 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_splitw_equalities.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .byte ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_splitw_equalities.p8:9 ubyte success = 0 - ; source: test_word_splitw_equalities.p8:10 str datatype = "word" - ; source: test_word_splitw_equalities.p8:11 uword @shared comparison - ; source: test_word_splitw_equalities.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_splitw_equalities.p8:14 txt.print("\n(in)equality tests for split words datatype: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_3 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #prog8_interned_strings.string_8 - lda #prog8_interned_strings.string_9 - lda #prog8_interned_strings.string_10 - lda #prog8_interned_strings.string_11 - lda #prog8_interned_strings.string_13 - lda #prog8_interned_strings.string_14 - lda #prog8_interned_strings.string_15 - lda #prog8_interned_strings.string_16 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:83 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:85 goto skip2 - bra p8l_skip2 - ; source: test_word_splitw_equalities.p8:86 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:87 skip2: -p8l_skip2 - ; source: test_word_splitw_equalities.p8:89 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_3_afterif - ; source: test_word_splitw_equalities.p8:90 success++ - inc p8b_main.p8v_success -label_asm_3_afterif - ; source: test_word_splitw_equalities.p8:93 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_5_else - ; source: test_word_splitw_equalities.p8:94 success++ - inc p8b_main.p8v_success - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_splitw_equalities.p8:96 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_word_splitw_equalities.p8:98 sources[1] = -9999 - ldy #1 - lda #<-$270f - sta p8v_sources_lsb,y - lda #>-$270f - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:100 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq p8l_skip3 - ; source: test_word_splitw_equalities.p8:102 success++ - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:103 skip3: -p8l_skip3 - ; source: test_word_splitw_equalities.p8:105 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:106 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:108 success++ - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:109 skip4: -p8l_skip4 - ; source: test_word_splitw_equalities.p8:111 success++ - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:112 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_6_afterif - ; source: test_word_splitw_equalities.p8:113 success-- - dec p8b_main.p8v_success -label_asm_6_afterif - ; source: test_word_splitw_equalities.p8:116 if sources[1]==0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne label_asm_8_else - ; source: test_word_splitw_equalities.p8:117 cx16.r0L++ - inc cx16.r0L - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_splitw_equalities.p8:119 success++ - inc p8b_main.p8v_success -label_asm_7_afterif - ; source: test_word_splitw_equalities.p8:121 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:70 sub test_is_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_word_splitw_equalities.p8:125 sub test_not_zero() { - -p8s_test_not_zero .proc -; statements - ; source: test_word_splitw_equalities.p8:126 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:127 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:129 sources[1]=-9999 - ldy #1 - lda #<-$270f - sta p8v_sources_lsb,y - lda #>-$270f - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:131 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne p8l_lbl1 - ; source: test_word_splitw_equalities.p8:133 goto skip1 - bra p8l_skip1 - ; source: test_word_splitw_equalities.p8:134 lbl1: success++ -p8l_lbl1 - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:135 skip1: -p8l_skip1 - ; source: test_word_splitw_equalities.p8:137 cx16.r3 = &lbl2 - lda #p8l_lbl2 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:138 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:140 goto skip2 - bra p8l_skip2 - ; source: test_word_splitw_equalities.p8:141 lbl2: success++ -p8l_lbl2 - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:142 skip2: -p8l_skip2 - ; source: test_word_splitw_equalities.p8:144 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_9_afterif - ; source: test_word_splitw_equalities.p8:145 success++ - inc p8b_main.p8v_success -label_asm_9_afterif - ; source: test_word_splitw_equalities.p8:148 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_11_else - ; source: test_word_splitw_equalities.p8:149 success++ - inc p8b_main.p8v_success - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_splitw_equalities.p8:151 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_word_splitw_equalities.p8:153 sources[1] = 0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:155 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - bne p8l_skip3 - ; source: test_word_splitw_equalities.p8:157 success++ - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:158 skip3: -p8l_skip3 - ; source: test_word_splitw_equalities.p8:160 cx16.r3 = &skip4 - lda #p8l_skip4 - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:161 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:163 success++ - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:164 skip4: -p8l_skip4 - ; source: test_word_splitw_equalities.p8:166 success++ - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:167 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_12_afterif - ; source: test_word_splitw_equalities.p8:168 success-- - dec p8b_main.p8v_success -label_asm_12_afterif - ; source: test_word_splitw_equalities.p8:171 if sources[1]!=0 - lda p8v_sources_lsb+1 - ora p8v_sources_msb+1 - beq label_asm_14_else - ; source: test_word_splitw_equalities.p8:172 cx16.r0L++ - inc cx16.r0L - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_splitw_equalities.p8:174 success++ - inc p8b_main.p8v_success -label_asm_13_afterif - ; source: test_word_splitw_equalities.p8:176 verify_success(8) - lda #8 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:125 sub test_not_zero() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_word_splitw_equalities.p8:179 sub test_is_number() { - -p8s_test_is_number .proc -; statements - ; source: test_word_splitw_equalities.p8:180 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:181 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:182 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:184 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1a -+ - ; source: test_word_splitw_equalities.p8:186 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:187 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:188 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:190 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:191 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:193 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:194 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:195 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:197 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_15_afterif - cpy p8v_sources_msb+1 - bne label_asm_15_afterif - ; source: test_word_splitw_equalities.p8:198 success++ - inc p8b_main.p8v_success -label_asm_15_afterif - ; source: test_word_splitw_equalities.p8:201 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_17_else - cpy p8v_sources_msb+1 - bne label_asm_17_else - ; source: test_word_splitw_equalities.p8:202 success++ - inc p8b_main.p8v_success - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_splitw_equalities.p8:204 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_word_splitw_equalities.p8:207 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2a -+ - ; source: test_word_splitw_equalities.p8:209 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:210 lbl2a: fail_word(1,-21829) -p8l_lbl2a - lda #<1 - ldy #>1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:211 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:213 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:214 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:216 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:217 lbl2b: fail_word(2,-21829) -p8l_lbl2b - lda #<2 - ldy #>2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:218 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:220 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_18_afterif - cpy p8v_sources_msb+1 - bne label_asm_18_afterif - ; source: test_word_splitw_equalities.p8:221 fail_word(3,-21829) - lda #<3 - ldy #>3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_18_afterif - ; source: test_word_splitw_equalities.p8:224 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_20_else - cpy p8v_sources_msb+1 - bne label_asm_20_else - ; source: test_word_splitw_equalities.p8:225 fail_word(4,-21829) - lda #<4 - ldy #>4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_splitw_equalities.p8:227 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_word_splitw_equalities.p8:230 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3a -+ - ; source: test_word_splitw_equalities.p8:232 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:233 lbl3a: fail_word(5,-21829) -p8l_lbl3a - lda #<5 - ldy #>5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:234 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:236 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:237 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:239 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:240 lbl3b: fail_word(6,-21829) -p8l_lbl3b - lda #<6 - ldy #>6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:241 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:243 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_21_afterif - cpy p8v_sources_msb+1 - bne label_asm_21_afterif - ; source: test_word_splitw_equalities.p8:244 fail_word(7,-21829) - lda #<7 - ldy #>7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_21_afterif - ; source: test_word_splitw_equalities.p8:247 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_23_else - cpy p8v_sources_msb+1 - bne label_asm_23_else - ; source: test_word_splitw_equalities.p8:248 fail_word(8,-21829) - lda #<8 - ldy #>8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_splitw_equalities.p8:250 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_word_splitw_equalities.p8:253 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4a -+ - ; source: test_word_splitw_equalities.p8:255 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:256 lbl4a: fail_word(9,-21829) -p8l_lbl4a - lda #<9 - ldy #>9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:257 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:259 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:260 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:262 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:263 lbl4b: fail_word(10,-21829) -p8l_lbl4b - lda #<10 - ldy #>10 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:264 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:266 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_24_afterif - cpy p8v_sources_msb+1 - bne label_asm_24_afterif - ; source: test_word_splitw_equalities.p8:267 fail_word(11,-21829) - lda #<11 - ldy #>11 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_24_afterif - ; source: test_word_splitw_equalities.p8:270 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_26_else - cpy p8v_sources_msb+1 - bne label_asm_26_else - ; source: test_word_splitw_equalities.p8:271 fail_word(12,-21829) - lda #<12 - ldy #>12 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_splitw_equalities.p8:273 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_word_splitw_equalities.p8:275 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:277 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5a -+ - ; source: test_word_splitw_equalities.p8:279 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:280 lbl5a: fail_word(13,0) -p8l_lbl5a - lda #<13 - ldy #>13 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:281 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:283 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:284 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:286 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:287 lbl5b: fail_word(14,0) -p8l_lbl5b - lda #<14 - ldy #>14 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:288 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:290 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_27_afterif - cpy p8v_sources_msb+1 - bne label_asm_27_afterif - ; source: test_word_splitw_equalities.p8:291 fail_word(15,0) - lda #<15 - ldy #>15 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_27_afterif - ; source: test_word_splitw_equalities.p8:294 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_29_else - cpy p8v_sources_msb+1 - bne label_asm_29_else - ; source: test_word_splitw_equalities.p8:295 fail_word(16,0) - lda #<$10 - ldy #>$10 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_splitw_equalities.p8:297 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_word_splitw_equalities.p8:300 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6a -+ - ; source: test_word_splitw_equalities.p8:302 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:303 lbl6a: fail_word(17,0) -p8l_lbl6a - lda #<$11 - ldy #>$11 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:304 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:306 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:307 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:309 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:310 lbl6b: fail_word(18,0) -p8l_lbl6b - lda #<$12 - ldy #>$12 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:311 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:313 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_30_afterif - cpy p8v_sources_msb+1 - bne label_asm_30_afterif - ; source: test_word_splitw_equalities.p8:314 fail_word(19,0) - lda #<$13 - ldy #>$13 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_30_afterif - ; source: test_word_splitw_equalities.p8:317 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_32_else - cpy p8v_sources_msb+1 - bne label_asm_32_else - ; source: test_word_splitw_equalities.p8:318 fail_word(20,0) - lda #<$14 - ldy #>$14 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_splitw_equalities.p8:320 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_word_splitw_equalities.p8:323 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7a -+ - ; source: test_word_splitw_equalities.p8:325 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:326 lbl7a: fail_word(21,0) -p8l_lbl7a - lda #<$15 - ldy #>$15 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:327 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:329 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:330 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:332 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:333 lbl7b: fail_word(22,0) -p8l_lbl7b - lda #<$16 - ldy #>$16 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:334 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:336 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_33_afterif - cpy p8v_sources_msb+1 - bne label_asm_33_afterif - ; source: test_word_splitw_equalities.p8:337 fail_word(23,0) - lda #<$17 - ldy #>$17 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_33_afterif - ; source: test_word_splitw_equalities.p8:340 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_35_else - cpy p8v_sources_msb+1 - bne label_asm_35_else - ; source: test_word_splitw_equalities.p8:341 fail_word(24,0) - lda #<$18 - ldy #>$18 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_splitw_equalities.p8:343 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_word_splitw_equalities.p8:346 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8a -+ - ; source: test_word_splitw_equalities.p8:348 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:349 lbl8a: fail_word(25,0) -p8l_lbl8a - lda #<$19 - ldy #>$19 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:350 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:352 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:353 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:355 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:356 lbl8b: fail_word(26,0) -p8l_lbl8b - lda #<$1a - ldy #>$1a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:357 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:359 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_36_afterif - cpy p8v_sources_msb+1 - bne label_asm_36_afterif - ; source: test_word_splitw_equalities.p8:360 fail_word(27,0) - lda #<$1b - ldy #>$1b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_36_afterif - ; source: test_word_splitw_equalities.p8:363 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_38_else - cpy p8v_sources_msb+1 - bne label_asm_38_else - ; source: test_word_splitw_equalities.p8:364 fail_word(28,0) - lda #<$1c - ldy #>$1c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_splitw_equalities.p8:366 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_word_splitw_equalities.p8:368 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:370 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9a -+ - ; source: test_word_splitw_equalities.p8:372 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:373 lbl9a: fail_word(29,170) -p8l_lbl9a - lda #<$1d - ldy #>$1d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:374 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:376 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:377 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:379 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:380 lbl9b: fail_word(30,170) -p8l_lbl9b - lda #<$1e - ldy #>$1e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:381 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:383 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_39_afterif - cpy p8v_sources_msb+1 - bne label_asm_39_afterif - ; source: test_word_splitw_equalities.p8:384 fail_word(31,170) - lda #<$1f - ldy #>$1f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_39_afterif - ; source: test_word_splitw_equalities.p8:387 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_41_else - cpy p8v_sources_msb+1 - bne label_asm_41_else - ; source: test_word_splitw_equalities.p8:388 fail_word(32,170) - lda #<$20 - ldy #>$20 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_splitw_equalities.p8:390 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_word_splitw_equalities.p8:393 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10a -+ - ; source: test_word_splitw_equalities.p8:395 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:396 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:397 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:399 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:400 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:402 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:403 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:404 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:406 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_42_afterif - cpy p8v_sources_msb+1 - bne label_asm_42_afterif - ; source: test_word_splitw_equalities.p8:407 success++ - inc p8b_main.p8v_success -label_asm_42_afterif - ; source: test_word_splitw_equalities.p8:410 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_44_else - cpy p8v_sources_msb+1 - bne label_asm_44_else - ; source: test_word_splitw_equalities.p8:411 success++ - inc p8b_main.p8v_success - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_splitw_equalities.p8:413 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_word_splitw_equalities.p8:416 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11a -+ - ; source: test_word_splitw_equalities.p8:418 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:419 lbl11a: fail_word(33,170) -p8l_lbl11a - lda #<$21 - ldy #>$21 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:420 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:422 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:423 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:425 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:426 lbl11b: fail_word(34,170) -p8l_lbl11b - lda #<$22 - ldy #>$22 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:427 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:429 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_45_afterif - cpy p8v_sources_msb+1 - bne label_asm_45_afterif - ; source: test_word_splitw_equalities.p8:430 fail_word(35,170) - lda #<$23 - ldy #>$23 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_45_afterif - ; source: test_word_splitw_equalities.p8:433 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_47_else - cpy p8v_sources_msb+1 - bne label_asm_47_else - ; source: test_word_splitw_equalities.p8:434 fail_word(36,170) - lda #<$24 - ldy #>$24 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_splitw_equalities.p8:436 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_word_splitw_equalities.p8:439 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12a -+ - ; source: test_word_splitw_equalities.p8:441 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:442 lbl12a: fail_word(37,170) -p8l_lbl12a - lda #<$25 - ldy #>$25 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:443 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:445 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:446 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:448 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:449 lbl12b: fail_word(38,170) -p8l_lbl12b - lda #<$26 - ldy #>$26 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:450 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:452 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_48_afterif - cpy p8v_sources_msb+1 - bne label_asm_48_afterif - ; source: test_word_splitw_equalities.p8:453 fail_word(39,170) - lda #<$27 - ldy #>$27 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_48_afterif - ; source: test_word_splitw_equalities.p8:456 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_50_else - cpy p8v_sources_msb+1 - bne label_asm_50_else - ; source: test_word_splitw_equalities.p8:457 fail_word(40,170) - lda #<$28 - ldy #>$28 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_splitw_equalities.p8:459 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_word_splitw_equalities.p8:461 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:463 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl13a -+ - ; source: test_word_splitw_equalities.p8:465 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:466 lbl13a: fail_word(41,30464) -p8l_lbl13a - lda #<$29 - ldy #>$29 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:467 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:469 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:470 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:472 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:473 lbl13b: fail_word(42,30464) -p8l_lbl13b - lda #<$2a - ldy #>$2a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:474 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:476 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_51_afterif - cpy p8v_sources_msb+1 - bne label_asm_51_afterif - ; source: test_word_splitw_equalities.p8:477 fail_word(43,30464) - lda #<$2b - ldy #>$2b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_51_afterif - ; source: test_word_splitw_equalities.p8:480 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_53_else - cpy p8v_sources_msb+1 - bne label_asm_53_else - ; source: test_word_splitw_equalities.p8:481 fail_word(44,30464) - lda #<$2c - ldy #>$2c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_splitw_equalities.p8:483 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_word_splitw_equalities.p8:486 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl14a -+ - ; source: test_word_splitw_equalities.p8:488 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:489 lbl14a: fail_word(45,30464) -p8l_lbl14a - lda #<$2d - ldy #>$2d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:490 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:492 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:493 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:495 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:496 lbl14b: fail_word(46,30464) -p8l_lbl14b - lda #<$2e - ldy #>$2e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:497 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:499 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_54_afterif - cpy p8v_sources_msb+1 - bne label_asm_54_afterif - ; source: test_word_splitw_equalities.p8:500 fail_word(47,30464) - lda #<$2f - ldy #>$2f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_54_afterif - ; source: test_word_splitw_equalities.p8:503 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_56_else - cpy p8v_sources_msb+1 - bne label_asm_56_else - ; source: test_word_splitw_equalities.p8:504 fail_word(48,30464) - lda #<$30 - ldy #>$30 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_splitw_equalities.p8:506 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_word_splitw_equalities.p8:509 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl15a -+ - ; source: test_word_splitw_equalities.p8:511 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:512 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:513 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:515 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:516 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:518 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:519 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:520 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:522 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_57_afterif - cpy p8v_sources_msb+1 - bne label_asm_57_afterif - ; source: test_word_splitw_equalities.p8:523 success++ - inc p8b_main.p8v_success -label_asm_57_afterif - ; source: test_word_splitw_equalities.p8:526 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_59_else - cpy p8v_sources_msb+1 - bne label_asm_59_else - ; source: test_word_splitw_equalities.p8:527 success++ - inc p8b_main.p8v_success - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_splitw_equalities.p8:529 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_word_splitw_equalities.p8:532 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl16a -+ - ; source: test_word_splitw_equalities.p8:534 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:535 lbl16a: fail_word(49,30464) -p8l_lbl16a - lda #<$31 - ldy #>$31 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:536 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:538 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:539 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:541 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:542 lbl16b: fail_word(50,30464) -p8l_lbl16b - lda #<$32 - ldy #>$32 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:543 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:545 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_60_afterif - cpy p8v_sources_msb+1 - bne label_asm_60_afterif - ; source: test_word_splitw_equalities.p8:546 fail_word(51,30464) - lda #<$33 - ldy #>$33 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_60_afterif - ; source: test_word_splitw_equalities.p8:549 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_62_else - cpy p8v_sources_msb+1 - bne label_asm_62_else - ; source: test_word_splitw_equalities.p8:550 fail_word(52,30464) - lda #<$34 - ldy #>$34 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_splitw_equalities.p8:552 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_word_splitw_equalities.p8:554 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:556 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl17a -+ - ; source: test_word_splitw_equalities.p8:558 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:559 lbl17a: fail_word(53,32767) -p8l_lbl17a - lda #<$35 - ldy #>$35 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:560 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:562 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:563 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:565 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:566 lbl17b: fail_word(54,32767) -p8l_lbl17b - lda #<$36 - ldy #>$36 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:567 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:569 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_63_afterif - cpy p8v_sources_msb+1 - bne label_asm_63_afterif - ; source: test_word_splitw_equalities.p8:570 fail_word(55,32767) - lda #<$37 - ldy #>$37 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_63_afterif - ; source: test_word_splitw_equalities.p8:573 if sources[1]==-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne label_asm_65_else - cpy p8v_sources_msb+1 - bne label_asm_65_else - ; source: test_word_splitw_equalities.p8:574 fail_word(56,32767) - lda #<$38 - ldy #>$38 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_splitw_equalities.p8:576 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_word_splitw_equalities.p8:579 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl18a -+ - ; source: test_word_splitw_equalities.p8:581 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:582 lbl18a: fail_word(57,32767) -p8l_lbl18a - lda #<$39 - ldy #>$39 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:583 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:585 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:586 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:588 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:589 lbl18b: fail_word(58,32767) -p8l_lbl18b - lda #<$3a - ldy #>$3a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:590 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:592 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_66_afterif - cpy p8v_sources_msb+1 - bne label_asm_66_afterif - ; source: test_word_splitw_equalities.p8:593 fail_word(59,32767) - lda #<$3b - ldy #>$3b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_66_afterif - ; source: test_word_splitw_equalities.p8:596 if sources[1]==170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne label_asm_68_else - cpy p8v_sources_msb+1 - bne label_asm_68_else - ; source: test_word_splitw_equalities.p8:597 fail_word(60,32767) - lda #<$3c - ldy #>$3c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_splitw_equalities.p8:599 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_word_splitw_equalities.p8:602 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl19a -+ - ; source: test_word_splitw_equalities.p8:604 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:605 lbl19a: fail_word(61,32767) -p8l_lbl19a - lda #<$3d - ldy #>$3d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:606 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:608 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:609 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:611 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:612 lbl19b: fail_word(62,32767) -p8l_lbl19b - lda #<$3e - ldy #>$3e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:613 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:615 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_69_afterif - cpy p8v_sources_msb+1 - bne label_asm_69_afterif - ; source: test_word_splitw_equalities.p8:616 fail_word(63,32767) - lda #<$3f - ldy #>$3f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_69_afterif - ; source: test_word_splitw_equalities.p8:619 if sources[1]==30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne label_asm_71_else - cpy p8v_sources_msb+1 - bne label_asm_71_else - ; source: test_word_splitw_equalities.p8:620 fail_word(64,32767) - lda #<$40 - ldy #>$40 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_splitw_equalities.p8:622 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_word_splitw_equalities.p8:625 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl20a -+ - ; source: test_word_splitw_equalities.p8:627 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:628 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:629 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:631 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:632 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:634 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:635 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:636 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:638 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_72_afterif - cpy p8v_sources_msb+1 - bne label_asm_72_afterif - ; source: test_word_splitw_equalities.p8:639 success++ - inc p8b_main.p8v_success -label_asm_72_afterif - ; source: test_word_splitw_equalities.p8:642 if sources[1]==32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne label_asm_74_else - cpy p8v_sources_msb+1 - bne label_asm_74_else - ; source: test_word_splitw_equalities.p8:643 success++ - inc p8b_main.p8v_success - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_splitw_equalities.p8:645 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_word_splitw_equalities.p8:647 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:179 sub test_is_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_word_splitw_equalities.p8:649 sub test_not_number() { - -p8s_test_not_number .proc -; statements - ; source: test_word_splitw_equalities.p8:650 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:651 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:652 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:654 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne p8l_lbl1a - cpy p8v_sources_msb+1 - bne p8l_lbl1a - ; source: test_word_splitw_equalities.p8:656 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:657 lbl1a: fail_word(65,-21829) -p8l_lbl1a - lda #<$41 - ldy #>$41 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:658 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:660 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:661 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:663 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:664 lbl1b: fail_word(66,-21829) -p8l_lbl1b - lda #<$42 - ldy #>$42 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:665 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:667 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_75_afterif -+ - ; source: test_word_splitw_equalities.p8:668 fail_word(67,-21829) - lda #<$43 - ldy #>$43 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_75_afterif - ; source: test_word_splitw_equalities.p8:671 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_77_else -+ - ; source: test_word_splitw_equalities.p8:672 fail_word(68,-21829) - lda #<$44 - ldy #>$44 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_splitw_equalities.p8:674 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_word_splitw_equalities.p8:677 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne p8l_lbl2a - cpy p8v_sources_msb+1 - bne p8l_lbl2a - ; source: test_word_splitw_equalities.p8:679 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:680 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:681 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:683 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:684 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:686 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:687 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:688 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:690 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_78_afterif -+ - ; source: test_word_splitw_equalities.p8:691 success++ - inc p8b_main.p8v_success -label_asm_78_afterif - ; source: test_word_splitw_equalities.p8:694 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_80_else -+ - ; source: test_word_splitw_equalities.p8:695 success++ - inc p8b_main.p8v_success - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_splitw_equalities.p8:697 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_word_splitw_equalities.p8:700 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl3a - cpy p8v_sources_msb+1 - bne p8l_lbl3a - ; source: test_word_splitw_equalities.p8:702 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:703 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:704 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:706 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:707 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:709 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:710 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:711 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:713 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_81_afterif -+ - ; source: test_word_splitw_equalities.p8:714 success++ - inc p8b_main.p8v_success -label_asm_81_afterif - ; source: test_word_splitw_equalities.p8:717 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_83_else -+ - ; source: test_word_splitw_equalities.p8:718 success++ - inc p8b_main.p8v_success - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_splitw_equalities.p8:720 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_word_splitw_equalities.p8:723 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne p8l_lbl4a - cpy p8v_sources_msb+1 - bne p8l_lbl4a - ; source: test_word_splitw_equalities.p8:725 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:726 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:727 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:729 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:730 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:732 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:733 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:734 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:736 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_84_afterif -+ - ; source: test_word_splitw_equalities.p8:737 success++ - inc p8b_main.p8v_success -label_asm_84_afterif - ; source: test_word_splitw_equalities.p8:740 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_86_else -+ - ; source: test_word_splitw_equalities.p8:741 success++ - inc p8b_main.p8v_success - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_splitw_equalities.p8:743 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_word_splitw_equalities.p8:745 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:747 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne p8l_lbl5a - cpy p8v_sources_msb+1 - bne p8l_lbl5a - ; source: test_word_splitw_equalities.p8:749 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:750 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:751 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:753 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:754 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:756 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:757 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:758 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:760 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_87_afterif -+ - ; source: test_word_splitw_equalities.p8:761 success++ - inc p8b_main.p8v_success -label_asm_87_afterif - ; source: test_word_splitw_equalities.p8:764 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_89_else -+ - ; source: test_word_splitw_equalities.p8:765 success++ - inc p8b_main.p8v_success - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_splitw_equalities.p8:767 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_word_splitw_equalities.p8:770 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne p8l_lbl6a - cpy p8v_sources_msb+1 - bne p8l_lbl6a - ; source: test_word_splitw_equalities.p8:772 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:773 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:774 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:776 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:777 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:779 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:780 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:781 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:783 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_90_afterif -+ - ; source: test_word_splitw_equalities.p8:784 success++ - inc p8b_main.p8v_success -label_asm_90_afterif - ; source: test_word_splitw_equalities.p8:787 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_92_else -+ - ; source: test_word_splitw_equalities.p8:788 success++ - inc p8b_main.p8v_success - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_splitw_equalities.p8:790 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_word_splitw_equalities.p8:793 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl7a - cpy p8v_sources_msb+1 - bne p8l_lbl7a - ; source: test_word_splitw_equalities.p8:795 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:796 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:797 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:799 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:800 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:802 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:803 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:804 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:806 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_93_afterif -+ - ; source: test_word_splitw_equalities.p8:807 success++ - inc p8b_main.p8v_success -label_asm_93_afterif - ; source: test_word_splitw_equalities.p8:810 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_95_else -+ - ; source: test_word_splitw_equalities.p8:811 success++ - inc p8b_main.p8v_success - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_splitw_equalities.p8:813 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_word_splitw_equalities.p8:816 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne p8l_lbl8a - cpy p8v_sources_msb+1 - bne p8l_lbl8a - ; source: test_word_splitw_equalities.p8:818 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:819 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:820 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:822 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:823 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:825 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:826 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:827 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:829 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_96_afterif -+ - ; source: test_word_splitw_equalities.p8:830 success++ - inc p8b_main.p8v_success -label_asm_96_afterif - ; source: test_word_splitw_equalities.p8:833 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_98_else -+ - ; source: test_word_splitw_equalities.p8:834 success++ - inc p8b_main.p8v_success - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_splitw_equalities.p8:836 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_word_splitw_equalities.p8:838 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:840 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne p8l_lbl9a - cpy p8v_sources_msb+1 - bne p8l_lbl9a - ; source: test_word_splitw_equalities.p8:842 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:843 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:844 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:846 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:847 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:849 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:850 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:851 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:853 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_99_afterif -+ - ; source: test_word_splitw_equalities.p8:854 success++ - inc p8b_main.p8v_success -label_asm_99_afterif - ; source: test_word_splitw_equalities.p8:857 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_101_else -+ - ; source: test_word_splitw_equalities.p8:858 success++ - inc p8b_main.p8v_success - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_splitw_equalities.p8:860 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_word_splitw_equalities.p8:863 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne p8l_lbl10a - cpy p8v_sources_msb+1 - bne p8l_lbl10a - ; source: test_word_splitw_equalities.p8:865 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:866 lbl10a: fail_word(69,170) -p8l_lbl10a - lda #<$45 - ldy #>$45 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:867 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:869 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:870 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:872 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:873 lbl10b: fail_word(70,170) -p8l_lbl10b - lda #<$46 - ldy #>$46 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:874 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:876 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_102_afterif -+ - ; source: test_word_splitw_equalities.p8:877 fail_word(71,170) - lda #<$47 - ldy #>$47 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_102_afterif - ; source: test_word_splitw_equalities.p8:880 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_104_else -+ - ; source: test_word_splitw_equalities.p8:881 fail_word(72,170) - lda #<$48 - ldy #>$48 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_splitw_equalities.p8:883 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_word_splitw_equalities.p8:886 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl11a - cpy p8v_sources_msb+1 - bne p8l_lbl11a - ; source: test_word_splitw_equalities.p8:888 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:889 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:890 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:892 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:893 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:895 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:896 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:897 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:899 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_105_afterif -+ - ; source: test_word_splitw_equalities.p8:900 success++ - inc p8b_main.p8v_success -label_asm_105_afterif - ; source: test_word_splitw_equalities.p8:903 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_107_else -+ - ; source: test_word_splitw_equalities.p8:904 success++ - inc p8b_main.p8v_success - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_splitw_equalities.p8:906 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_word_splitw_equalities.p8:909 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne p8l_lbl12a - cpy p8v_sources_msb+1 - bne p8l_lbl12a - ; source: test_word_splitw_equalities.p8:911 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:912 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:913 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:915 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:916 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:918 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:919 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:920 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:922 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_108_afterif -+ - ; source: test_word_splitw_equalities.p8:923 success++ - inc p8b_main.p8v_success -label_asm_108_afterif - ; source: test_word_splitw_equalities.p8:926 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_110_else -+ - ; source: test_word_splitw_equalities.p8:927 success++ - inc p8b_main.p8v_success - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_splitw_equalities.p8:929 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_word_splitw_equalities.p8:931 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:933 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne p8l_lbl13a - cpy p8v_sources_msb+1 - bne p8l_lbl13a - ; source: test_word_splitw_equalities.p8:935 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:936 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:937 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:939 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:940 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:942 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:943 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:944 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:946 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_111_afterif -+ - ; source: test_word_splitw_equalities.p8:947 success++ - inc p8b_main.p8v_success -label_asm_111_afterif - ; source: test_word_splitw_equalities.p8:950 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_113_else -+ - ; source: test_word_splitw_equalities.p8:951 success++ - inc p8b_main.p8v_success - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_splitw_equalities.p8:953 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_word_splitw_equalities.p8:956 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne p8l_lbl14a - cpy p8v_sources_msb+1 - bne p8l_lbl14a - ; source: test_word_splitw_equalities.p8:958 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:959 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:960 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:962 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:963 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:965 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:966 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:967 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:969 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_114_afterif -+ - ; source: test_word_splitw_equalities.p8:970 success++ - inc p8b_main.p8v_success -label_asm_114_afterif - ; source: test_word_splitw_equalities.p8:973 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_116_else -+ - ; source: test_word_splitw_equalities.p8:974 success++ - inc p8b_main.p8v_success - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_splitw_equalities.p8:976 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_word_splitw_equalities.p8:979 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl15a - cpy p8v_sources_msb+1 - bne p8l_lbl15a - ; source: test_word_splitw_equalities.p8:981 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:982 lbl15a: fail_word(73,30464) -p8l_lbl15a - lda #<$49 - ldy #>$49 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:983 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:985 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:986 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:988 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:989 lbl15b: fail_word(74,30464) -p8l_lbl15b - lda #<$4a - ldy #>$4a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:990 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:992 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_117_afterif -+ - ; source: test_word_splitw_equalities.p8:993 fail_word(75,30464) - lda #<$4b - ldy #>$4b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_117_afterif - ; source: test_word_splitw_equalities.p8:996 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_119_else -+ - ; source: test_word_splitw_equalities.p8:997 fail_word(76,30464) - lda #<$4c - ldy #>$4c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_splitw_equalities.p8:999 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_word_splitw_equalities.p8:1002 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne p8l_lbl16a - cpy p8v_sources_msb+1 - bne p8l_lbl16a - ; source: test_word_splitw_equalities.p8:1004 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:1005 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1006 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:1008 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1009 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1011 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:1012 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1013 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:1015 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_120_afterif -+ - ; source: test_word_splitw_equalities.p8:1016 success++ - inc p8b_main.p8v_success -label_asm_120_afterif - ; source: test_word_splitw_equalities.p8:1019 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_122_else -+ - ; source: test_word_splitw_equalities.p8:1020 success++ - inc p8b_main.p8v_success - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_splitw_equalities.p8:1022 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_word_splitw_equalities.p8:1024 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1026 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne p8l_lbl17a - cpy p8v_sources_msb+1 - bne p8l_lbl17a - ; source: test_word_splitw_equalities.p8:1028 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:1029 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1030 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:1032 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1033 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1035 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:1036 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1037 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:1039 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_123_afterif -+ - ; source: test_word_splitw_equalities.p8:1040 success++ - inc p8b_main.p8v_success -label_asm_123_afterif - ; source: test_word_splitw_equalities.p8:1043 if sources[1]!=-21829 - ldy #>-$5545 - lda #<-$5545 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_125_else -+ - ; source: test_word_splitw_equalities.p8:1044 success++ - inc p8b_main.p8v_success - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_splitw_equalities.p8:1046 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_word_splitw_equalities.p8:1049 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne p8l_lbl18a - cpy p8v_sources_msb+1 - bne p8l_lbl18a - ; source: test_word_splitw_equalities.p8:1051 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:1052 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1053 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:1055 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1056 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1058 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:1059 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1060 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:1062 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_126_afterif -+ - ; source: test_word_splitw_equalities.p8:1063 success++ - inc p8b_main.p8v_success -label_asm_126_afterif - ; source: test_word_splitw_equalities.p8:1066 if sources[1]!=170 - ldy #>$aa - lda #<$aa - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_128_else -+ - ; source: test_word_splitw_equalities.p8:1067 success++ - inc p8b_main.p8v_success - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_splitw_equalities.p8:1069 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_word_splitw_equalities.p8:1072 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne p8l_lbl19a - cpy p8v_sources_msb+1 - bne p8l_lbl19a - ; source: test_word_splitw_equalities.p8:1074 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:1075 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1076 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:1078 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1079 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1081 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:1082 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1083 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:1085 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_129_afterif -+ - ; source: test_word_splitw_equalities.p8:1086 success++ - inc p8b_main.p8v_success -label_asm_129_afterif - ; source: test_word_splitw_equalities.p8:1089 if sources[1]!=30464 - ldy #>$7700 - lda #<$7700 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_131_else -+ - ; source: test_word_splitw_equalities.p8:1090 success++ - inc p8b_main.p8v_success - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_splitw_equalities.p8:1092 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_word_splitw_equalities.p8:1095 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne p8l_lbl20a - cpy p8v_sources_msb+1 - bne p8l_lbl20a - ; source: test_word_splitw_equalities.p8:1097 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:1098 lbl20a: fail_word(77,32767) -p8l_lbl20a - lda #<$4d - ldy #>$4d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1099 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:1101 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1102 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1104 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:1105 lbl20b: fail_word(78,32767) -p8l_lbl20b - lda #<$4e - ldy #>$4e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1106 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:1108 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_132_afterif -+ - ; source: test_word_splitw_equalities.p8:1109 fail_word(79,32767) - lda #<$4f - ldy #>$4f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_132_afterif - ; source: test_word_splitw_equalities.p8:1112 if sources[1]!=32767 - ldy #>$7fff - lda #<$7fff - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_134_else -+ - ; source: test_word_splitw_equalities.p8:1113 fail_word(80,32767) - lda #<$50 - ldy #>$50 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_splitw_equalities.p8:1115 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_word_splitw_equalities.p8:1117 verify_success(64) - lda #$40 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:649 sub test_not_number() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_word_splitw_equalities.p8:1119 sub test_is_var() { - -p8s_test_is_var .proc -; statements - ; source: test_word_splitw_equalities.p8:1120 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:1121 word[] @split values = [8888,8888] - ; source: test_word_splitw_equalities.p8:1122 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1123 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1124 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1126 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1a -+ - ; source: test_word_splitw_equalities.p8:1128 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:1129 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1130 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:1132 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1133 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1135 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:1136 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1137 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:1139 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_135_afterif - cpy p8v_sources_msb+1 - bne label_asm_135_afterif - ; source: test_word_splitw_equalities.p8:1140 success++ - inc p8b_main.p8v_success -label_asm_135_afterif - ; source: test_word_splitw_equalities.p8:1143 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_137_else - cpy p8v_sources_msb+1 - bne label_asm_137_else - ; source: test_word_splitw_equalities.p8:1144 success++ - inc p8b_main.p8v_success - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_splitw_equalities.p8:1146 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_word_splitw_equalities.p8:1148 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1150 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2a -+ - ; source: test_word_splitw_equalities.p8:1152 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:1153 lbl2a: fail_word(81,-21829) -p8l_lbl2a - lda #<$51 - ldy #>$51 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1154 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:1156 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1157 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1159 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:1160 lbl2b: fail_word(82,-21829) -p8l_lbl2b - lda #<$52 - ldy #>$52 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1161 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:1163 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_138_afterif - cpy p8v_sources_msb+1 - bne label_asm_138_afterif - ; source: test_word_splitw_equalities.p8:1164 fail_word(83,-21829) - lda #<$53 - ldy #>$53 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_138_afterif - ; source: test_word_splitw_equalities.p8:1167 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_140_else - cpy p8v_sources_msb+1 - bne label_asm_140_else - ; source: test_word_splitw_equalities.p8:1168 fail_word(84,-21829) - lda #<$54 - ldy #>$54 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_splitw_equalities.p8:1170 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_word_splitw_equalities.p8:1172 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1174 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3a -+ - ; source: test_word_splitw_equalities.p8:1176 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:1177 lbl3a: fail_word(85,-21829) -p8l_lbl3a - lda #<$55 - ldy #>$55 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1178 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:1180 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1181 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1183 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:1184 lbl3b: fail_word(86,-21829) -p8l_lbl3b - lda #<$56 - ldy #>$56 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1185 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:1187 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_141_afterif - cpy p8v_sources_msb+1 - bne label_asm_141_afterif - ; source: test_word_splitw_equalities.p8:1188 fail_word(87,-21829) - lda #<$57 - ldy #>$57 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_141_afterif - ; source: test_word_splitw_equalities.p8:1191 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_143_else - cpy p8v_sources_msb+1 - bne label_asm_143_else - ; source: test_word_splitw_equalities.p8:1192 fail_word(88,-21829) - lda #<$58 - ldy #>$58 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_splitw_equalities.p8:1194 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_word_splitw_equalities.p8:1196 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1198 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4a -+ - ; source: test_word_splitw_equalities.p8:1200 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:1201 lbl4a: fail_word(89,-21829) -p8l_lbl4a - lda #<$59 - ldy #>$59 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1202 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:1204 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1205 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1207 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:1208 lbl4b: fail_word(90,-21829) -p8l_lbl4b - lda #<$5a - ldy #>$5a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1209 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:1211 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_144_afterif - cpy p8v_sources_msb+1 - bne label_asm_144_afterif - ; source: test_word_splitw_equalities.p8:1212 fail_word(91,-21829) - lda #<$5b - ldy #>$5b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_144_afterif - ; source: test_word_splitw_equalities.p8:1215 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_146_else - cpy p8v_sources_msb+1 - bne label_asm_146_else - ; source: test_word_splitw_equalities.p8:1216 fail_word(92,-21829) - lda #<$5c - ldy #>$5c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_splitw_equalities.p8:1218 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_word_splitw_equalities.p8:1220 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1221 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1223 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5a -+ - ; source: test_word_splitw_equalities.p8:1225 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:1226 lbl5a: fail_word(93,0) -p8l_lbl5a - lda #<$5d - ldy #>$5d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1227 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:1229 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1230 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1232 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:1233 lbl5b: fail_word(94,0) -p8l_lbl5b - lda #<$5e - ldy #>$5e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1234 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:1236 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_147_afterif - cpy p8v_sources_msb+1 - bne label_asm_147_afterif - ; source: test_word_splitw_equalities.p8:1237 fail_word(95,0) - lda #<$5f - ldy #>$5f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_147_afterif - ; source: test_word_splitw_equalities.p8:1240 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_149_else - cpy p8v_sources_msb+1 - bne label_asm_149_else - ; source: test_word_splitw_equalities.p8:1241 fail_word(96,0) - lda #<$60 - ldy #>$60 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_splitw_equalities.p8:1243 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_word_splitw_equalities.p8:1245 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1247 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6a -+ - ; source: test_word_splitw_equalities.p8:1249 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:1250 lbl6a: fail_word(97,0) -p8l_lbl6a - lda #<$61 - ldy #>$61 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1251 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:1253 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1254 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1256 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:1257 lbl6b: fail_word(98,0) -p8l_lbl6b - lda #<$62 - ldy #>$62 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1258 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:1260 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_150_afterif - cpy p8v_sources_msb+1 - bne label_asm_150_afterif - ; source: test_word_splitw_equalities.p8:1261 fail_word(99,0) - lda #<$63 - ldy #>$63 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_150_afterif - ; source: test_word_splitw_equalities.p8:1264 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_152_else - cpy p8v_sources_msb+1 - bne label_asm_152_else - ; source: test_word_splitw_equalities.p8:1265 fail_word(100,0) - lda #<$64 - ldy #>$64 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_splitw_equalities.p8:1267 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_word_splitw_equalities.p8:1269 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1271 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7a -+ - ; source: test_word_splitw_equalities.p8:1273 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:1274 lbl7a: fail_word(101,0) -p8l_lbl7a - lda #<$65 - ldy #>$65 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1275 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:1277 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1278 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1280 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:1281 lbl7b: fail_word(102,0) -p8l_lbl7b - lda #<$66 - ldy #>$66 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1282 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:1284 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_153_afterif - cpy p8v_sources_msb+1 - bne label_asm_153_afterif - ; source: test_word_splitw_equalities.p8:1285 fail_word(103,0) - lda #<$67 - ldy #>$67 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_153_afterif - ; source: test_word_splitw_equalities.p8:1288 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_155_else - cpy p8v_sources_msb+1 - bne label_asm_155_else - ; source: test_word_splitw_equalities.p8:1289 fail_word(104,0) - lda #<$68 - ldy #>$68 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_splitw_equalities.p8:1291 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_word_splitw_equalities.p8:1293 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1295 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8a -+ - ; source: test_word_splitw_equalities.p8:1297 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:1298 lbl8a: fail_word(105,0) -p8l_lbl8a - lda #<$69 - ldy #>$69 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1299 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:1301 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1302 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1304 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:1305 lbl8b: fail_word(106,0) -p8l_lbl8b - lda #<$6a - ldy #>$6a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1306 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:1308 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_156_afterif - cpy p8v_sources_msb+1 - bne label_asm_156_afterif - ; source: test_word_splitw_equalities.p8:1309 fail_word(107,0) - lda #<$6b - ldy #>$6b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_156_afterif - ; source: test_word_splitw_equalities.p8:1312 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_158_else - cpy p8v_sources_msb+1 - bne label_asm_158_else - ; source: test_word_splitw_equalities.p8:1313 fail_word(108,0) - lda #<$6c - ldy #>$6c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_splitw_equalities.p8:1315 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_word_splitw_equalities.p8:1317 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1318 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1320 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9a -+ - ; source: test_word_splitw_equalities.p8:1322 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:1323 lbl9a: fail_word(109,170) -p8l_lbl9a - lda #<$6d - ldy #>$6d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1324 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:1326 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1327 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1329 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:1330 lbl9b: fail_word(110,170) -p8l_lbl9b - lda #<$6e - ldy #>$6e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1331 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:1333 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_159_afterif - cpy p8v_sources_msb+1 - bne label_asm_159_afterif - ; source: test_word_splitw_equalities.p8:1334 fail_word(111,170) - lda #<$6f - ldy #>$6f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_159_afterif - ; source: test_word_splitw_equalities.p8:1337 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_161_else - cpy p8v_sources_msb+1 - bne label_asm_161_else - ; source: test_word_splitw_equalities.p8:1338 fail_word(112,170) - lda #<$70 - ldy #>$70 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_splitw_equalities.p8:1340 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_word_splitw_equalities.p8:1342 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1344 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10a -+ - ; source: test_word_splitw_equalities.p8:1346 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:1347 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1348 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:1350 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1351 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1353 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:1354 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1355 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:1357 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_162_afterif - cpy p8v_sources_msb+1 - bne label_asm_162_afterif - ; source: test_word_splitw_equalities.p8:1358 success++ - inc p8b_main.p8v_success -label_asm_162_afterif - ; source: test_word_splitw_equalities.p8:1361 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_164_else - cpy p8v_sources_msb+1 - bne label_asm_164_else - ; source: test_word_splitw_equalities.p8:1362 success++ - inc p8b_main.p8v_success - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_splitw_equalities.p8:1364 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_word_splitw_equalities.p8:1366 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1368 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11a -+ - ; source: test_word_splitw_equalities.p8:1370 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:1371 lbl11a: fail_word(113,170) -p8l_lbl11a - lda #<$71 - ldy #>$71 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1372 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:1374 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1375 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1377 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:1378 lbl11b: fail_word(114,170) -p8l_lbl11b - lda #<$72 - ldy #>$72 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1379 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:1381 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_165_afterif - cpy p8v_sources_msb+1 - bne label_asm_165_afterif - ; source: test_word_splitw_equalities.p8:1382 fail_word(115,170) - lda #<$73 - ldy #>$73 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_165_afterif - ; source: test_word_splitw_equalities.p8:1385 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_167_else - cpy p8v_sources_msb+1 - bne label_asm_167_else - ; source: test_word_splitw_equalities.p8:1386 fail_word(116,170) - lda #<$74 - ldy #>$74 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_splitw_equalities.p8:1388 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_word_splitw_equalities.p8:1390 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1392 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12a -+ - ; source: test_word_splitw_equalities.p8:1394 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:1395 lbl12a: fail_word(117,170) -p8l_lbl12a - lda #<$75 - ldy #>$75 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1396 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:1398 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1399 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1401 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:1402 lbl12b: fail_word(118,170) -p8l_lbl12b - lda #<$76 - ldy #>$76 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1403 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:1405 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_168_afterif - cpy p8v_sources_msb+1 - bne label_asm_168_afterif - ; source: test_word_splitw_equalities.p8:1406 fail_word(119,170) - lda #<$77 - ldy #>$77 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_168_afterif - ; source: test_word_splitw_equalities.p8:1409 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_170_else - cpy p8v_sources_msb+1 - bne label_asm_170_else - ; source: test_word_splitw_equalities.p8:1410 fail_word(120,170) - lda #<$78 - ldy #>$78 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_splitw_equalities.p8:1412 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_word_splitw_equalities.p8:1414 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1415 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1417 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl13a -+ - ; source: test_word_splitw_equalities.p8:1419 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:1420 lbl13a: fail_word(121,30464) -p8l_lbl13a - lda #<$79 - ldy #>$79 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1421 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:1423 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1424 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1426 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:1427 lbl13b: fail_word(122,30464) -p8l_lbl13b - lda #<$7a - ldy #>$7a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1428 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:1430 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_171_afterif - cpy p8v_sources_msb+1 - bne label_asm_171_afterif - ; source: test_word_splitw_equalities.p8:1431 fail_word(123,30464) - lda #<$7b - ldy #>$7b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_171_afterif - ; source: test_word_splitw_equalities.p8:1434 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_173_else - cpy p8v_sources_msb+1 - bne label_asm_173_else - ; source: test_word_splitw_equalities.p8:1435 fail_word(124,30464) - lda #<$7c - ldy #>$7c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_splitw_equalities.p8:1437 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_word_splitw_equalities.p8:1439 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1441 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl14a -+ - ; source: test_word_splitw_equalities.p8:1443 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:1444 lbl14a: fail_word(125,30464) -p8l_lbl14a - lda #<$7d - ldy #>$7d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1445 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:1447 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1448 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1450 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:1451 lbl14b: fail_word(126,30464) -p8l_lbl14b - lda #<$7e - ldy #>$7e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1452 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:1454 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_174_afterif - cpy p8v_sources_msb+1 - bne label_asm_174_afterif - ; source: test_word_splitw_equalities.p8:1455 fail_word(127,30464) - lda #<$7f - ldy #>$7f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_174_afterif - ; source: test_word_splitw_equalities.p8:1458 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_176_else - cpy p8v_sources_msb+1 - bne label_asm_176_else - ; source: test_word_splitw_equalities.p8:1459 fail_word(128,30464) - lda #<$80 - ldy #>$80 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_splitw_equalities.p8:1461 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_word_splitw_equalities.p8:1463 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1465 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl15a -+ - ; source: test_word_splitw_equalities.p8:1467 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:1468 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1469 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:1471 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1472 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1474 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:1475 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1476 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:1478 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_177_afterif - cpy p8v_sources_msb+1 - bne label_asm_177_afterif - ; source: test_word_splitw_equalities.p8:1479 success++ - inc p8b_main.p8v_success -label_asm_177_afterif - ; source: test_word_splitw_equalities.p8:1482 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_179_else - cpy p8v_sources_msb+1 - bne label_asm_179_else - ; source: test_word_splitw_equalities.p8:1483 success++ - inc p8b_main.p8v_success - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_splitw_equalities.p8:1485 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_word_splitw_equalities.p8:1487 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1489 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl16a -+ - ; source: test_word_splitw_equalities.p8:1491 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:1492 lbl16a: fail_word(129,30464) -p8l_lbl16a - lda #<$81 - ldy #>$81 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1493 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:1495 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1496 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1498 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:1499 lbl16b: fail_word(130,30464) -p8l_lbl16b - lda #<$82 - ldy #>$82 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1500 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:1502 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_180_afterif - cpy p8v_sources_msb+1 - bne label_asm_180_afterif - ; source: test_word_splitw_equalities.p8:1503 fail_word(131,30464) - lda #<$83 - ldy #>$83 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_180_afterif - ; source: test_word_splitw_equalities.p8:1506 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_182_else - cpy p8v_sources_msb+1 - bne label_asm_182_else - ; source: test_word_splitw_equalities.p8:1507 fail_word(132,30464) - lda #<$84 - ldy #>$84 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_splitw_equalities.p8:1509 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_word_splitw_equalities.p8:1511 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1512 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1514 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl17a -+ - ; source: test_word_splitw_equalities.p8:1516 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:1517 lbl17a: fail_word(133,32767) -p8l_lbl17a - lda #<$85 - ldy #>$85 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1518 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:1520 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1521 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1523 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:1524 lbl17b: fail_word(134,32767) -p8l_lbl17b - lda #<$86 - ldy #>$86 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1525 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:1527 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_183_afterif - cpy p8v_sources_msb+1 - bne label_asm_183_afterif - ; source: test_word_splitw_equalities.p8:1528 fail_word(135,32767) - lda #<$87 - ldy #>$87 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_183_afterif - ; source: test_word_splitw_equalities.p8:1531 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_185_else - cpy p8v_sources_msb+1 - bne label_asm_185_else - ; source: test_word_splitw_equalities.p8:1532 fail_word(136,32767) - lda #<$88 - ldy #>$88 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_splitw_equalities.p8:1534 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_word_splitw_equalities.p8:1536 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1538 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl18a -+ - ; source: test_word_splitw_equalities.p8:1540 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:1541 lbl18a: fail_word(137,32767) -p8l_lbl18a - lda #<$89 - ldy #>$89 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1542 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:1544 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1545 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1547 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:1548 lbl18b: fail_word(138,32767) -p8l_lbl18b - lda #<$8a - ldy #>$8a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1549 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:1551 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_186_afterif - cpy p8v_sources_msb+1 - bne label_asm_186_afterif - ; source: test_word_splitw_equalities.p8:1552 fail_word(139,32767) - lda #<$8b - ldy #>$8b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_186_afterif - ; source: test_word_splitw_equalities.p8:1555 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_188_else - cpy p8v_sources_msb+1 - bne label_asm_188_else - ; source: test_word_splitw_equalities.p8:1556 fail_word(140,32767) - lda #<$8c - ldy #>$8c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_splitw_equalities.p8:1558 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_word_splitw_equalities.p8:1560 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1562 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl19a -+ - ; source: test_word_splitw_equalities.p8:1564 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:1565 lbl19a: fail_word(141,32767) -p8l_lbl19a - lda #<$8d - ldy #>$8d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1566 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:1568 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1569 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1571 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:1572 lbl19b: fail_word(142,32767) -p8l_lbl19b - lda #<$8e - ldy #>$8e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1573 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:1575 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_189_afterif - cpy p8v_sources_msb+1 - bne label_asm_189_afterif - ; source: test_word_splitw_equalities.p8:1576 fail_word(143,32767) - lda #<$8f - ldy #>$8f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_189_afterif - ; source: test_word_splitw_equalities.p8:1579 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_191_else - cpy p8v_sources_msb+1 - bne label_asm_191_else - ; source: test_word_splitw_equalities.p8:1580 fail_word(144,32767) - lda #<$90 - ldy #>$90 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_splitw_equalities.p8:1582 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_word_splitw_equalities.p8:1584 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1586 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl20a -+ - ; source: test_word_splitw_equalities.p8:1588 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:1589 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1590 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:1592 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1593 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1595 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:1596 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1597 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:1599 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_192_afterif - cpy p8v_sources_msb+1 - bne label_asm_192_afterif - ; source: test_word_splitw_equalities.p8:1600 success++ - inc p8b_main.p8v_success -label_asm_192_afterif - ; source: test_word_splitw_equalities.p8:1603 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_194_else - cpy p8v_sources_msb+1 - bne label_asm_194_else - ; source: test_word_splitw_equalities.p8:1604 success++ - inc p8b_main.p8v_success - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_splitw_equalities.p8:1606 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_word_splitw_equalities.p8:1608 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:1119 sub test_is_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $22b8, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend - ; source: test_word_splitw_equalities.p8:1610 sub test_not_var() { - -p8s_test_not_var .proc -; statements - ; source: test_word_splitw_equalities.p8:1611 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:1612 word[] @split values = [8888,8888] - ; source: test_word_splitw_equalities.p8:1613 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1614 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1615 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1617 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1a - cpy p8v_sources_msb+1 - bne p8l_lbl1a - ; source: test_word_splitw_equalities.p8:1619 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:1620 lbl1a: fail_word(145,-21829) -p8l_lbl1a - lda #<$91 - ldy #>$91 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1621 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:1623 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1624 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1626 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:1627 lbl1b: fail_word(146,-21829) -p8l_lbl1b - lda #<$92 - ldy #>$92 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1628 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:1630 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_195_afterif -+ - ; source: test_word_splitw_equalities.p8:1631 fail_word(147,-21829) - lda #<$93 - ldy #>$93 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_195_afterif - ; source: test_word_splitw_equalities.p8:1634 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_197_else -+ - ; source: test_word_splitw_equalities.p8:1635 fail_word(148,-21829) - lda #<$94 - ldy #>$94 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_splitw_equalities.p8:1637 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_word_splitw_equalities.p8:1639 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1641 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl2a - cpy p8v_sources_msb+1 - bne p8l_lbl2a - ; source: test_word_splitw_equalities.p8:1643 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:1644 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1645 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:1647 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1648 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1650 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:1651 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1652 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:1654 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_198_afterif -+ - ; source: test_word_splitw_equalities.p8:1655 success++ - inc p8b_main.p8v_success -label_asm_198_afterif - ; source: test_word_splitw_equalities.p8:1658 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_200_else -+ - ; source: test_word_splitw_equalities.p8:1659 success++ - inc p8b_main.p8v_success - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_splitw_equalities.p8:1661 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_word_splitw_equalities.p8:1663 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1665 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl3a - cpy p8v_sources_msb+1 - bne p8l_lbl3a - ; source: test_word_splitw_equalities.p8:1667 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:1668 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1669 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:1671 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1672 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1674 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:1675 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1676 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:1678 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_201_afterif -+ - ; source: test_word_splitw_equalities.p8:1679 success++ - inc p8b_main.p8v_success -label_asm_201_afterif - ; source: test_word_splitw_equalities.p8:1682 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_203_else -+ - ; source: test_word_splitw_equalities.p8:1683 success++ - inc p8b_main.p8v_success - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_splitw_equalities.p8:1685 cx16.r0L++ - inc cx16.r0L -label_asm_202_afterif - ; source: test_word_splitw_equalities.p8:1687 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1689 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4a - cpy p8v_sources_msb+1 - bne p8l_lbl4a - ; source: test_word_splitw_equalities.p8:1691 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:1692 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1693 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:1695 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1696 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1698 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:1699 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1700 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:1702 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_204_afterif -+ - ; source: test_word_splitw_equalities.p8:1703 success++ - inc p8b_main.p8v_success -label_asm_204_afterif - ; source: test_word_splitw_equalities.p8:1706 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_206_else -+ - ; source: test_word_splitw_equalities.p8:1707 success++ - inc p8b_main.p8v_success - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_splitw_equalities.p8:1709 cx16.r0L++ - inc cx16.r0L -label_asm_205_afterif - ; source: test_word_splitw_equalities.p8:1711 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1712 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1714 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl5a - cpy p8v_sources_msb+1 - bne p8l_lbl5a - ; source: test_word_splitw_equalities.p8:1716 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:1717 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1718 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:1720 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1721 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1723 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:1724 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1725 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:1727 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_207_afterif -+ - ; source: test_word_splitw_equalities.p8:1728 success++ - inc p8b_main.p8v_success -label_asm_207_afterif - ; source: test_word_splitw_equalities.p8:1731 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_209_else -+ - ; source: test_word_splitw_equalities.p8:1732 success++ - inc p8b_main.p8v_success - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_splitw_equalities.p8:1734 cx16.r0L++ - inc cx16.r0L -label_asm_208_afterif - ; source: test_word_splitw_equalities.p8:1736 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1738 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl6a - cpy p8v_sources_msb+1 - bne p8l_lbl6a - ; source: test_word_splitw_equalities.p8:1740 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:1741 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1742 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:1744 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1745 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1747 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:1748 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1749 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:1751 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_210_afterif -+ - ; source: test_word_splitw_equalities.p8:1752 success++ - inc p8b_main.p8v_success -label_asm_210_afterif - ; source: test_word_splitw_equalities.p8:1755 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_212_else -+ - ; source: test_word_splitw_equalities.p8:1756 success++ - inc p8b_main.p8v_success - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_splitw_equalities.p8:1758 cx16.r0L++ - inc cx16.r0L -label_asm_211_afterif - ; source: test_word_splitw_equalities.p8:1760 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1762 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7a - cpy p8v_sources_msb+1 - bne p8l_lbl7a - ; source: test_word_splitw_equalities.p8:1764 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:1765 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1766 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:1768 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1769 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1771 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:1772 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1773 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:1775 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_213_afterif -+ - ; source: test_word_splitw_equalities.p8:1776 success++ - inc p8b_main.p8v_success -label_asm_213_afterif - ; source: test_word_splitw_equalities.p8:1779 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_215_else -+ - ; source: test_word_splitw_equalities.p8:1780 success++ - inc p8b_main.p8v_success - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_splitw_equalities.p8:1782 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_word_splitw_equalities.p8:1784 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1786 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl8a - cpy p8v_sources_msb+1 - bne p8l_lbl8a - ; source: test_word_splitw_equalities.p8:1788 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:1789 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1790 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:1792 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1793 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1795 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:1796 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1797 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:1799 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_216_afterif -+ - ; source: test_word_splitw_equalities.p8:1800 success++ - inc p8b_main.p8v_success -label_asm_216_afterif - ; source: test_word_splitw_equalities.p8:1803 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_218_else -+ - ; source: test_word_splitw_equalities.p8:1804 success++ - inc p8b_main.p8v_success - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_splitw_equalities.p8:1806 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_word_splitw_equalities.p8:1808 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1809 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1811 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl9a - cpy p8v_sources_msb+1 - bne p8l_lbl9a - ; source: test_word_splitw_equalities.p8:1813 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:1814 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1815 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:1817 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1818 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1820 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:1821 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1822 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:1824 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_219_afterif -+ - ; source: test_word_splitw_equalities.p8:1825 success++ - inc p8b_main.p8v_success -label_asm_219_afterif - ; source: test_word_splitw_equalities.p8:1828 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_221_else -+ - ; source: test_word_splitw_equalities.p8:1829 success++ - inc p8b_main.p8v_success - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_splitw_equalities.p8:1831 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_word_splitw_equalities.p8:1833 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1835 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10a - cpy p8v_sources_msb+1 - bne p8l_lbl10a - ; source: test_word_splitw_equalities.p8:1837 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:1838 lbl10a: fail_word(149,170) -p8l_lbl10a - lda #<$95 - ldy #>$95 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1839 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:1841 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1842 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1844 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:1845 lbl10b: fail_word(150,170) -p8l_lbl10b - lda #<$96 - ldy #>$96 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1846 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:1848 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_222_afterif -+ - ; source: test_word_splitw_equalities.p8:1849 fail_word(151,170) - lda #<$97 - ldy #>$97 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_222_afterif - ; source: test_word_splitw_equalities.p8:1852 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_224_else -+ - ; source: test_word_splitw_equalities.p8:1853 fail_word(152,170) - lda #<$98 - ldy #>$98 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_splitw_equalities.p8:1855 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_word_splitw_equalities.p8:1857 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1859 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl11a - cpy p8v_sources_msb+1 - bne p8l_lbl11a - ; source: test_word_splitw_equalities.p8:1861 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:1862 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1863 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:1865 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1866 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1868 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:1869 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1870 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:1872 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_225_afterif -+ - ; source: test_word_splitw_equalities.p8:1873 success++ - inc p8b_main.p8v_success -label_asm_225_afterif - ; source: test_word_splitw_equalities.p8:1876 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_227_else -+ - ; source: test_word_splitw_equalities.p8:1877 success++ - inc p8b_main.p8v_success - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_splitw_equalities.p8:1879 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_word_splitw_equalities.p8:1881 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1883 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl12a - cpy p8v_sources_msb+1 - bne p8l_lbl12a - ; source: test_word_splitw_equalities.p8:1885 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:1886 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1887 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:1889 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1890 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1892 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:1893 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1894 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:1896 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_228_afterif -+ - ; source: test_word_splitw_equalities.p8:1897 success++ - inc p8b_main.p8v_success -label_asm_228_afterif - ; source: test_word_splitw_equalities.p8:1900 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_230_else -+ - ; source: test_word_splitw_equalities.p8:1901 success++ - inc p8b_main.p8v_success - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_splitw_equalities.p8:1903 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_word_splitw_equalities.p8:1905 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:1906 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1908 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl13a - cpy p8v_sources_msb+1 - bne p8l_lbl13a - ; source: test_word_splitw_equalities.p8:1910 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:1911 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1912 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:1914 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1915 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1917 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:1918 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1919 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:1921 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_231_afterif -+ - ; source: test_word_splitw_equalities.p8:1922 success++ - inc p8b_main.p8v_success -label_asm_231_afterif - ; source: test_word_splitw_equalities.p8:1925 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_233_else -+ - ; source: test_word_splitw_equalities.p8:1926 success++ - inc p8b_main.p8v_success - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_splitw_equalities.p8:1928 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_word_splitw_equalities.p8:1930 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1932 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl14a - cpy p8v_sources_msb+1 - bne p8l_lbl14a - ; source: test_word_splitw_equalities.p8:1934 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:1935 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1936 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:1938 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1939 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1941 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:1942 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1943 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:1945 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_234_afterif -+ - ; source: test_word_splitw_equalities.p8:1946 success++ - inc p8b_main.p8v_success -label_asm_234_afterif - ; source: test_word_splitw_equalities.p8:1949 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_236_else -+ - ; source: test_word_splitw_equalities.p8:1950 success++ - inc p8b_main.p8v_success - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_splitw_equalities.p8:1952 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_word_splitw_equalities.p8:1954 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1956 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl15a - cpy p8v_sources_msb+1 - bne p8l_lbl15a - ; source: test_word_splitw_equalities.p8:1958 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:1959 lbl15a: fail_word(153,30464) -p8l_lbl15a - lda #<$99 - ldy #>$99 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1960 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:1962 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1963 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1965 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:1966 lbl15b: fail_word(154,30464) -p8l_lbl15b - lda #<$9a - ldy #>$9a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:1967 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:1969 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_237_afterif -+ - ; source: test_word_splitw_equalities.p8:1970 fail_word(155,30464) - lda #<$9b - ldy #>$9b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_237_afterif - ; source: test_word_splitw_equalities.p8:1973 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_239_else -+ - ; source: test_word_splitw_equalities.p8:1974 fail_word(156,30464) - lda #<$9c - ldy #>$9c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_splitw_equalities.p8:1976 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_word_splitw_equalities.p8:1978 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:1980 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl16a - cpy p8v_sources_msb+1 - bne p8l_lbl16a - ; source: test_word_splitw_equalities.p8:1982 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:1983 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1984 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:1986 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:1987 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:1989 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:1990 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:1991 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:1993 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_240_afterif -+ - ; source: test_word_splitw_equalities.p8:1994 success++ - inc p8b_main.p8v_success -label_asm_240_afterif - ; source: test_word_splitw_equalities.p8:1997 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_242_else -+ - ; source: test_word_splitw_equalities.p8:1998 success++ - inc p8b_main.p8v_success - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_splitw_equalities.p8:2000 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_word_splitw_equalities.p8:2002 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2003 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:2005 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl17a - cpy p8v_sources_msb+1 - bne p8l_lbl17a - ; source: test_word_splitw_equalities.p8:2007 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:2008 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2009 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:2011 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2012 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2014 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:2015 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2016 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:2018 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_243_afterif -+ - ; source: test_word_splitw_equalities.p8:2019 success++ - inc p8b_main.p8v_success -label_asm_243_afterif - ; source: test_word_splitw_equalities.p8:2022 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_245_else -+ - ; source: test_word_splitw_equalities.p8:2023 success++ - inc p8b_main.p8v_success - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_splitw_equalities.p8:2025 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_word_splitw_equalities.p8:2027 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:2029 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl18a - cpy p8v_sources_msb+1 - bne p8l_lbl18a - ; source: test_word_splitw_equalities.p8:2031 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:2032 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2033 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:2035 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2036 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2038 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:2039 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2040 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:2042 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_246_afterif -+ - ; source: test_word_splitw_equalities.p8:2043 success++ - inc p8b_main.p8v_success -label_asm_246_afterif - ; source: test_word_splitw_equalities.p8:2046 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_248_else -+ - ; source: test_word_splitw_equalities.p8:2047 success++ - inc p8b_main.p8v_success - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_splitw_equalities.p8:2049 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_word_splitw_equalities.p8:2051 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:2053 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl19a - cpy p8v_sources_msb+1 - bne p8l_lbl19a - ; source: test_word_splitw_equalities.p8:2055 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:2056 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2057 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:2059 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2060 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2062 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:2063 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2064 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:2066 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_249_afterif -+ - ; source: test_word_splitw_equalities.p8:2067 success++ - inc p8b_main.p8v_success -label_asm_249_afterif - ; source: test_word_splitw_equalities.p8:2070 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_251_else -+ - ; source: test_word_splitw_equalities.p8:2071 success++ - inc p8b_main.p8v_success - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_splitw_equalities.p8:2073 cx16.r0L++ - inc cx16.r0L -label_asm_250_afterif - ; source: test_word_splitw_equalities.p8:2075 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:2077 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl20a - cpy p8v_sources_msb+1 - bne p8l_lbl20a - ; source: test_word_splitw_equalities.p8:2079 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:2080 lbl20a: fail_word(157,32767) -p8l_lbl20a - lda #<$9d - ldy #>$9d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2081 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:2083 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2084 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2086 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:2087 lbl20b: fail_word(158,32767) -p8l_lbl20b - lda #<$9e - ldy #>$9e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2088 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:2090 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_252_afterif -+ - ; source: test_word_splitw_equalities.p8:2091 fail_word(159,32767) - lda #<$9f - ldy #>$9f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_252_afterif - ; source: test_word_splitw_equalities.p8:2094 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_254_else -+ - ; source: test_word_splitw_equalities.p8:2095 fail_word(160,32767) - lda #<$a0 - ldy #>$a0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_splitw_equalities.p8:2097 cx16.r0L++ - inc cx16.r0L -label_asm_253_afterif - ; source: test_word_splitw_equalities.p8:2099 verify_success(64) - lda #$40 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:1610 sub test_not_var() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $22b8, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend - ; source: test_word_splitw_equalities.p8:2101 sub test_is_expr() { - -p8s_test_is_expr .proc -; statements - ; source: test_word_splitw_equalities.p8:2102 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:2103 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_splitw_equalities.p8:2104 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_splitw_equalities.p8:2105 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2106 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2108 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl1a -+ - ; source: test_word_splitw_equalities.p8:2110 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:2111 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2112 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:2114 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2115 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2117 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:2118 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2119 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:2121 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_255_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_255_afterif - ; source: test_word_splitw_equalities.p8:2122 success++ - inc p8b_main.p8v_success -label_asm_255_afterif - ; source: test_word_splitw_equalities.p8:2125 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_257_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_257_else - ; source: test_word_splitw_equalities.p8:2126 success++ - inc p8b_main.p8v_success - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_splitw_equalities.p8:2128 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_word_splitw_equalities.p8:2131 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl2a -+ - ; source: test_word_splitw_equalities.p8:2133 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:2134 lbl2a: fail_word(161,-21829) -p8l_lbl2a - lda #<$a1 - ldy #>$a1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2135 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:2137 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2138 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2140 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:2141 lbl2b: fail_word(162,-21829) -p8l_lbl2b - lda #<$a2 - ldy #>$a2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2142 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:2144 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_258_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_258_afterif - ; source: test_word_splitw_equalities.p8:2145 fail_word(163,-21829) - lda #<$a3 - ldy #>$a3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_258_afterif - ; source: test_word_splitw_equalities.p8:2148 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_260_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_260_else - ; source: test_word_splitw_equalities.p8:2149 fail_word(164,-21829) - lda #<$a4 - ldy #>$a4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_splitw_equalities.p8:2151 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_word_splitw_equalities.p8:2154 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl3a -+ - ; source: test_word_splitw_equalities.p8:2156 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:2157 lbl3a: fail_word(165,-21829) -p8l_lbl3a - lda #<$a5 - ldy #>$a5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2158 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:2160 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2161 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2163 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:2164 lbl3b: fail_word(166,-21829) -p8l_lbl3b - lda #<$a6 - ldy #>$a6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2165 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:2167 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_261_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_261_afterif - ; source: test_word_splitw_equalities.p8:2168 fail_word(167,-21829) - lda #<$a7 - ldy #>$a7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_261_afterif - ; source: test_word_splitw_equalities.p8:2171 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_263_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_263_else - ; source: test_word_splitw_equalities.p8:2172 fail_word(168,-21829) - lda #<$a8 - ldy #>$a8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_splitw_equalities.p8:2174 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_word_splitw_equalities.p8:2177 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl4a -+ - ; source: test_word_splitw_equalities.p8:2179 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:2180 lbl4a: fail_word(169,-21829) -p8l_lbl4a - lda #<$a9 - ldy #>$a9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2181 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:2183 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2184 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2186 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:2187 lbl4b: fail_word(170,-21829) -p8l_lbl4b - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2188 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:2190 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_264_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_264_afterif - ; source: test_word_splitw_equalities.p8:2191 fail_word(171,-21829) - lda #<$ab - ldy #>$ab - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_264_afterif - ; source: test_word_splitw_equalities.p8:2194 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_266_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_266_else - ; source: test_word_splitw_equalities.p8:2195 fail_word(172,-21829) - lda #<$ac - ldy #>$ac - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_splitw_equalities.p8:2197 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_word_splitw_equalities.p8:2199 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2201 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl5a -+ - ; source: test_word_splitw_equalities.p8:2203 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:2204 lbl5a: fail_word(173,0) -p8l_lbl5a - lda #<$ad - ldy #>$ad - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2205 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:2207 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2208 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2210 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:2211 lbl5b: fail_word(174,0) -p8l_lbl5b - lda #<$ae - ldy #>$ae - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2212 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:2214 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_267_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_267_afterif - ; source: test_word_splitw_equalities.p8:2215 fail_word(175,0) - lda #<$af - ldy #>$af - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_267_afterif - ; source: test_word_splitw_equalities.p8:2218 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_269_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_269_else - ; source: test_word_splitw_equalities.p8:2219 fail_word(176,0) - lda #<$b0 - ldy #>$b0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_splitw_equalities.p8:2221 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_word_splitw_equalities.p8:2224 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl6a -+ - ; source: test_word_splitw_equalities.p8:2226 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:2227 lbl6a: fail_word(177,0) -p8l_lbl6a - lda #<$b1 - ldy #>$b1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2228 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:2230 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2231 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2233 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:2234 lbl6b: fail_word(178,0) -p8l_lbl6b - lda #<$b2 - ldy #>$b2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2235 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:2237 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_270_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_270_afterif - ; source: test_word_splitw_equalities.p8:2238 fail_word(179,0) - lda #<$b3 - ldy #>$b3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_270_afterif - ; source: test_word_splitw_equalities.p8:2241 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_272_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_272_else - ; source: test_word_splitw_equalities.p8:2242 fail_word(180,0) - lda #<$b4 - ldy #>$b4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_splitw_equalities.p8:2244 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_word_splitw_equalities.p8:2247 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl7a -+ - ; source: test_word_splitw_equalities.p8:2249 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:2250 lbl7a: fail_word(181,0) -p8l_lbl7a - lda #<$b5 - ldy #>$b5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2251 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:2253 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2254 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2256 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:2257 lbl7b: fail_word(182,0) -p8l_lbl7b - lda #<$b6 - ldy #>$b6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2258 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:2260 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_273_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_273_afterif - ; source: test_word_splitw_equalities.p8:2261 fail_word(183,0) - lda #<$b7 - ldy #>$b7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_273_afterif - ; source: test_word_splitw_equalities.p8:2264 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_275_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_275_else - ; source: test_word_splitw_equalities.p8:2265 fail_word(184,0) - lda #<$b8 - ldy #>$b8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_splitw_equalities.p8:2267 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_word_splitw_equalities.p8:2270 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl8a -+ - ; source: test_word_splitw_equalities.p8:2272 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:2273 lbl8a: fail_word(185,0) -p8l_lbl8a - lda #<$b9 - ldy #>$b9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2274 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:2276 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2277 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2279 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:2280 lbl8b: fail_word(186,0) -p8l_lbl8b - lda #<$ba - ldy #>$ba - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2281 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:2283 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_276_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_276_afterif - ; source: test_word_splitw_equalities.p8:2284 fail_word(187,0) - lda #<$bb - ldy #>$bb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_276_afterif - ; source: test_word_splitw_equalities.p8:2287 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_278_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_278_else - ; source: test_word_splitw_equalities.p8:2288 fail_word(188,0) - lda #<$bc - ldy #>$bc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_splitw_equalities.p8:2290 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_word_splitw_equalities.p8:2292 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2294 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl9a -+ - ; source: test_word_splitw_equalities.p8:2296 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:2297 lbl9a: fail_word(189,170) -p8l_lbl9a - lda #<$bd - ldy #>$bd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2298 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:2300 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2301 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2303 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:2304 lbl9b: fail_word(190,170) -p8l_lbl9b - lda #<$be - ldy #>$be - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2305 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:2307 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_279_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_279_afterif - ; source: test_word_splitw_equalities.p8:2308 fail_word(191,170) - lda #<$bf - ldy #>$bf - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_279_afterif - ; source: test_word_splitw_equalities.p8:2311 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_281_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_281_else - ; source: test_word_splitw_equalities.p8:2312 fail_word(192,170) - lda #<$c0 - ldy #>$c0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_splitw_equalities.p8:2314 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_word_splitw_equalities.p8:2317 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl10a -+ - ; source: test_word_splitw_equalities.p8:2319 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:2320 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2321 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:2323 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2324 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2326 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:2327 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2328 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:2330 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_282_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_282_afterif - ; source: test_word_splitw_equalities.p8:2331 success++ - inc p8b_main.p8v_success -label_asm_282_afterif - ; source: test_word_splitw_equalities.p8:2334 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_284_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_284_else - ; source: test_word_splitw_equalities.p8:2335 success++ - inc p8b_main.p8v_success - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_splitw_equalities.p8:2337 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_word_splitw_equalities.p8:2340 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl11a -+ - ; source: test_word_splitw_equalities.p8:2342 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:2343 lbl11a: fail_word(193,170) -p8l_lbl11a - lda #<$c1 - ldy #>$c1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2344 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:2346 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2347 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2349 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:2350 lbl11b: fail_word(194,170) -p8l_lbl11b - lda #<$c2 - ldy #>$c2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2351 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:2353 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_285_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_285_afterif - ; source: test_word_splitw_equalities.p8:2354 fail_word(195,170) - lda #<$c3 - ldy #>$c3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_285_afterif - ; source: test_word_splitw_equalities.p8:2357 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_287_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_287_else - ; source: test_word_splitw_equalities.p8:2358 fail_word(196,170) - lda #<$c4 - ldy #>$c4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_splitw_equalities.p8:2360 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_word_splitw_equalities.p8:2363 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl12a -+ - ; source: test_word_splitw_equalities.p8:2365 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:2366 lbl12a: fail_word(197,170) -p8l_lbl12a - lda #<$c5 - ldy #>$c5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2367 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:2369 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2370 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2372 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:2373 lbl12b: fail_word(198,170) -p8l_lbl12b - lda #<$c6 - ldy #>$c6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2374 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:2376 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_288_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_288_afterif - ; source: test_word_splitw_equalities.p8:2377 fail_word(199,170) - lda #<$c7 - ldy #>$c7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_288_afterif - ; source: test_word_splitw_equalities.p8:2380 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_290_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_290_else - ; source: test_word_splitw_equalities.p8:2381 fail_word(200,170) - lda #<$c8 - ldy #>$c8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_splitw_equalities.p8:2383 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_word_splitw_equalities.p8:2385 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2387 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl13a -+ - ; source: test_word_splitw_equalities.p8:2389 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:2390 lbl13a: fail_word(201,30464) -p8l_lbl13a - lda #<$c9 - ldy #>$c9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2391 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:2393 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2394 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2396 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:2397 lbl13b: fail_word(202,30464) -p8l_lbl13b - lda #<$ca - ldy #>$ca - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2398 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:2400 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_291_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_291_afterif - ; source: test_word_splitw_equalities.p8:2401 fail_word(203,30464) - lda #<$cb - ldy #>$cb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_291_afterif - ; source: test_word_splitw_equalities.p8:2404 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_293_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_293_else - ; source: test_word_splitw_equalities.p8:2405 fail_word(204,30464) - lda #<$cc - ldy #>$cc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_splitw_equalities.p8:2407 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_word_splitw_equalities.p8:2410 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl14a -+ - ; source: test_word_splitw_equalities.p8:2412 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:2413 lbl14a: fail_word(205,30464) -p8l_lbl14a - lda #<$cd - ldy #>$cd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2414 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:2416 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2417 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2419 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:2420 lbl14b: fail_word(206,30464) -p8l_lbl14b - lda #<$ce - ldy #>$ce - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2421 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:2423 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_294_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_294_afterif - ; source: test_word_splitw_equalities.p8:2424 fail_word(207,30464) - lda #<$cf - ldy #>$cf - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_294_afterif - ; source: test_word_splitw_equalities.p8:2427 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_296_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_296_else - ; source: test_word_splitw_equalities.p8:2428 fail_word(208,30464) - lda #<$d0 - ldy #>$d0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_splitw_equalities.p8:2430 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_word_splitw_equalities.p8:2433 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl15a -+ - ; source: test_word_splitw_equalities.p8:2435 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:2436 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2437 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:2439 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2440 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2442 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:2443 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2444 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:2446 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_297_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_297_afterif - ; source: test_word_splitw_equalities.p8:2447 success++ - inc p8b_main.p8v_success -label_asm_297_afterif - ; source: test_word_splitw_equalities.p8:2450 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_299_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_299_else - ; source: test_word_splitw_equalities.p8:2451 success++ - inc p8b_main.p8v_success - bra label_asm_298_afterif -label_asm_299_else - ; source: test_word_splitw_equalities.p8:2453 cx16.r0L++ - inc cx16.r0L -label_asm_298_afterif - ; source: test_word_splitw_equalities.p8:2456 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl16a -+ - ; source: test_word_splitw_equalities.p8:2458 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:2459 lbl16a: fail_word(209,30464) -p8l_lbl16a - lda #<$d1 - ldy #>$d1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2460 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:2462 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2463 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2465 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:2466 lbl16b: fail_word(210,30464) -p8l_lbl16b - lda #<$d2 - ldy #>$d2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2467 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:2469 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_300_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_300_afterif - ; source: test_word_splitw_equalities.p8:2470 fail_word(211,30464) - lda #<$d3 - ldy #>$d3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_300_afterif - ; source: test_word_splitw_equalities.p8:2473 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_302_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_302_else - ; source: test_word_splitw_equalities.p8:2474 fail_word(212,30464) - lda #<$d4 - ldy #>$d4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_301_afterif -label_asm_302_else - ; source: test_word_splitw_equalities.p8:2476 cx16.r0L++ - inc cx16.r0L -label_asm_301_afterif - ; source: test_word_splitw_equalities.p8:2478 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2480 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl17a -+ - ; source: test_word_splitw_equalities.p8:2482 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:2483 lbl17a: fail_word(213,32767) -p8l_lbl17a - lda #<$d5 - ldy #>$d5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2484 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:2486 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2487 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2489 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:2490 lbl17b: fail_word(214,32767) -p8l_lbl17b - lda #<$d6 - ldy #>$d6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2491 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:2493 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_303_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_303_afterif - ; source: test_word_splitw_equalities.p8:2494 fail_word(215,32767) - lda #<$d7 - ldy #>$d7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_303_afterif - ; source: test_word_splitw_equalities.p8:2497 if sources[1]==cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_305_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_305_else - ; source: test_word_splitw_equalities.p8:2498 fail_word(216,32767) - lda #<$d8 - ldy #>$d8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_304_afterif -label_asm_305_else - ; source: test_word_splitw_equalities.p8:2500 cx16.r0L++ - inc cx16.r0L -label_asm_304_afterif - ; source: test_word_splitw_equalities.p8:2503 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl18a -+ - ; source: test_word_splitw_equalities.p8:2505 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:2506 lbl18a: fail_word(217,32767) -p8l_lbl18a - lda #<$d9 - ldy #>$d9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2507 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:2509 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2510 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2512 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:2513 lbl18b: fail_word(218,32767) -p8l_lbl18b - lda #<$da - ldy #>$da - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2514 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:2516 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_306_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_306_afterif - ; source: test_word_splitw_equalities.p8:2517 fail_word(219,32767) - lda #<$db - ldy #>$db - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_306_afterif - ; source: test_word_splitw_equalities.p8:2520 if sources[1]==cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_308_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_308_else - ; source: test_word_splitw_equalities.p8:2521 fail_word(220,32767) - lda #<$dc - ldy #>$dc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_307_afterif -label_asm_308_else - ; source: test_word_splitw_equalities.p8:2523 cx16.r0L++ - inc cx16.r0L -label_asm_307_afterif - ; source: test_word_splitw_equalities.p8:2526 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl19a -+ - ; source: test_word_splitw_equalities.p8:2528 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:2529 lbl19a: fail_word(221,32767) -p8l_lbl19a - lda #<$dd - ldy #>$dd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2530 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:2532 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2533 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2535 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:2536 lbl19b: fail_word(222,32767) -p8l_lbl19b - lda #<$de - ldy #>$de - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2537 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:2539 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_309_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_309_afterif - ; source: test_word_splitw_equalities.p8:2540 fail_word(223,32767) - lda #<$df - ldy #>$df - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_309_afterif - ; source: test_word_splitw_equalities.p8:2543 if sources[1]==cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_311_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_311_else - ; source: test_word_splitw_equalities.p8:2544 fail_word(224,32767) - lda #<$e0 - ldy #>$e0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_310_afterif -label_asm_311_else - ; source: test_word_splitw_equalities.p8:2546 cx16.r0L++ - inc cx16.r0L -label_asm_310_afterif - ; source: test_word_splitw_equalities.p8:2549 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq p8l_lbl20a -+ - ; source: test_word_splitw_equalities.p8:2551 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:2552 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2553 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:2555 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2556 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2558 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:2559 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2560 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:2562 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_312_afterif - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_312_afterif - ; source: test_word_splitw_equalities.p8:2563 success++ - inc p8b_main.p8v_success -label_asm_312_afterif - ; source: test_word_splitw_equalities.p8:2566 if sources[1]==cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne label_asm_314_else - cpy P8ZP_SCRATCH_W1+1 - bne label_asm_314_else - ; source: test_word_splitw_equalities.p8:2567 success++ - inc p8b_main.p8v_success - bra label_asm_313_afterif -label_asm_314_else - ; source: test_word_splitw_equalities.p8:2569 cx16.r0L++ - inc cx16.r0L -label_asm_313_afterif - ; source: test_word_splitw_equalities.p8:2571 verify_success(16) - lda #$10 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:2101 sub test_is_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_word_splitw_equalities.p8:2573 sub test_not_expr() { - -p8s_test_not_expr .proc -; statements - ; source: test_word_splitw_equalities.p8:2574 word[] @split sources = [9999, 9999] - ; source: test_word_splitw_equalities.p8:2575 cx16.r4 = 1 - lda #<1 - ldy #>1 - sta cx16.r4 - sty cx16.r4+1 - - ; source: test_word_splitw_equalities.p8:2576 cx16.r5 = 1 - sta cx16.r5 - sty cx16.r5+1 - - ; source: test_word_splitw_equalities.p8:2577 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2578 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2580 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl1a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl1a - ; source: test_word_splitw_equalities.p8:2582 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:2583 lbl1a: fail_word(225,-21829) -p8l_lbl1a - lda #<$e1 - ldy #>$e1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2584 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:2586 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2587 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2589 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:2590 lbl1b: fail_word(226,-21829) -p8l_lbl1b - lda #<$e2 - ldy #>$e2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2591 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:2593 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_315_afterif -+ - ; source: test_word_splitw_equalities.p8:2594 fail_word(227,-21829) - lda #<$e3 - ldy #>$e3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_315_afterif - ; source: test_word_splitw_equalities.p8:2597 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_317_else -+ - ; source: test_word_splitw_equalities.p8:2598 fail_word(228,-21829) - lda #<$e4 - ldy #>$e4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_316_afterif -label_asm_317_else - ; source: test_word_splitw_equalities.p8:2600 cx16.r0L++ - inc cx16.r0L -label_asm_316_afterif - ; source: test_word_splitw_equalities.p8:2603 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl2a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl2a - ; source: test_word_splitw_equalities.p8:2605 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:2606 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2607 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:2609 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2610 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2612 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:2613 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2614 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:2616 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_318_afterif -+ - ; source: test_word_splitw_equalities.p8:2617 success++ - inc p8b_main.p8v_success -label_asm_318_afterif - ; source: test_word_splitw_equalities.p8:2620 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_320_else -+ - ; source: test_word_splitw_equalities.p8:2621 success++ - inc p8b_main.p8v_success - bra label_asm_319_afterif -label_asm_320_else - ; source: test_word_splitw_equalities.p8:2623 cx16.r0L++ - inc cx16.r0L -label_asm_319_afterif - ; source: test_word_splitw_equalities.p8:2626 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl3a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl3a - ; source: test_word_splitw_equalities.p8:2628 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:2629 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2630 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:2632 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2633 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2635 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:2636 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2637 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:2639 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_321_afterif -+ - ; source: test_word_splitw_equalities.p8:2640 success++ - inc p8b_main.p8v_success -label_asm_321_afterif - ; source: test_word_splitw_equalities.p8:2643 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_323_else -+ - ; source: test_word_splitw_equalities.p8:2644 success++ - inc p8b_main.p8v_success - bra label_asm_322_afterif -label_asm_323_else - ; source: test_word_splitw_equalities.p8:2646 cx16.r0L++ - inc cx16.r0L -label_asm_322_afterif - ; source: test_word_splitw_equalities.p8:2649 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl4a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl4a - ; source: test_word_splitw_equalities.p8:2651 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:2652 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2653 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:2655 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2656 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2658 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:2659 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2660 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:2662 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_324_afterif -+ - ; source: test_word_splitw_equalities.p8:2663 success++ - inc p8b_main.p8v_success -label_asm_324_afterif - ; source: test_word_splitw_equalities.p8:2666 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_326_else -+ - ; source: test_word_splitw_equalities.p8:2667 success++ - inc p8b_main.p8v_success - bra label_asm_325_afterif -label_asm_326_else - ; source: test_word_splitw_equalities.p8:2669 cx16.r0L++ - inc cx16.r0L -label_asm_325_afterif - ; source: test_word_splitw_equalities.p8:2671 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2673 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl5a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl5a - ; source: test_word_splitw_equalities.p8:2675 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:2676 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2677 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:2679 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2680 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2682 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:2683 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2684 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:2686 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_327_afterif -+ - ; source: test_word_splitw_equalities.p8:2687 success++ - inc p8b_main.p8v_success -label_asm_327_afterif - ; source: test_word_splitw_equalities.p8:2690 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_329_else -+ - ; source: test_word_splitw_equalities.p8:2691 success++ - inc p8b_main.p8v_success - bra label_asm_328_afterif -label_asm_329_else - ; source: test_word_splitw_equalities.p8:2693 cx16.r0L++ - inc cx16.r0L -label_asm_328_afterif - ; source: test_word_splitw_equalities.p8:2696 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl6a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl6a - ; source: test_word_splitw_equalities.p8:2698 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:2699 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2700 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:2702 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2703 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2705 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:2706 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2707 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:2709 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_330_afterif -+ - ; source: test_word_splitw_equalities.p8:2710 success++ - inc p8b_main.p8v_success -label_asm_330_afterif - ; source: test_word_splitw_equalities.p8:2713 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_332_else -+ - ; source: test_word_splitw_equalities.p8:2714 success++ - inc p8b_main.p8v_success - bra label_asm_331_afterif -label_asm_332_else - ; source: test_word_splitw_equalities.p8:2716 cx16.r0L++ - inc cx16.r0L -label_asm_331_afterif - ; source: test_word_splitw_equalities.p8:2719 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl7a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl7a - ; source: test_word_splitw_equalities.p8:2721 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:2722 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2723 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:2725 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2726 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2728 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:2729 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2730 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:2732 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_333_afterif -+ - ; source: test_word_splitw_equalities.p8:2733 success++ - inc p8b_main.p8v_success -label_asm_333_afterif - ; source: test_word_splitw_equalities.p8:2736 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_335_else -+ - ; source: test_word_splitw_equalities.p8:2737 success++ - inc p8b_main.p8v_success - bra label_asm_334_afterif -label_asm_335_else - ; source: test_word_splitw_equalities.p8:2739 cx16.r0L++ - inc cx16.r0L -label_asm_334_afterif - ; source: test_word_splitw_equalities.p8:2742 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl8a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl8a - ; source: test_word_splitw_equalities.p8:2744 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:2745 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2746 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:2748 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2749 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2751 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:2752 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2753 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:2755 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_336_afterif -+ - ; source: test_word_splitw_equalities.p8:2756 success++ - inc p8b_main.p8v_success -label_asm_336_afterif - ; source: test_word_splitw_equalities.p8:2759 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_338_else -+ - ; source: test_word_splitw_equalities.p8:2760 success++ - inc p8b_main.p8v_success - bra label_asm_337_afterif -label_asm_338_else - ; source: test_word_splitw_equalities.p8:2762 cx16.r0L++ - inc cx16.r0L -label_asm_337_afterif - ; source: test_word_splitw_equalities.p8:2764 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2766 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl9a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl9a - ; source: test_word_splitw_equalities.p8:2768 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:2769 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2770 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:2772 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2773 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2775 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:2776 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2777 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:2779 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_339_afterif -+ - ; source: test_word_splitw_equalities.p8:2780 success++ - inc p8b_main.p8v_success -label_asm_339_afterif - ; source: test_word_splitw_equalities.p8:2783 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_341_else -+ - ; source: test_word_splitw_equalities.p8:2784 success++ - inc p8b_main.p8v_success - bra label_asm_340_afterif -label_asm_341_else - ; source: test_word_splitw_equalities.p8:2786 cx16.r0L++ - inc cx16.r0L -label_asm_340_afterif - ; source: test_word_splitw_equalities.p8:2789 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl10a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl10a - ; source: test_word_splitw_equalities.p8:2791 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:2792 lbl10a: fail_word(229,170) -p8l_lbl10a - lda #<$e5 - ldy #>$e5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2793 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:2795 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2796 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2798 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:2799 lbl10b: fail_word(230,170) -p8l_lbl10b - lda #<$e6 - ldy #>$e6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2800 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:2802 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_342_afterif -+ - ; source: test_word_splitw_equalities.p8:2803 fail_word(231,170) - lda #<$e7 - ldy #>$e7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_342_afterif - ; source: test_word_splitw_equalities.p8:2806 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_344_else -+ - ; source: test_word_splitw_equalities.p8:2807 fail_word(232,170) - lda #<$e8 - ldy #>$e8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_343_afterif -label_asm_344_else - ; source: test_word_splitw_equalities.p8:2809 cx16.r0L++ - inc cx16.r0L -label_asm_343_afterif - ; source: test_word_splitw_equalities.p8:2812 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl11a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl11a - ; source: test_word_splitw_equalities.p8:2814 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:2815 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2816 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:2818 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2819 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2821 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:2822 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2823 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:2825 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_345_afterif -+ - ; source: test_word_splitw_equalities.p8:2826 success++ - inc p8b_main.p8v_success -label_asm_345_afterif - ; source: test_word_splitw_equalities.p8:2829 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_347_else -+ - ; source: test_word_splitw_equalities.p8:2830 success++ - inc p8b_main.p8v_success - bra label_asm_346_afterif -label_asm_347_else - ; source: test_word_splitw_equalities.p8:2832 cx16.r0L++ - inc cx16.r0L -label_asm_346_afterif - ; source: test_word_splitw_equalities.p8:2835 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl12a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl12a - ; source: test_word_splitw_equalities.p8:2837 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:2838 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2839 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:2841 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2842 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2844 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:2845 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2846 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:2848 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_348_afterif -+ - ; source: test_word_splitw_equalities.p8:2849 success++ - inc p8b_main.p8v_success -label_asm_348_afterif - ; source: test_word_splitw_equalities.p8:2852 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_350_else -+ - ; source: test_word_splitw_equalities.p8:2853 success++ - inc p8b_main.p8v_success - bra label_asm_349_afterif -label_asm_350_else - ; source: test_word_splitw_equalities.p8:2855 cx16.r0L++ - inc cx16.r0L -label_asm_349_afterif - ; source: test_word_splitw_equalities.p8:2857 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2859 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl13a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl13a - ; source: test_word_splitw_equalities.p8:2861 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:2862 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2863 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:2865 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2866 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2868 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:2869 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2870 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:2872 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_351_afterif -+ - ; source: test_word_splitw_equalities.p8:2873 success++ - inc p8b_main.p8v_success -label_asm_351_afterif - ; source: test_word_splitw_equalities.p8:2876 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_353_else -+ - ; source: test_word_splitw_equalities.p8:2877 success++ - inc p8b_main.p8v_success - bra label_asm_352_afterif -label_asm_353_else - ; source: test_word_splitw_equalities.p8:2879 cx16.r0L++ - inc cx16.r0L -label_asm_352_afterif - ; source: test_word_splitw_equalities.p8:2882 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl14a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl14a - ; source: test_word_splitw_equalities.p8:2884 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:2885 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2886 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:2888 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2889 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2891 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:2892 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2893 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:2895 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_354_afterif -+ - ; source: test_word_splitw_equalities.p8:2896 success++ - inc p8b_main.p8v_success -label_asm_354_afterif - ; source: test_word_splitw_equalities.p8:2899 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_356_else -+ - ; source: test_word_splitw_equalities.p8:2900 success++ - inc p8b_main.p8v_success - bra label_asm_355_afterif -label_asm_356_else - ; source: test_word_splitw_equalities.p8:2902 cx16.r0L++ - inc cx16.r0L -label_asm_355_afterif - ; source: test_word_splitw_equalities.p8:2905 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl15a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl15a - ; source: test_word_splitw_equalities.p8:2907 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:2908 lbl15a: fail_word(233,30464) -p8l_lbl15a - lda #<$e9 - ldy #>$e9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2909 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:2911 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2912 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2914 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:2915 lbl15b: fail_word(234,30464) -p8l_lbl15b - lda #<$ea - ldy #>$ea - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:2916 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:2918 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_357_afterif -+ - ; source: test_word_splitw_equalities.p8:2919 fail_word(235,30464) - lda #<$eb - ldy #>$eb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_357_afterif - ; source: test_word_splitw_equalities.p8:2922 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_359_else -+ - ; source: test_word_splitw_equalities.p8:2923 fail_word(236,30464) - lda #<$ec - ldy #>$ec - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_358_afterif -label_asm_359_else - ; source: test_word_splitw_equalities.p8:2925 cx16.r0L++ - inc cx16.r0L -label_asm_358_afterif - ; source: test_word_splitw_equalities.p8:2928 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl16a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl16a - ; source: test_word_splitw_equalities.p8:2930 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:2931 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2932 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:2934 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2935 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2937 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:2938 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2939 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:2941 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_360_afterif -+ - ; source: test_word_splitw_equalities.p8:2942 success++ - inc p8b_main.p8v_success -label_asm_360_afterif - ; source: test_word_splitw_equalities.p8:2945 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_362_else -+ - ; source: test_word_splitw_equalities.p8:2946 success++ - inc p8b_main.p8v_success - bra label_asm_361_afterif -label_asm_362_else - ; source: test_word_splitw_equalities.p8:2948 cx16.r0L++ - inc cx16.r0L -label_asm_361_afterif - ; source: test_word_splitw_equalities.p8:2950 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:2952 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl17a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl17a - ; source: test_word_splitw_equalities.p8:2954 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:2955 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2956 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:2958 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2959 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2961 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:2962 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2963 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:2965 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_363_afterif -+ - ; source: test_word_splitw_equalities.p8:2966 success++ - inc p8b_main.p8v_success -label_asm_363_afterif - ; source: test_word_splitw_equalities.p8:2969 if sources[1]!=cx16.r4s+-21829-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - sec - sbc #<$5545 - tax - tya - sbc #>$5545 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_365_else -+ - ; source: test_word_splitw_equalities.p8:2970 success++ - inc p8b_main.p8v_success - bra label_asm_364_afterif -label_asm_365_else - ; source: test_word_splitw_equalities.p8:2972 cx16.r0L++ - inc cx16.r0L -label_asm_364_afterif - ; source: test_word_splitw_equalities.p8:2975 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl18a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl18a - ; source: test_word_splitw_equalities.p8:2977 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:2978 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2979 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:2981 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:2982 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:2984 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:2985 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:2986 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:2988 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_366_afterif -+ - ; source: test_word_splitw_equalities.p8:2989 success++ - inc p8b_main.p8v_success -label_asm_366_afterif - ; source: test_word_splitw_equalities.p8:2992 if sources[1]!=cx16.r4s+170-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$aa - tax - tya - adc #>$aa - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_368_else -+ - ; source: test_word_splitw_equalities.p8:2993 success++ - inc p8b_main.p8v_success - bra label_asm_367_afterif -label_asm_368_else - ; source: test_word_splitw_equalities.p8:2995 cx16.r0L++ - inc cx16.r0L -label_asm_367_afterif - ; source: test_word_splitw_equalities.p8:2998 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl19a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl19a - ; source: test_word_splitw_equalities.p8:3000 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:3001 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3002 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:3004 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3005 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3007 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:3008 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3009 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:3011 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_369_afterif -+ - ; source: test_word_splitw_equalities.p8:3012 success++ - inc p8b_main.p8v_success -label_asm_369_afterif - ; source: test_word_splitw_equalities.p8:3015 if sources[1]!=cx16.r4s+30464-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7700 - tax - tya - adc #>$7700 - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_371_else -+ - ; source: test_word_splitw_equalities.p8:3016 success++ - inc p8b_main.p8v_success - bra label_asm_370_afterif -label_asm_371_else - ; source: test_word_splitw_equalities.p8:3018 cx16.r0L++ - inc cx16.r0L -label_asm_370_afterif - ; source: test_word_splitw_equalities.p8:3021 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne p8l_lbl20a - cpy P8ZP_SCRATCH_W1+1 - bne p8l_lbl20a - ; source: test_word_splitw_equalities.p8:3023 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:3024 lbl20a: fail_word(237,32767) -p8l_lbl20a - lda #<$ed - ldy #>$ed - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3025 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:3027 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3028 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3030 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:3031 lbl20b: fail_word(238,32767) -p8l_lbl20b - lda #<$ee - ldy #>$ee - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3032 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:3034 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_372_afterif -+ - ; source: test_word_splitw_equalities.p8:3035 fail_word(239,32767) - lda #<$ef - ldy #>$ef - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_372_afterif - ; source: test_word_splitw_equalities.p8:3038 if sources[1]!=cx16.r4s+32767-cx16.r5s - ldy cx16.r4s+1 - lda cx16.r4s - clc - adc #<$7fff - tax - tya - adc #>$7fff - tay - txa - sec - sbc cx16.r5s - tax - tya - sbc cx16.r5s+1 - tay - txa - pha - phy - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ply - pla - cmp P8ZP_SCRATCH_W1 - bne + - cpy P8ZP_SCRATCH_W1+1 - beq label_asm_374_else -+ - ; source: test_word_splitw_equalities.p8:3039 fail_word(240,32767) - lda #<$f0 - ldy #>$f0 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_373_afterif -label_asm_374_else - ; source: test_word_splitw_equalities.p8:3041 cx16.r0L++ - inc cx16.r0L -label_asm_373_afterif - ; source: test_word_splitw_equalities.p8:3043 verify_success(64) - lda #$40 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:2573 sub test_not_expr() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $270f -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources - .pend - ; source: test_word_splitw_equalities.p8:3045 sub test_is_array_splitw() { - -p8s_test_is_array_splitw .proc -; statements - ; source: test_word_splitw_equalities.p8:3047 word[] @split values = [9999, 8888] - ; source: test_word_splitw_equalities.p8:3048 word[] @split sources = [9999, 8888] - ; source: test_word_splitw_equalities.p8:3049 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3050 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3051 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:3052 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3054 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1a -+ - ; source: test_word_splitw_equalities.p8:3056 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:3057 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3058 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:3060 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3061 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3063 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:3064 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3065 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:3067 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_375_afterif - cpy p8v_sources_msb+1 - bne label_asm_375_afterif - ; source: test_word_splitw_equalities.p8:3068 success++ - inc p8b_main.p8v_success -label_asm_375_afterif - ; source: test_word_splitw_equalities.p8:3071 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_377_else - cpy p8v_sources_msb+1 - bne label_asm_377_else - ; source: test_word_splitw_equalities.p8:3072 success++ - inc p8b_main.p8v_success - bra label_asm_376_afterif -label_asm_377_else - ; source: test_word_splitw_equalities.p8:3074 cx16.r0L++ - inc cx16.r0L -label_asm_376_afterif - ; source: test_word_splitw_equalities.p8:3077 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl1c -+ - ; source: test_word_splitw_equalities.p8:3079 goto skip1c - bra p8l_skip1c - ; source: test_word_splitw_equalities.p8:3080 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3081 skip1c: -p8l_skip1c - ; source: test_word_splitw_equalities.p8:3083 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3084 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3086 goto skip1d - bra p8l_skip1d - ; source: test_word_splitw_equalities.p8:3087 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3088 skip1d: -p8l_skip1d - ; source: test_word_splitw_equalities.p8:3090 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_378_afterif - cpy p8v_sources_msb+1 - bne label_asm_378_afterif - ; source: test_word_splitw_equalities.p8:3091 success++ - inc p8b_main.p8v_success -label_asm_378_afterif - ; source: test_word_splitw_equalities.p8:3094 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_380_else - cpy p8v_sources_msb+1 - bne label_asm_380_else - ; source: test_word_splitw_equalities.p8:3095 success++ - inc p8b_main.p8v_success - bra label_asm_379_afterif -label_asm_380_else - ; source: test_word_splitw_equalities.p8:3097 cx16.r0L++ - inc cx16.r0L -label_asm_379_afterif - ; source: test_word_splitw_equalities.p8:3099 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3101 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2a -+ - ; source: test_word_splitw_equalities.p8:3103 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:3104 lbl2a: fail_word(241,-21829) -p8l_lbl2a - lda #<$f1 - ldy #>$f1 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3105 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:3107 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3108 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3110 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:3111 lbl2b: fail_word(242,-21829) -p8l_lbl2b - lda #<$f2 - ldy #>$f2 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3112 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:3114 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_381_afterif - cpy p8v_sources_msb+1 - bne label_asm_381_afterif - ; source: test_word_splitw_equalities.p8:3115 fail_word(243,-21829) - lda #<$f3 - ldy #>$f3 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_381_afterif - ; source: test_word_splitw_equalities.p8:3118 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_383_else - cpy p8v_sources_msb+1 - bne label_asm_383_else - ; source: test_word_splitw_equalities.p8:3119 fail_word(244,-21829) - lda #<$f4 - ldy #>$f4 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_382_afterif -label_asm_383_else - ; source: test_word_splitw_equalities.p8:3121 cx16.r0L++ - inc cx16.r0L -label_asm_382_afterif - ; source: test_word_splitw_equalities.p8:3124 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl2c -+ - ; source: test_word_splitw_equalities.p8:3126 goto skip2c - bra p8l_skip2c - ; source: test_word_splitw_equalities.p8:3127 lbl2c: fail_word(245,-21829) -p8l_lbl2c - lda #<$f5 - ldy #>$f5 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3128 skip2c: -p8l_skip2c - ; source: test_word_splitw_equalities.p8:3130 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3131 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3133 goto skip2d - bra p8l_skip2d - ; source: test_word_splitw_equalities.p8:3134 lbl2d: fail_word(246,-21829) -p8l_lbl2d - lda #<$f6 - ldy #>$f6 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3135 skip2d: -p8l_skip2d - ; source: test_word_splitw_equalities.p8:3137 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_384_afterif - cpy p8v_sources_msb+1 - bne label_asm_384_afterif - ; source: test_word_splitw_equalities.p8:3138 fail_word(247,-21829) - lda #<$f7 - ldy #>$f7 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_384_afterif - ; source: test_word_splitw_equalities.p8:3141 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_386_else - cpy p8v_sources_msb+1 - bne label_asm_386_else - ; source: test_word_splitw_equalities.p8:3142 fail_word(248,-21829) - lda #<$f8 - ldy #>$f8 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_385_afterif -label_asm_386_else - ; source: test_word_splitw_equalities.p8:3144 cx16.r0L++ - inc cx16.r0L -label_asm_385_afterif - ; source: test_word_splitw_equalities.p8:3146 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3148 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3a -+ - ; source: test_word_splitw_equalities.p8:3150 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:3151 lbl3a: fail_word(249,-21829) -p8l_lbl3a - lda #<$f9 - ldy #>$f9 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3152 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:3154 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3155 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3157 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:3158 lbl3b: fail_word(250,-21829) -p8l_lbl3b - lda #<$fa - ldy #>$fa - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3159 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:3161 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_387_afterif - cpy p8v_sources_msb+1 - bne label_asm_387_afterif - ; source: test_word_splitw_equalities.p8:3162 fail_word(251,-21829) - lda #<$fb - ldy #>$fb - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_387_afterif - ; source: test_word_splitw_equalities.p8:3165 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_389_else - cpy p8v_sources_msb+1 - bne label_asm_389_else - ; source: test_word_splitw_equalities.p8:3166 fail_word(252,-21829) - lda #<$fc - ldy #>$fc - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_388_afterif -label_asm_389_else - ; source: test_word_splitw_equalities.p8:3168 cx16.r0L++ - inc cx16.r0L -label_asm_388_afterif - ; source: test_word_splitw_equalities.p8:3171 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl3c -+ - ; source: test_word_splitw_equalities.p8:3173 goto skip3c - bra p8l_skip3c - ; source: test_word_splitw_equalities.p8:3174 lbl3c: fail_word(253,-21829) -p8l_lbl3c - lda #<$fd - ldy #>$fd - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3175 skip3c: -p8l_skip3c - ; source: test_word_splitw_equalities.p8:3177 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3178 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3180 goto skip3d - bra p8l_skip3d - ; source: test_word_splitw_equalities.p8:3181 lbl3d: fail_word(254,-21829) -p8l_lbl3d - lda #<$fe - ldy #>$fe - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3182 skip3d: -p8l_skip3d - ; source: test_word_splitw_equalities.p8:3184 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_390_afterif - cpy p8v_sources_msb+1 - bne label_asm_390_afterif - ; source: test_word_splitw_equalities.p8:3185 fail_word(255,-21829) - lda #<$ff - ldy #>$ff - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_390_afterif - ; source: test_word_splitw_equalities.p8:3188 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_392_else - cpy p8v_sources_msb+1 - bne label_asm_392_else - ; source: test_word_splitw_equalities.p8:3189 fail_word(256,-21829) - lda #<$0100 - ldy #>$0100 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_391_afterif -label_asm_392_else - ; source: test_word_splitw_equalities.p8:3191 cx16.r0L++ - inc cx16.r0L -label_asm_391_afterif - ; source: test_word_splitw_equalities.p8:3193 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3195 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4a -+ - ; source: test_word_splitw_equalities.p8:3197 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:3198 lbl4a: fail_word(257,-21829) -p8l_lbl4a - lda #1 - sta p8b_main.p8s_fail_word.p8v_idx - sta p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3199 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:3201 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3202 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3204 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:3205 lbl4b: fail_word(258,-21829) -p8l_lbl4b - lda #<$0102 - ldy #>$0102 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3206 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:3208 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_393_afterif - cpy p8v_sources_msb+1 - bne label_asm_393_afterif - ; source: test_word_splitw_equalities.p8:3209 fail_word(259,-21829) - lda #<$0103 - ldy #>$0103 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_393_afterif - ; source: test_word_splitw_equalities.p8:3212 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_395_else - cpy p8v_sources_msb+1 - bne label_asm_395_else - ; source: test_word_splitw_equalities.p8:3213 fail_word(260,-21829) - lda #<$0104 - ldy #>$0104 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_394_afterif -label_asm_395_else - ; source: test_word_splitw_equalities.p8:3215 cx16.r0L++ - inc cx16.r0L -label_asm_394_afterif - ; source: test_word_splitw_equalities.p8:3218 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl4c -+ - ; source: test_word_splitw_equalities.p8:3220 goto skip4c - bra p8l_skip4c - ; source: test_word_splitw_equalities.p8:3221 lbl4c: fail_word(261,-21829) -p8l_lbl4c - lda #<$0105 - ldy #>$0105 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3222 skip4c: -p8l_skip4c - ; source: test_word_splitw_equalities.p8:3224 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3225 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3227 goto skip4d - bra p8l_skip4d - ; source: test_word_splitw_equalities.p8:3228 lbl4d: fail_word(262,-21829) -p8l_lbl4d - lda #<$0106 - ldy #>$0106 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3229 skip4d: -p8l_skip4d - ; source: test_word_splitw_equalities.p8:3231 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_396_afterif - cpy p8v_sources_msb+1 - bne label_asm_396_afterif - ; source: test_word_splitw_equalities.p8:3232 fail_word(263,-21829) - lda #<$0107 - ldy #>$0107 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_396_afterif - ; source: test_word_splitw_equalities.p8:3235 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_398_else - cpy p8v_sources_msb+1 - bne label_asm_398_else - ; source: test_word_splitw_equalities.p8:3236 fail_word(264,-21829) - lda #<$0108 - ldy #>$0108 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_397_afterif -label_asm_398_else - ; source: test_word_splitw_equalities.p8:3238 cx16.r0L++ - inc cx16.r0L -label_asm_397_afterif - ; source: test_word_splitw_equalities.p8:3240 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3241 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:3242 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3244 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5a -+ - ; source: test_word_splitw_equalities.p8:3246 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:3247 lbl5a: fail_word(265,0) -p8l_lbl5a - lda #<$0109 - ldy #>$0109 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3248 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:3250 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3251 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3253 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:3254 lbl5b: fail_word(266,0) -p8l_lbl5b - lda #<$010a - ldy #>$010a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3255 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:3257 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_399_afterif - cpy p8v_sources_msb+1 - bne label_asm_399_afterif - ; source: test_word_splitw_equalities.p8:3258 fail_word(267,0) - lda #<$010b - ldy #>$010b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_399_afterif - ; source: test_word_splitw_equalities.p8:3261 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_401_else - cpy p8v_sources_msb+1 - bne label_asm_401_else - ; source: test_word_splitw_equalities.p8:3262 fail_word(268,0) - lda #<$010c - ldy #>$010c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_400_afterif -label_asm_401_else - ; source: test_word_splitw_equalities.p8:3264 cx16.r0L++ - inc cx16.r0L -label_asm_400_afterif - ; source: test_word_splitw_equalities.p8:3267 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl5c -+ - ; source: test_word_splitw_equalities.p8:3269 goto skip5c - bra p8l_skip5c - ; source: test_word_splitw_equalities.p8:3270 lbl5c: fail_word(269,0) -p8l_lbl5c - lda #<$010d - ldy #>$010d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3271 skip5c: -p8l_skip5c - ; source: test_word_splitw_equalities.p8:3273 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3274 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3276 goto skip5d - bra p8l_skip5d - ; source: test_word_splitw_equalities.p8:3277 lbl5d: fail_word(270,0) -p8l_lbl5d - lda #<$010e - ldy #>$010e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3278 skip5d: -p8l_skip5d - ; source: test_word_splitw_equalities.p8:3280 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_402_afterif - cpy p8v_sources_msb+1 - bne label_asm_402_afterif - ; source: test_word_splitw_equalities.p8:3281 fail_word(271,0) - lda #<$010f - ldy #>$010f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_402_afterif - ; source: test_word_splitw_equalities.p8:3284 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_404_else - cpy p8v_sources_msb+1 - bne label_asm_404_else - ; source: test_word_splitw_equalities.p8:3285 fail_word(272,0) - lda #<$0110 - ldy #>$0110 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_403_afterif -label_asm_404_else - ; source: test_word_splitw_equalities.p8:3287 cx16.r0L++ - inc cx16.r0L -label_asm_403_afterif - ; source: test_word_splitw_equalities.p8:3289 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3291 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6a -+ - ; source: test_word_splitw_equalities.p8:3293 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:3294 lbl6a: fail_word(273,0) -p8l_lbl6a - lda #<$0111 - ldy #>$0111 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3295 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:3297 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3298 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3300 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:3301 lbl6b: fail_word(274,0) -p8l_lbl6b - lda #<$0112 - ldy #>$0112 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3302 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:3304 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_405_afterif - cpy p8v_sources_msb+1 - bne label_asm_405_afterif - ; source: test_word_splitw_equalities.p8:3305 fail_word(275,0) - lda #<$0113 - ldy #>$0113 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_405_afterif - ; source: test_word_splitw_equalities.p8:3308 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_407_else - cpy p8v_sources_msb+1 - bne label_asm_407_else - ; source: test_word_splitw_equalities.p8:3309 fail_word(276,0) - lda #<$0114 - ldy #>$0114 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_406_afterif -label_asm_407_else - ; source: test_word_splitw_equalities.p8:3311 cx16.r0L++ - inc cx16.r0L -label_asm_406_afterif - ; source: test_word_splitw_equalities.p8:3314 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl6c -+ - ; source: test_word_splitw_equalities.p8:3316 goto skip6c - bra p8l_skip6c - ; source: test_word_splitw_equalities.p8:3317 lbl6c: fail_word(277,0) -p8l_lbl6c - lda #<$0115 - ldy #>$0115 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3318 skip6c: -p8l_skip6c - ; source: test_word_splitw_equalities.p8:3320 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3321 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3323 goto skip6d - bra p8l_skip6d - ; source: test_word_splitw_equalities.p8:3324 lbl6d: fail_word(278,0) -p8l_lbl6d - lda #<$0116 - ldy #>$0116 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3325 skip6d: -p8l_skip6d - ; source: test_word_splitw_equalities.p8:3327 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_408_afterif - cpy p8v_sources_msb+1 - bne label_asm_408_afterif - ; source: test_word_splitw_equalities.p8:3328 fail_word(279,0) - lda #<$0117 - ldy #>$0117 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_408_afterif - ; source: test_word_splitw_equalities.p8:3331 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_410_else - cpy p8v_sources_msb+1 - bne label_asm_410_else - ; source: test_word_splitw_equalities.p8:3332 fail_word(280,0) - lda #<$0118 - ldy #>$0118 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_409_afterif -label_asm_410_else - ; source: test_word_splitw_equalities.p8:3334 cx16.r0L++ - inc cx16.r0L -label_asm_409_afterif - ; source: test_word_splitw_equalities.p8:3336 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3338 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7a -+ - ; source: test_word_splitw_equalities.p8:3340 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:3341 lbl7a: fail_word(281,0) -p8l_lbl7a - lda #<$0119 - ldy #>$0119 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3342 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:3344 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3345 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3347 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:3348 lbl7b: fail_word(282,0) -p8l_lbl7b - lda #<$011a - ldy #>$011a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3349 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:3351 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_411_afterif - cpy p8v_sources_msb+1 - bne label_asm_411_afterif - ; source: test_word_splitw_equalities.p8:3352 fail_word(283,0) - lda #<$011b - ldy #>$011b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_411_afterif - ; source: test_word_splitw_equalities.p8:3355 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_413_else - cpy p8v_sources_msb+1 - bne label_asm_413_else - ; source: test_word_splitw_equalities.p8:3356 fail_word(284,0) - lda #<$011c - ldy #>$011c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_412_afterif -label_asm_413_else - ; source: test_word_splitw_equalities.p8:3358 cx16.r0L++ - inc cx16.r0L -label_asm_412_afterif - ; source: test_word_splitw_equalities.p8:3361 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl7c -+ - ; source: test_word_splitw_equalities.p8:3363 goto skip7c - bra p8l_skip7c - ; source: test_word_splitw_equalities.p8:3364 lbl7c: fail_word(285,0) -p8l_lbl7c - lda #<$011d - ldy #>$011d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3365 skip7c: -p8l_skip7c - ; source: test_word_splitw_equalities.p8:3367 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3368 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3370 goto skip7d - bra p8l_skip7d - ; source: test_word_splitw_equalities.p8:3371 lbl7d: fail_word(286,0) -p8l_lbl7d - lda #<$011e - ldy #>$011e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3372 skip7d: -p8l_skip7d - ; source: test_word_splitw_equalities.p8:3374 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_414_afterif - cpy p8v_sources_msb+1 - bne label_asm_414_afterif - ; source: test_word_splitw_equalities.p8:3375 fail_word(287,0) - lda #<$011f - ldy #>$011f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_414_afterif - ; source: test_word_splitw_equalities.p8:3378 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_416_else - cpy p8v_sources_msb+1 - bne label_asm_416_else - ; source: test_word_splitw_equalities.p8:3379 fail_word(288,0) - lda #<$0120 - ldy #>$0120 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_415_afterif -label_asm_416_else - ; source: test_word_splitw_equalities.p8:3381 cx16.r0L++ - inc cx16.r0L -label_asm_415_afterif - ; source: test_word_splitw_equalities.p8:3383 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3385 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8a -+ - ; source: test_word_splitw_equalities.p8:3387 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:3388 lbl8a: fail_word(289,0) -p8l_lbl8a - lda #<$0121 - ldy #>$0121 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3389 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:3391 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3392 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3394 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:3395 lbl8b: fail_word(290,0) -p8l_lbl8b - lda #<$0122 - ldy #>$0122 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3396 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:3398 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_417_afterif - cpy p8v_sources_msb+1 - bne label_asm_417_afterif - ; source: test_word_splitw_equalities.p8:3399 fail_word(291,0) - lda #<$0123 - ldy #>$0123 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_417_afterif - ; source: test_word_splitw_equalities.p8:3402 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_419_else - cpy p8v_sources_msb+1 - bne label_asm_419_else - ; source: test_word_splitw_equalities.p8:3403 fail_word(292,0) - lda #<$0124 - ldy #>$0124 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_418_afterif -label_asm_419_else - ; source: test_word_splitw_equalities.p8:3405 cx16.r0L++ - inc cx16.r0L -label_asm_418_afterif - ; source: test_word_splitw_equalities.p8:3408 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl8c -+ - ; source: test_word_splitw_equalities.p8:3410 goto skip8c - bra p8l_skip8c - ; source: test_word_splitw_equalities.p8:3411 lbl8c: fail_word(293,0) -p8l_lbl8c - lda #<$0125 - ldy #>$0125 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3412 skip8c: -p8l_skip8c - ; source: test_word_splitw_equalities.p8:3414 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3415 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3417 goto skip8d - bra p8l_skip8d - ; source: test_word_splitw_equalities.p8:3418 lbl8d: fail_word(294,0) -p8l_lbl8d - lda #<$0126 - ldy #>$0126 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3419 skip8d: -p8l_skip8d - ; source: test_word_splitw_equalities.p8:3421 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_420_afterif - cpy p8v_sources_msb+1 - bne label_asm_420_afterif - ; source: test_word_splitw_equalities.p8:3422 fail_word(295,0) - lda #<$0127 - ldy #>$0127 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word -label_asm_420_afterif - ; source: test_word_splitw_equalities.p8:3425 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_422_else - cpy p8v_sources_msb+1 - bne label_asm_422_else - ; source: test_word_splitw_equalities.p8:3426 fail_word(296,0) - lda #<$0128 - ldy #>$0128 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - stz p8b_main.p8s_fail_word.p8v_v1 - stz p8b_main.p8s_fail_word.p8v_v1+1 - jsr p8b_main.p8s_fail_word - bra label_asm_421_afterif -label_asm_422_else - ; source: test_word_splitw_equalities.p8:3428 cx16.r0L++ - inc cx16.r0L -label_asm_421_afterif - ; source: test_word_splitw_equalities.p8:3430 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3431 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:3432 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3434 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9a -+ - ; source: test_word_splitw_equalities.p8:3436 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:3437 lbl9a: fail_word(297,170) -p8l_lbl9a - lda #<$0129 - ldy #>$0129 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3438 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:3440 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3441 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3443 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:3444 lbl9b: fail_word(298,170) -p8l_lbl9b - lda #<$012a - ldy #>$012a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3445 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:3447 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_423_afterif - cpy p8v_sources_msb+1 - bne label_asm_423_afterif - ; source: test_word_splitw_equalities.p8:3448 fail_word(299,170) - lda #<$012b - ldy #>$012b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_423_afterif - ; source: test_word_splitw_equalities.p8:3451 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_425_else - cpy p8v_sources_msb+1 - bne label_asm_425_else - ; source: test_word_splitw_equalities.p8:3452 fail_word(300,170) - lda #<$012c - ldy #>$012c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_424_afterif -label_asm_425_else - ; source: test_word_splitw_equalities.p8:3454 cx16.r0L++ - inc cx16.r0L -label_asm_424_afterif - ; source: test_word_splitw_equalities.p8:3457 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl9c -+ - ; source: test_word_splitw_equalities.p8:3459 goto skip9c - bra p8l_skip9c - ; source: test_word_splitw_equalities.p8:3460 lbl9c: fail_word(301,170) -p8l_lbl9c - lda #<$012d - ldy #>$012d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3461 skip9c: -p8l_skip9c - ; source: test_word_splitw_equalities.p8:3463 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3464 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3466 goto skip9d - bra p8l_skip9d - ; source: test_word_splitw_equalities.p8:3467 lbl9d: fail_word(302,170) -p8l_lbl9d - lda #<$012e - ldy #>$012e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3468 skip9d: -p8l_skip9d - ; source: test_word_splitw_equalities.p8:3470 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_426_afterif - cpy p8v_sources_msb+1 - bne label_asm_426_afterif - ; source: test_word_splitw_equalities.p8:3471 fail_word(303,170) - lda #<$012f - ldy #>$012f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_426_afterif - ; source: test_word_splitw_equalities.p8:3474 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_428_else - cpy p8v_sources_msb+1 - bne label_asm_428_else - ; source: test_word_splitw_equalities.p8:3475 fail_word(304,170) - lda #<$0130 - ldy #>$0130 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_427_afterif -label_asm_428_else - ; source: test_word_splitw_equalities.p8:3477 cx16.r0L++ - inc cx16.r0L -label_asm_427_afterif - ; source: test_word_splitw_equalities.p8:3479 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3481 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10a -+ - ; source: test_word_splitw_equalities.p8:3483 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:3484 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3485 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:3487 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3488 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3490 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:3491 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3492 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:3494 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_429_afterif - cpy p8v_sources_msb+1 - bne label_asm_429_afterif - ; source: test_word_splitw_equalities.p8:3495 success++ - inc p8b_main.p8v_success -label_asm_429_afterif - ; source: test_word_splitw_equalities.p8:3498 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_431_else - cpy p8v_sources_msb+1 - bne label_asm_431_else - ; source: test_word_splitw_equalities.p8:3499 success++ - inc p8b_main.p8v_success - bra label_asm_430_afterif -label_asm_431_else - ; source: test_word_splitw_equalities.p8:3501 cx16.r0L++ - inc cx16.r0L -label_asm_430_afterif - ; source: test_word_splitw_equalities.p8:3504 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl10c -+ - ; source: test_word_splitw_equalities.p8:3506 goto skip10c - bra p8l_skip10c - ; source: test_word_splitw_equalities.p8:3507 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3508 skip10c: -p8l_skip10c - ; source: test_word_splitw_equalities.p8:3510 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3511 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3513 goto skip10d - bra p8l_skip10d - ; source: test_word_splitw_equalities.p8:3514 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3515 skip10d: -p8l_skip10d - ; source: test_word_splitw_equalities.p8:3517 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_432_afterif - cpy p8v_sources_msb+1 - bne label_asm_432_afterif - ; source: test_word_splitw_equalities.p8:3518 success++ - inc p8b_main.p8v_success -label_asm_432_afterif - ; source: test_word_splitw_equalities.p8:3521 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_434_else - cpy p8v_sources_msb+1 - bne label_asm_434_else - ; source: test_word_splitw_equalities.p8:3522 success++ - inc p8b_main.p8v_success - bra label_asm_433_afterif -label_asm_434_else - ; source: test_word_splitw_equalities.p8:3524 cx16.r0L++ - inc cx16.r0L -label_asm_433_afterif - ; source: test_word_splitw_equalities.p8:3526 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3528 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11a -+ - ; source: test_word_splitw_equalities.p8:3530 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:3531 lbl11a: fail_word(305,170) -p8l_lbl11a - lda #<$0131 - ldy #>$0131 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3532 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:3534 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3535 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3537 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:3538 lbl11b: fail_word(306,170) -p8l_lbl11b - lda #<$0132 - ldy #>$0132 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3539 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:3541 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_435_afterif - cpy p8v_sources_msb+1 - bne label_asm_435_afterif - ; source: test_word_splitw_equalities.p8:3542 fail_word(307,170) - lda #<$0133 - ldy #>$0133 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_435_afterif - ; source: test_word_splitw_equalities.p8:3545 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_437_else - cpy p8v_sources_msb+1 - bne label_asm_437_else - ; source: test_word_splitw_equalities.p8:3546 fail_word(308,170) - lda #<$0134 - ldy #>$0134 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_436_afterif -label_asm_437_else - ; source: test_word_splitw_equalities.p8:3548 cx16.r0L++ - inc cx16.r0L -label_asm_436_afterif - ; source: test_word_splitw_equalities.p8:3551 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl11c -+ - ; source: test_word_splitw_equalities.p8:3553 goto skip11c - bra p8l_skip11c - ; source: test_word_splitw_equalities.p8:3554 lbl11c: fail_word(309,170) -p8l_lbl11c - lda #<$0135 - ldy #>$0135 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3555 skip11c: -p8l_skip11c - ; source: test_word_splitw_equalities.p8:3557 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3558 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3560 goto skip11d - bra p8l_skip11d - ; source: test_word_splitw_equalities.p8:3561 lbl11d: fail_word(310,170) -p8l_lbl11d - lda #<$0136 - ldy #>$0136 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3562 skip11d: -p8l_skip11d - ; source: test_word_splitw_equalities.p8:3564 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_438_afterif - cpy p8v_sources_msb+1 - bne label_asm_438_afterif - ; source: test_word_splitw_equalities.p8:3565 fail_word(311,170) - lda #<$0137 - ldy #>$0137 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_438_afterif - ; source: test_word_splitw_equalities.p8:3568 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_440_else - cpy p8v_sources_msb+1 - bne label_asm_440_else - ; source: test_word_splitw_equalities.p8:3569 fail_word(312,170) - lda #<$0138 - ldy #>$0138 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_439_afterif -label_asm_440_else - ; source: test_word_splitw_equalities.p8:3571 cx16.r0L++ - inc cx16.r0L -label_asm_439_afterif - ; source: test_word_splitw_equalities.p8:3573 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3575 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12a -+ - ; source: test_word_splitw_equalities.p8:3577 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:3578 lbl12a: fail_word(313,170) -p8l_lbl12a - lda #<$0139 - ldy #>$0139 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3579 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:3581 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3582 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3584 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:3585 lbl12b: fail_word(314,170) -p8l_lbl12b - lda #<$013a - ldy #>$013a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3586 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:3588 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_441_afterif - cpy p8v_sources_msb+1 - bne label_asm_441_afterif - ; source: test_word_splitw_equalities.p8:3589 fail_word(315,170) - lda #<$013b - ldy #>$013b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_441_afterif - ; source: test_word_splitw_equalities.p8:3592 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_443_else - cpy p8v_sources_msb+1 - bne label_asm_443_else - ; source: test_word_splitw_equalities.p8:3593 fail_word(316,170) - lda #<$013c - ldy #>$013c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_442_afterif -label_asm_443_else - ; source: test_word_splitw_equalities.p8:3595 cx16.r0L++ - inc cx16.r0L -label_asm_442_afterif - ; source: test_word_splitw_equalities.p8:3598 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl12c -+ - ; source: test_word_splitw_equalities.p8:3600 goto skip12c - bra p8l_skip12c - ; source: test_word_splitw_equalities.p8:3601 lbl12c: fail_word(317,170) -p8l_lbl12c - lda #<$013d - ldy #>$013d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3602 skip12c: -p8l_skip12c - ; source: test_word_splitw_equalities.p8:3604 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3605 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3607 goto skip12d - bra p8l_skip12d - ; source: test_word_splitw_equalities.p8:3608 lbl12d: fail_word(318,170) -p8l_lbl12d - lda #<$013e - ldy #>$013e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3609 skip12d: -p8l_skip12d - ; source: test_word_splitw_equalities.p8:3611 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_444_afterif - cpy p8v_sources_msb+1 - bne label_asm_444_afterif - ; source: test_word_splitw_equalities.p8:3612 fail_word(319,170) - lda #<$013f - ldy #>$013f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_444_afterif - ; source: test_word_splitw_equalities.p8:3615 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_446_else - cpy p8v_sources_msb+1 - bne label_asm_446_else - ; source: test_word_splitw_equalities.p8:3616 fail_word(320,170) - lda #<$0140 - ldy #>$0140 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_445_afterif -label_asm_446_else - ; source: test_word_splitw_equalities.p8:3618 cx16.r0L++ - inc cx16.r0L -label_asm_445_afterif - ; source: test_word_splitw_equalities.p8:3620 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3621 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:3622 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3624 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl13a -+ - ; source: test_word_splitw_equalities.p8:3626 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:3627 lbl13a: fail_word(321,30464) -p8l_lbl13a - lda #<$0141 - ldy #>$0141 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3628 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:3630 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3631 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3633 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:3634 lbl13b: fail_word(322,30464) -p8l_lbl13b - lda #<$0142 - ldy #>$0142 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3635 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:3637 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_447_afterif - cpy p8v_sources_msb+1 - bne label_asm_447_afterif - ; source: test_word_splitw_equalities.p8:3638 fail_word(323,30464) - lda #<$0143 - ldy #>$0143 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_447_afterif - ; source: test_word_splitw_equalities.p8:3641 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_449_else - cpy p8v_sources_msb+1 - bne label_asm_449_else - ; source: test_word_splitw_equalities.p8:3642 fail_word(324,30464) - lda #<$0144 - ldy #>$0144 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_448_afterif -label_asm_449_else - ; source: test_word_splitw_equalities.p8:3644 cx16.r0L++ - inc cx16.r0L -label_asm_448_afterif - ; source: test_word_splitw_equalities.p8:3647 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl13c -+ - ; source: test_word_splitw_equalities.p8:3649 goto skip13c - bra p8l_skip13c - ; source: test_word_splitw_equalities.p8:3650 lbl13c: fail_word(325,30464) -p8l_lbl13c - lda #<$0145 - ldy #>$0145 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3651 skip13c: -p8l_skip13c - ; source: test_word_splitw_equalities.p8:3653 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3654 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3656 goto skip13d - bra p8l_skip13d - ; source: test_word_splitw_equalities.p8:3657 lbl13d: fail_word(326,30464) -p8l_lbl13d - lda #<$0146 - ldy #>$0146 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3658 skip13d: -p8l_skip13d - ; source: test_word_splitw_equalities.p8:3660 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_450_afterif - cpy p8v_sources_msb+1 - bne label_asm_450_afterif - ; source: test_word_splitw_equalities.p8:3661 fail_word(327,30464) - lda #<$0147 - ldy #>$0147 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_450_afterif - ; source: test_word_splitw_equalities.p8:3664 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_452_else - cpy p8v_sources_msb+1 - bne label_asm_452_else - ; source: test_word_splitw_equalities.p8:3665 fail_word(328,30464) - lda #<$0148 - ldy #>$0148 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_451_afterif -label_asm_452_else - ; source: test_word_splitw_equalities.p8:3667 cx16.r0L++ - inc cx16.r0L -label_asm_451_afterif - ; source: test_word_splitw_equalities.p8:3669 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3671 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl14a -+ - ; source: test_word_splitw_equalities.p8:3673 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:3674 lbl14a: fail_word(329,30464) -p8l_lbl14a - lda #<$0149 - ldy #>$0149 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3675 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:3677 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3678 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3680 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:3681 lbl14b: fail_word(330,30464) -p8l_lbl14b - lda #<$014a - ldy #>$014a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3682 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:3684 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_453_afterif - cpy p8v_sources_msb+1 - bne label_asm_453_afterif - ; source: test_word_splitw_equalities.p8:3685 fail_word(331,30464) - lda #<$014b - ldy #>$014b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_453_afterif - ; source: test_word_splitw_equalities.p8:3688 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_455_else - cpy p8v_sources_msb+1 - bne label_asm_455_else - ; source: test_word_splitw_equalities.p8:3689 fail_word(332,30464) - lda #<$014c - ldy #>$014c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_454_afterif -label_asm_455_else - ; source: test_word_splitw_equalities.p8:3691 cx16.r0L++ - inc cx16.r0L -label_asm_454_afterif - ; source: test_word_splitw_equalities.p8:3694 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl14c -+ - ; source: test_word_splitw_equalities.p8:3696 goto skip14c - bra p8l_skip14c - ; source: test_word_splitw_equalities.p8:3697 lbl14c: fail_word(333,30464) -p8l_lbl14c - lda #<$014d - ldy #>$014d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3698 skip14c: -p8l_skip14c - ; source: test_word_splitw_equalities.p8:3700 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3701 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3703 goto skip14d - bra p8l_skip14d - ; source: test_word_splitw_equalities.p8:3704 lbl14d: fail_word(334,30464) -p8l_lbl14d - lda #<$014e - ldy #>$014e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3705 skip14d: -p8l_skip14d - ; source: test_word_splitw_equalities.p8:3707 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_456_afterif - cpy p8v_sources_msb+1 - bne label_asm_456_afterif - ; source: test_word_splitw_equalities.p8:3708 fail_word(335,30464) - lda #<$014f - ldy #>$014f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_456_afterif - ; source: test_word_splitw_equalities.p8:3711 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_458_else - cpy p8v_sources_msb+1 - bne label_asm_458_else - ; source: test_word_splitw_equalities.p8:3712 fail_word(336,30464) - lda #<$0150 - ldy #>$0150 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_457_afterif -label_asm_458_else - ; source: test_word_splitw_equalities.p8:3714 cx16.r0L++ - inc cx16.r0L -label_asm_457_afterif - ; source: test_word_splitw_equalities.p8:3716 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3718 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl15a -+ - ; source: test_word_splitw_equalities.p8:3720 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:3721 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3722 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:3724 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3725 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3727 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:3728 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3729 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:3731 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_459_afterif - cpy p8v_sources_msb+1 - bne label_asm_459_afterif - ; source: test_word_splitw_equalities.p8:3732 success++ - inc p8b_main.p8v_success -label_asm_459_afterif - ; source: test_word_splitw_equalities.p8:3735 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_461_else - cpy p8v_sources_msb+1 - bne label_asm_461_else - ; source: test_word_splitw_equalities.p8:3736 success++ - inc p8b_main.p8v_success - bra label_asm_460_afterif -label_asm_461_else - ; source: test_word_splitw_equalities.p8:3738 cx16.r0L++ - inc cx16.r0L -label_asm_460_afterif - ; source: test_word_splitw_equalities.p8:3741 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl15c -+ - ; source: test_word_splitw_equalities.p8:3743 goto skip15c - bra p8l_skip15c - ; source: test_word_splitw_equalities.p8:3744 lbl15c: success++ -p8l_lbl15c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3745 skip15c: -p8l_skip15c - ; source: test_word_splitw_equalities.p8:3747 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3748 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3750 goto skip15d - bra p8l_skip15d - ; source: test_word_splitw_equalities.p8:3751 lbl15d: success++ -p8l_lbl15d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3752 skip15d: -p8l_skip15d - ; source: test_word_splitw_equalities.p8:3754 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_462_afterif - cpy p8v_sources_msb+1 - bne label_asm_462_afterif - ; source: test_word_splitw_equalities.p8:3755 success++ - inc p8b_main.p8v_success -label_asm_462_afterif - ; source: test_word_splitw_equalities.p8:3758 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_464_else - cpy p8v_sources_msb+1 - bne label_asm_464_else - ; source: test_word_splitw_equalities.p8:3759 success++ - inc p8b_main.p8v_success - bra label_asm_463_afterif -label_asm_464_else - ; source: test_word_splitw_equalities.p8:3761 cx16.r0L++ - inc cx16.r0L -label_asm_463_afterif - ; source: test_word_splitw_equalities.p8:3763 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3765 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl16a -+ - ; source: test_word_splitw_equalities.p8:3767 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:3768 lbl16a: fail_word(337,30464) -p8l_lbl16a - lda #<$0151 - ldy #>$0151 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3769 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:3771 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3772 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3774 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:3775 lbl16b: fail_word(338,30464) -p8l_lbl16b - lda #<$0152 - ldy #>$0152 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3776 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:3778 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_465_afterif - cpy p8v_sources_msb+1 - bne label_asm_465_afterif - ; source: test_word_splitw_equalities.p8:3779 fail_word(339,30464) - lda #<$0153 - ldy #>$0153 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_465_afterif - ; source: test_word_splitw_equalities.p8:3782 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_467_else - cpy p8v_sources_msb+1 - bne label_asm_467_else - ; source: test_word_splitw_equalities.p8:3783 fail_word(340,30464) - lda #<$0154 - ldy #>$0154 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_466_afterif -label_asm_467_else - ; source: test_word_splitw_equalities.p8:3785 cx16.r0L++ - inc cx16.r0L -label_asm_466_afterif - ; source: test_word_splitw_equalities.p8:3788 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl16c -+ - ; source: test_word_splitw_equalities.p8:3790 goto skip16c - bra p8l_skip16c - ; source: test_word_splitw_equalities.p8:3791 lbl16c: fail_word(341,30464) -p8l_lbl16c - lda #<$0155 - ldy #>$0155 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3792 skip16c: -p8l_skip16c - ; source: test_word_splitw_equalities.p8:3794 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3795 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3797 goto skip16d - bra p8l_skip16d - ; source: test_word_splitw_equalities.p8:3798 lbl16d: fail_word(342,30464) -p8l_lbl16d - lda #<$0156 - ldy #>$0156 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3799 skip16d: -p8l_skip16d - ; source: test_word_splitw_equalities.p8:3801 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_468_afterif - cpy p8v_sources_msb+1 - bne label_asm_468_afterif - ; source: test_word_splitw_equalities.p8:3802 fail_word(343,30464) - lda #<$0157 - ldy #>$0157 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_468_afterif - ; source: test_word_splitw_equalities.p8:3805 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_470_else - cpy p8v_sources_msb+1 - bne label_asm_470_else - ; source: test_word_splitw_equalities.p8:3806 fail_word(344,30464) - lda #<$0158 - ldy #>$0158 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_469_afterif -label_asm_470_else - ; source: test_word_splitw_equalities.p8:3808 cx16.r0L++ - inc cx16.r0L -label_asm_469_afterif - ; source: test_word_splitw_equalities.p8:3810 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3811 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:3812 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3814 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl17a -+ - ; source: test_word_splitw_equalities.p8:3816 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:3817 lbl17a: fail_word(345,32767) -p8l_lbl17a - lda #<$0159 - ldy #>$0159 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3818 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:3820 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3821 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3823 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:3824 lbl17b: fail_word(346,32767) -p8l_lbl17b - lda #<$015a - ldy #>$015a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3825 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:3827 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_471_afterif - cpy p8v_sources_msb+1 - bne label_asm_471_afterif - ; source: test_word_splitw_equalities.p8:3828 fail_word(347,32767) - lda #<$015b - ldy #>$015b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_471_afterif - ; source: test_word_splitw_equalities.p8:3831 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_473_else - cpy p8v_sources_msb+1 - bne label_asm_473_else - ; source: test_word_splitw_equalities.p8:3832 fail_word(348,32767) - lda #<$015c - ldy #>$015c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_472_afterif -label_asm_473_else - ; source: test_word_splitw_equalities.p8:3834 cx16.r0L++ - inc cx16.r0L -label_asm_472_afterif - ; source: test_word_splitw_equalities.p8:3837 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl17c -+ - ; source: test_word_splitw_equalities.p8:3839 goto skip17c - bra p8l_skip17c - ; source: test_word_splitw_equalities.p8:3840 lbl17c: fail_word(349,32767) -p8l_lbl17c - lda #<$015d - ldy #>$015d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3841 skip17c: -p8l_skip17c - ; source: test_word_splitw_equalities.p8:3843 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3844 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3846 goto skip17d - bra p8l_skip17d - ; source: test_word_splitw_equalities.p8:3847 lbl17d: fail_word(350,32767) -p8l_lbl17d - lda #<$015e - ldy #>$015e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3848 skip17d: -p8l_skip17d - ; source: test_word_splitw_equalities.p8:3850 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_474_afterif - cpy p8v_sources_msb+1 - bne label_asm_474_afterif - ; source: test_word_splitw_equalities.p8:3851 fail_word(351,32767) - lda #<$015f - ldy #>$015f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_474_afterif - ; source: test_word_splitw_equalities.p8:3854 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_476_else - cpy p8v_sources_msb+1 - bne label_asm_476_else - ; source: test_word_splitw_equalities.p8:3855 fail_word(352,32767) - lda #<$0160 - ldy #>$0160 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_475_afterif -label_asm_476_else - ; source: test_word_splitw_equalities.p8:3857 cx16.r0L++ - inc cx16.r0L -label_asm_475_afterif - ; source: test_word_splitw_equalities.p8:3859 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3861 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl18a -+ - ; source: test_word_splitw_equalities.p8:3863 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:3864 lbl18a: fail_word(353,32767) -p8l_lbl18a - lda #<$0161 - ldy #>$0161 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3865 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:3867 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3868 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3870 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:3871 lbl18b: fail_word(354,32767) -p8l_lbl18b - lda #<$0162 - ldy #>$0162 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3872 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:3874 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_477_afterif - cpy p8v_sources_msb+1 - bne label_asm_477_afterif - ; source: test_word_splitw_equalities.p8:3875 fail_word(355,32767) - lda #<$0163 - ldy #>$0163 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_477_afterif - ; source: test_word_splitw_equalities.p8:3878 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_479_else - cpy p8v_sources_msb+1 - bne label_asm_479_else - ; source: test_word_splitw_equalities.p8:3879 fail_word(356,32767) - lda #<$0164 - ldy #>$0164 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_478_afterif -label_asm_479_else - ; source: test_word_splitw_equalities.p8:3881 cx16.r0L++ - inc cx16.r0L -label_asm_478_afterif - ; source: test_word_splitw_equalities.p8:3884 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl18c -+ - ; source: test_word_splitw_equalities.p8:3886 goto skip18c - bra p8l_skip18c - ; source: test_word_splitw_equalities.p8:3887 lbl18c: fail_word(357,32767) -p8l_lbl18c - lda #<$0165 - ldy #>$0165 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3888 skip18c: -p8l_skip18c - ; source: test_word_splitw_equalities.p8:3890 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3891 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3893 goto skip18d - bra p8l_skip18d - ; source: test_word_splitw_equalities.p8:3894 lbl18d: fail_word(358,32767) -p8l_lbl18d - lda #<$0166 - ldy #>$0166 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3895 skip18d: -p8l_skip18d - ; source: test_word_splitw_equalities.p8:3897 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_480_afterif - cpy p8v_sources_msb+1 - bne label_asm_480_afterif - ; source: test_word_splitw_equalities.p8:3898 fail_word(359,32767) - lda #<$0167 - ldy #>$0167 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_480_afterif - ; source: test_word_splitw_equalities.p8:3901 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_482_else - cpy p8v_sources_msb+1 - bne label_asm_482_else - ; source: test_word_splitw_equalities.p8:3902 fail_word(360,32767) - lda #<$0168 - ldy #>$0168 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_481_afterif -label_asm_482_else - ; source: test_word_splitw_equalities.p8:3904 cx16.r0L++ - inc cx16.r0L -label_asm_481_afterif - ; source: test_word_splitw_equalities.p8:3906 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3908 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl19a -+ - ; source: test_word_splitw_equalities.p8:3910 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:3911 lbl19a: fail_word(361,32767) -p8l_lbl19a - lda #<$0169 - ldy #>$0169 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3912 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:3914 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3915 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3917 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:3918 lbl19b: fail_word(362,32767) -p8l_lbl19b - lda #<$016a - ldy #>$016a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3919 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:3921 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_483_afterif - cpy p8v_sources_msb+1 - bne label_asm_483_afterif - ; source: test_word_splitw_equalities.p8:3922 fail_word(363,32767) - lda #<$016b - ldy #>$016b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_483_afterif - ; source: test_word_splitw_equalities.p8:3925 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_485_else - cpy p8v_sources_msb+1 - bne label_asm_485_else - ; source: test_word_splitw_equalities.p8:3926 fail_word(364,32767) - lda #<$016c - ldy #>$016c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_484_afterif -label_asm_485_else - ; source: test_word_splitw_equalities.p8:3928 cx16.r0L++ - inc cx16.r0L -label_asm_484_afterif - ; source: test_word_splitw_equalities.p8:3931 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl19c -+ - ; source: test_word_splitw_equalities.p8:3933 goto skip19c - bra p8l_skip19c - ; source: test_word_splitw_equalities.p8:3934 lbl19c: fail_word(365,32767) -p8l_lbl19c - lda #<$016d - ldy #>$016d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3935 skip19c: -p8l_skip19c - ; source: test_word_splitw_equalities.p8:3937 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3938 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3940 goto skip19d - bra p8l_skip19d - ; source: test_word_splitw_equalities.p8:3941 lbl19d: fail_word(366,32767) -p8l_lbl19d - lda #<$016e - ldy #>$016e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:3942 skip19d: -p8l_skip19d - ; source: test_word_splitw_equalities.p8:3944 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_486_afterif - cpy p8v_sources_msb+1 - bne label_asm_486_afterif - ; source: test_word_splitw_equalities.p8:3945 fail_word(367,32767) - lda #<$016f - ldy #>$016f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_486_afterif - ; source: test_word_splitw_equalities.p8:3948 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_488_else - cpy p8v_sources_msb+1 - bne label_asm_488_else - ; source: test_word_splitw_equalities.p8:3949 fail_word(368,32767) - lda #<$0170 - ldy #>$0170 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_487_afterif -label_asm_488_else - ; source: test_word_splitw_equalities.p8:3951 cx16.r0L++ - inc cx16.r0L -label_asm_487_afterif - ; source: test_word_splitw_equalities.p8:3953 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:3955 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl20a -+ - ; source: test_word_splitw_equalities.p8:3957 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:3958 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3959 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:3961 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3962 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3964 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:3965 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3966 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:3968 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_489_afterif - cpy p8v_sources_msb+1 - bne label_asm_489_afterif - ; source: test_word_splitw_equalities.p8:3969 success++ - inc p8b_main.p8v_success -label_asm_489_afterif - ; source: test_word_splitw_equalities.p8:3972 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_491_else - cpy p8v_sources_msb+1 - bne label_asm_491_else - ; source: test_word_splitw_equalities.p8:3973 success++ - inc p8b_main.p8v_success - bra label_asm_490_afterif -label_asm_491_else - ; source: test_word_splitw_equalities.p8:3975 cx16.r0L++ - inc cx16.r0L -label_asm_490_afterif - ; source: test_word_splitw_equalities.p8:3978 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq p8l_lbl20c -+ - ; source: test_word_splitw_equalities.p8:3980 goto skip20c - bra p8l_skip20c - ; source: test_word_splitw_equalities.p8:3981 lbl20c: success++ -p8l_lbl20c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3982 skip20c: -p8l_skip20c - ; source: test_word_splitw_equalities.p8:3984 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:3985 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - bne + - jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:3987 goto skip20d - bra p8l_skip20d - ; source: test_word_splitw_equalities.p8:3988 lbl20d: success++ -p8l_lbl20d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:3989 skip20d: -p8l_skip20d - ; source: test_word_splitw_equalities.p8:3991 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_492_afterif - cpy p8v_sources_msb+1 - bne label_asm_492_afterif - ; source: test_word_splitw_equalities.p8:3992 success++ - inc p8b_main.p8v_success -label_asm_492_afterif - ; source: test_word_splitw_equalities.p8:3995 if sources[1]==values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne label_asm_494_else - cpy p8v_sources_msb+1 - bne label_asm_494_else - ; source: test_word_splitw_equalities.p8:3996 success++ - inc p8b_main.p8v_success - bra label_asm_493_afterif -label_asm_494_else - ; source: test_word_splitw_equalities.p8:3998 cx16.r0L++ - inc cx16.r0L -label_asm_493_afterif - ; source: test_word_splitw_equalities.p8:4000 verify_success(32) - lda #$20 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:3045 sub test_is_array_splitw() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $22b8 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $270f, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend - ; source: test_word_splitw_equalities.p8:4002 sub test_not_array_splitw() { - -p8s_test_not_array_splitw .proc -; statements - ; source: test_word_splitw_equalities.p8:4004 word[] @split values = [9999, 8888] - ; source: test_word_splitw_equalities.p8:4005 word[] @split sources = [9999, 8888] - ; source: test_word_splitw_equalities.p8:4006 success = 0 - stz p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4007 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4008 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:4009 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4011 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1a - cpy p8v_sources_msb+1 - bne p8l_lbl1a - ; source: test_word_splitw_equalities.p8:4013 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_equalities.p8:4014 lbl1a: fail_word(369,-21829) -p8l_lbl1a - lda #<$0171 - ldy #>$0171 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4015 skip1a: -p8l_skip1a - ; source: test_word_splitw_equalities.p8:4017 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4018 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4020 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_equalities.p8:4021 lbl1b: fail_word(370,-21829) -p8l_lbl1b - lda #<$0172 - ldy #>$0172 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4022 skip1b: -p8l_skip1b - ; source: test_word_splitw_equalities.p8:4024 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_495_afterif -+ - ; source: test_word_splitw_equalities.p8:4025 fail_word(371,-21829) - lda #<$0173 - ldy #>$0173 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_495_afterif - ; source: test_word_splitw_equalities.p8:4028 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_497_else -+ - ; source: test_word_splitw_equalities.p8:4029 fail_word(372,-21829) - lda #<$0174 - ldy #>$0174 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_496_afterif -label_asm_497_else - ; source: test_word_splitw_equalities.p8:4031 cx16.r0L++ - inc cx16.r0L -label_asm_496_afterif - ; source: test_word_splitw_equalities.p8:4034 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl1c - cpy p8v_sources_msb+1 - bne p8l_lbl1c - ; source: test_word_splitw_equalities.p8:4036 goto skip1c - bra p8l_skip1c - ; source: test_word_splitw_equalities.p8:4037 lbl1c: fail_word(373,-21829) -p8l_lbl1c - lda #<$0175 - ldy #>$0175 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4038 skip1c: -p8l_skip1c - ; source: test_word_splitw_equalities.p8:4040 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4041 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4043 goto skip1d - bra p8l_skip1d - ; source: test_word_splitw_equalities.p8:4044 lbl1d: fail_word(374,-21829) -p8l_lbl1d - lda #<$0176 - ldy #>$0176 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4045 skip1d: -p8l_skip1d - ; source: test_word_splitw_equalities.p8:4047 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_498_afterif -+ - ; source: test_word_splitw_equalities.p8:4048 fail_word(375,-21829) - lda #<$0177 - ldy #>$0177 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_498_afterif - ; source: test_word_splitw_equalities.p8:4051 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_500_else -+ - ; source: test_word_splitw_equalities.p8:4052 fail_word(376,-21829) - lda #<$0178 - ldy #>$0178 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<-$5545 - ldy #>-$5545 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_499_afterif -label_asm_500_else - ; source: test_word_splitw_equalities.p8:4054 cx16.r0L++ - inc cx16.r0L -label_asm_499_afterif - ; source: test_word_splitw_equalities.p8:4056 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4058 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl2a - cpy p8v_sources_msb+1 - bne p8l_lbl2a - ; source: test_word_splitw_equalities.p8:4060 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_equalities.p8:4061 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4062 skip2a: -p8l_skip2a - ; source: test_word_splitw_equalities.p8:4064 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4065 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4067 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_equalities.p8:4068 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4069 skip2b: -p8l_skip2b - ; source: test_word_splitw_equalities.p8:4071 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_501_afterif -+ - ; source: test_word_splitw_equalities.p8:4072 success++ - inc p8b_main.p8v_success -label_asm_501_afterif - ; source: test_word_splitw_equalities.p8:4075 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_503_else -+ - ; source: test_word_splitw_equalities.p8:4076 success++ - inc p8b_main.p8v_success - bra label_asm_502_afterif -label_asm_503_else - ; source: test_word_splitw_equalities.p8:4078 cx16.r0L++ - inc cx16.r0L -label_asm_502_afterif - ; source: test_word_splitw_equalities.p8:4081 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl2c - cpy p8v_sources_msb+1 - bne p8l_lbl2c - ; source: test_word_splitw_equalities.p8:4083 goto skip2c - bra p8l_skip2c - ; source: test_word_splitw_equalities.p8:4084 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4085 skip2c: -p8l_skip2c - ; source: test_word_splitw_equalities.p8:4087 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4088 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4090 goto skip2d - bra p8l_skip2d - ; source: test_word_splitw_equalities.p8:4091 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4092 skip2d: -p8l_skip2d - ; source: test_word_splitw_equalities.p8:4094 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_504_afterif -+ - ; source: test_word_splitw_equalities.p8:4095 success++ - inc p8b_main.p8v_success -label_asm_504_afterif - ; source: test_word_splitw_equalities.p8:4098 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_506_else -+ - ; source: test_word_splitw_equalities.p8:4099 success++ - inc p8b_main.p8v_success - bra label_asm_505_afterif -label_asm_506_else - ; source: test_word_splitw_equalities.p8:4101 cx16.r0L++ - inc cx16.r0L -label_asm_505_afterif - ; source: test_word_splitw_equalities.p8:4103 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4105 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl3a - cpy p8v_sources_msb+1 - bne p8l_lbl3a - ; source: test_word_splitw_equalities.p8:4107 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_equalities.p8:4108 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4109 skip3a: -p8l_skip3a - ; source: test_word_splitw_equalities.p8:4111 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4112 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4114 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_equalities.p8:4115 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4116 skip3b: -p8l_skip3b - ; source: test_word_splitw_equalities.p8:4118 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_507_afterif -+ - ; source: test_word_splitw_equalities.p8:4119 success++ - inc p8b_main.p8v_success -label_asm_507_afterif - ; source: test_word_splitw_equalities.p8:4122 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_509_else -+ - ; source: test_word_splitw_equalities.p8:4123 success++ - inc p8b_main.p8v_success - bra label_asm_508_afterif -label_asm_509_else - ; source: test_word_splitw_equalities.p8:4125 cx16.r0L++ - inc cx16.r0L -label_asm_508_afterif - ; source: test_word_splitw_equalities.p8:4128 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl3c - cpy p8v_sources_msb+1 - bne p8l_lbl3c - ; source: test_word_splitw_equalities.p8:4130 goto skip3c - bra p8l_skip3c - ; source: test_word_splitw_equalities.p8:4131 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4132 skip3c: -p8l_skip3c - ; source: test_word_splitw_equalities.p8:4134 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4135 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4137 goto skip3d - bra p8l_skip3d - ; source: test_word_splitw_equalities.p8:4138 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4139 skip3d: -p8l_skip3d - ; source: test_word_splitw_equalities.p8:4141 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_510_afterif -+ - ; source: test_word_splitw_equalities.p8:4142 success++ - inc p8b_main.p8v_success -label_asm_510_afterif - ; source: test_word_splitw_equalities.p8:4145 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_512_else -+ - ; source: test_word_splitw_equalities.p8:4146 success++ - inc p8b_main.p8v_success - bra label_asm_511_afterif -label_asm_512_else - ; source: test_word_splitw_equalities.p8:4148 cx16.r0L++ - inc cx16.r0L -label_asm_511_afterif - ; source: test_word_splitw_equalities.p8:4150 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4152 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4a - cpy p8v_sources_msb+1 - bne p8l_lbl4a - ; source: test_word_splitw_equalities.p8:4154 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_equalities.p8:4155 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4156 skip4a: -p8l_skip4a - ; source: test_word_splitw_equalities.p8:4158 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4159 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4161 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_equalities.p8:4162 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4163 skip4b: -p8l_skip4b - ; source: test_word_splitw_equalities.p8:4165 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_513_afterif -+ - ; source: test_word_splitw_equalities.p8:4166 success++ - inc p8b_main.p8v_success -label_asm_513_afterif - ; source: test_word_splitw_equalities.p8:4169 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_515_else -+ - ; source: test_word_splitw_equalities.p8:4170 success++ - inc p8b_main.p8v_success - bra label_asm_514_afterif -label_asm_515_else - ; source: test_word_splitw_equalities.p8:4172 cx16.r0L++ - inc cx16.r0L -label_asm_514_afterif - ; source: test_word_splitw_equalities.p8:4175 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl4c - cpy p8v_sources_msb+1 - bne p8l_lbl4c - ; source: test_word_splitw_equalities.p8:4177 goto skip4c - bra p8l_skip4c - ; source: test_word_splitw_equalities.p8:4178 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4179 skip4c: -p8l_skip4c - ; source: test_word_splitw_equalities.p8:4181 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4182 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4184 goto skip4d - bra p8l_skip4d - ; source: test_word_splitw_equalities.p8:4185 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4186 skip4d: -p8l_skip4d - ; source: test_word_splitw_equalities.p8:4188 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_516_afterif -+ - ; source: test_word_splitw_equalities.p8:4189 success++ - inc p8b_main.p8v_success -label_asm_516_afterif - ; source: test_word_splitw_equalities.p8:4192 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_518_else -+ - ; source: test_word_splitw_equalities.p8:4193 success++ - inc p8b_main.p8v_success - bra label_asm_517_afterif -label_asm_518_else - ; source: test_word_splitw_equalities.p8:4195 cx16.r0L++ - inc cx16.r0L -label_asm_517_afterif - ; source: test_word_splitw_equalities.p8:4197 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4198 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:4199 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4201 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl5a - cpy p8v_sources_msb+1 - bne p8l_lbl5a - ; source: test_word_splitw_equalities.p8:4203 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_equalities.p8:4204 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4205 skip5a: -p8l_skip5a - ; source: test_word_splitw_equalities.p8:4207 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4208 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4210 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_equalities.p8:4211 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4212 skip5b: -p8l_skip5b - ; source: test_word_splitw_equalities.p8:4214 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_519_afterif -+ - ; source: test_word_splitw_equalities.p8:4215 success++ - inc p8b_main.p8v_success -label_asm_519_afterif - ; source: test_word_splitw_equalities.p8:4218 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_521_else -+ - ; source: test_word_splitw_equalities.p8:4219 success++ - inc p8b_main.p8v_success - bra label_asm_520_afterif -label_asm_521_else - ; source: test_word_splitw_equalities.p8:4221 cx16.r0L++ - inc cx16.r0L -label_asm_520_afterif - ; source: test_word_splitw_equalities.p8:4224 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl5c - cpy p8v_sources_msb+1 - bne p8l_lbl5c - ; source: test_word_splitw_equalities.p8:4226 goto skip5c - bra p8l_skip5c - ; source: test_word_splitw_equalities.p8:4227 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4228 skip5c: -p8l_skip5c - ; source: test_word_splitw_equalities.p8:4230 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4231 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4233 goto skip5d - bra p8l_skip5d - ; source: test_word_splitw_equalities.p8:4234 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4235 skip5d: -p8l_skip5d - ; source: test_word_splitw_equalities.p8:4237 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_522_afterif -+ - ; source: test_word_splitw_equalities.p8:4238 success++ - inc p8b_main.p8v_success -label_asm_522_afterif - ; source: test_word_splitw_equalities.p8:4241 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_524_else -+ - ; source: test_word_splitw_equalities.p8:4242 success++ - inc p8b_main.p8v_success - bra label_asm_523_afterif -label_asm_524_else - ; source: test_word_splitw_equalities.p8:4244 cx16.r0L++ - inc cx16.r0L -label_asm_523_afterif - ; source: test_word_splitw_equalities.p8:4246 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4248 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl6a - cpy p8v_sources_msb+1 - bne p8l_lbl6a - ; source: test_word_splitw_equalities.p8:4250 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_equalities.p8:4251 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4252 skip6a: -p8l_skip6a - ; source: test_word_splitw_equalities.p8:4254 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4255 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4257 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_equalities.p8:4258 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4259 skip6b: -p8l_skip6b - ; source: test_word_splitw_equalities.p8:4261 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_525_afterif -+ - ; source: test_word_splitw_equalities.p8:4262 success++ - inc p8b_main.p8v_success -label_asm_525_afterif - ; source: test_word_splitw_equalities.p8:4265 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_527_else -+ - ; source: test_word_splitw_equalities.p8:4266 success++ - inc p8b_main.p8v_success - bra label_asm_526_afterif -label_asm_527_else - ; source: test_word_splitw_equalities.p8:4268 cx16.r0L++ - inc cx16.r0L -label_asm_526_afterif - ; source: test_word_splitw_equalities.p8:4271 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl6c - cpy p8v_sources_msb+1 - bne p8l_lbl6c - ; source: test_word_splitw_equalities.p8:4273 goto skip6c - bra p8l_skip6c - ; source: test_word_splitw_equalities.p8:4274 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4275 skip6c: -p8l_skip6c - ; source: test_word_splitw_equalities.p8:4277 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4278 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4280 goto skip6d - bra p8l_skip6d - ; source: test_word_splitw_equalities.p8:4281 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4282 skip6d: -p8l_skip6d - ; source: test_word_splitw_equalities.p8:4284 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_528_afterif -+ - ; source: test_word_splitw_equalities.p8:4285 success++ - inc p8b_main.p8v_success -label_asm_528_afterif - ; source: test_word_splitw_equalities.p8:4288 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_530_else -+ - ; source: test_word_splitw_equalities.p8:4289 success++ - inc p8b_main.p8v_success - bra label_asm_529_afterif -label_asm_530_else - ; source: test_word_splitw_equalities.p8:4291 cx16.r0L++ - inc cx16.r0L -label_asm_529_afterif - ; source: test_word_splitw_equalities.p8:4293 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4295 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7a - cpy p8v_sources_msb+1 - bne p8l_lbl7a - ; source: test_word_splitw_equalities.p8:4297 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_equalities.p8:4298 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4299 skip7a: -p8l_skip7a - ; source: test_word_splitw_equalities.p8:4301 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4302 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4304 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_equalities.p8:4305 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4306 skip7b: -p8l_skip7b - ; source: test_word_splitw_equalities.p8:4308 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_531_afterif -+ - ; source: test_word_splitw_equalities.p8:4309 success++ - inc p8b_main.p8v_success -label_asm_531_afterif - ; source: test_word_splitw_equalities.p8:4312 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_533_else -+ - ; source: test_word_splitw_equalities.p8:4313 success++ - inc p8b_main.p8v_success - bra label_asm_532_afterif -label_asm_533_else - ; source: test_word_splitw_equalities.p8:4315 cx16.r0L++ - inc cx16.r0L -label_asm_532_afterif - ; source: test_word_splitw_equalities.p8:4318 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl7c - cpy p8v_sources_msb+1 - bne p8l_lbl7c - ; source: test_word_splitw_equalities.p8:4320 goto skip7c - bra p8l_skip7c - ; source: test_word_splitw_equalities.p8:4321 lbl7c: success++ -p8l_lbl7c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4322 skip7c: -p8l_skip7c - ; source: test_word_splitw_equalities.p8:4324 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4325 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4327 goto skip7d - bra p8l_skip7d - ; source: test_word_splitw_equalities.p8:4328 lbl7d: success++ -p8l_lbl7d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4329 skip7d: -p8l_skip7d - ; source: test_word_splitw_equalities.p8:4331 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_534_afterif -+ - ; source: test_word_splitw_equalities.p8:4332 success++ - inc p8b_main.p8v_success -label_asm_534_afterif - ; source: test_word_splitw_equalities.p8:4335 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_536_else -+ - ; source: test_word_splitw_equalities.p8:4336 success++ - inc p8b_main.p8v_success - bra label_asm_535_afterif -label_asm_536_else - ; source: test_word_splitw_equalities.p8:4338 cx16.r0L++ - inc cx16.r0L -label_asm_535_afterif - ; source: test_word_splitw_equalities.p8:4340 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4342 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl8a - cpy p8v_sources_msb+1 - bne p8l_lbl8a - ; source: test_word_splitw_equalities.p8:4344 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_equalities.p8:4345 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4346 skip8a: -p8l_skip8a - ; source: test_word_splitw_equalities.p8:4348 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4349 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4351 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_equalities.p8:4352 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4353 skip8b: -p8l_skip8b - ; source: test_word_splitw_equalities.p8:4355 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_537_afterif -+ - ; source: test_word_splitw_equalities.p8:4356 success++ - inc p8b_main.p8v_success -label_asm_537_afterif - ; source: test_word_splitw_equalities.p8:4359 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_539_else -+ - ; source: test_word_splitw_equalities.p8:4360 success++ - inc p8b_main.p8v_success - bra label_asm_538_afterif -label_asm_539_else - ; source: test_word_splitw_equalities.p8:4362 cx16.r0L++ - inc cx16.r0L -label_asm_538_afterif - ; source: test_word_splitw_equalities.p8:4365 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl8c - cpy p8v_sources_msb+1 - bne p8l_lbl8c - ; source: test_word_splitw_equalities.p8:4367 goto skip8c - bra p8l_skip8c - ; source: test_word_splitw_equalities.p8:4368 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4369 skip8c: -p8l_skip8c - ; source: test_word_splitw_equalities.p8:4371 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4372 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4374 goto skip8d - bra p8l_skip8d - ; source: test_word_splitw_equalities.p8:4375 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4376 skip8d: -p8l_skip8d - ; source: test_word_splitw_equalities.p8:4378 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_540_afterif -+ - ; source: test_word_splitw_equalities.p8:4379 success++ - inc p8b_main.p8v_success -label_asm_540_afterif - ; source: test_word_splitw_equalities.p8:4382 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_542_else -+ - ; source: test_word_splitw_equalities.p8:4383 success++ - inc p8b_main.p8v_success - bra label_asm_541_afterif -label_asm_542_else - ; source: test_word_splitw_equalities.p8:4385 cx16.r0L++ - inc cx16.r0L -label_asm_541_afterif - ; source: test_word_splitw_equalities.p8:4387 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4388 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:4389 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4391 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl9a - cpy p8v_sources_msb+1 - bne p8l_lbl9a - ; source: test_word_splitw_equalities.p8:4393 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_equalities.p8:4394 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4395 skip9a: -p8l_skip9a - ; source: test_word_splitw_equalities.p8:4397 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4398 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4400 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_equalities.p8:4401 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4402 skip9b: -p8l_skip9b - ; source: test_word_splitw_equalities.p8:4404 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_543_afterif -+ - ; source: test_word_splitw_equalities.p8:4405 success++ - inc p8b_main.p8v_success -label_asm_543_afterif - ; source: test_word_splitw_equalities.p8:4408 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_545_else -+ - ; source: test_word_splitw_equalities.p8:4409 success++ - inc p8b_main.p8v_success - bra label_asm_544_afterif -label_asm_545_else - ; source: test_word_splitw_equalities.p8:4411 cx16.r0L++ - inc cx16.r0L -label_asm_544_afterif - ; source: test_word_splitw_equalities.p8:4414 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl9c - cpy p8v_sources_msb+1 - bne p8l_lbl9c - ; source: test_word_splitw_equalities.p8:4416 goto skip9c - bra p8l_skip9c - ; source: test_word_splitw_equalities.p8:4417 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4418 skip9c: -p8l_skip9c - ; source: test_word_splitw_equalities.p8:4420 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4421 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4423 goto skip9d - bra p8l_skip9d - ; source: test_word_splitw_equalities.p8:4424 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4425 skip9d: -p8l_skip9d - ; source: test_word_splitw_equalities.p8:4427 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_546_afterif -+ - ; source: test_word_splitw_equalities.p8:4428 success++ - inc p8b_main.p8v_success -label_asm_546_afterif - ; source: test_word_splitw_equalities.p8:4431 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_548_else -+ - ; source: test_word_splitw_equalities.p8:4432 success++ - inc p8b_main.p8v_success - bra label_asm_547_afterif -label_asm_548_else - ; source: test_word_splitw_equalities.p8:4434 cx16.r0L++ - inc cx16.r0L -label_asm_547_afterif - ; source: test_word_splitw_equalities.p8:4436 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4438 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10a - cpy p8v_sources_msb+1 - bne p8l_lbl10a - ; source: test_word_splitw_equalities.p8:4440 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_equalities.p8:4441 lbl10a: fail_word(377,170) -p8l_lbl10a - lda #<$0179 - ldy #>$0179 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4442 skip10a: -p8l_skip10a - ; source: test_word_splitw_equalities.p8:4444 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4445 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4447 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_equalities.p8:4448 lbl10b: fail_word(378,170) -p8l_lbl10b - lda #<$017a - ldy #>$017a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4449 skip10b: -p8l_skip10b - ; source: test_word_splitw_equalities.p8:4451 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_549_afterif -+ - ; source: test_word_splitw_equalities.p8:4452 fail_word(379,170) - lda #<$017b - ldy #>$017b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_549_afterif - ; source: test_word_splitw_equalities.p8:4455 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_551_else -+ - ; source: test_word_splitw_equalities.p8:4456 fail_word(380,170) - lda #<$017c - ldy #>$017c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_550_afterif -label_asm_551_else - ; source: test_word_splitw_equalities.p8:4458 cx16.r0L++ - inc cx16.r0L -label_asm_550_afterif - ; source: test_word_splitw_equalities.p8:4461 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl10c - cpy p8v_sources_msb+1 - bne p8l_lbl10c - ; source: test_word_splitw_equalities.p8:4463 goto skip10c - bra p8l_skip10c - ; source: test_word_splitw_equalities.p8:4464 lbl10c: fail_word(381,170) -p8l_lbl10c - lda #<$017d - ldy #>$017d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4465 skip10c: -p8l_skip10c - ; source: test_word_splitw_equalities.p8:4467 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4468 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4470 goto skip10d - bra p8l_skip10d - ; source: test_word_splitw_equalities.p8:4471 lbl10d: fail_word(382,170) -p8l_lbl10d - lda #<$017e - ldy #>$017e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4472 skip10d: -p8l_skip10d - ; source: test_word_splitw_equalities.p8:4474 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_552_afterif -+ - ; source: test_word_splitw_equalities.p8:4475 fail_word(383,170) - lda #<$017f - ldy #>$017f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_552_afterif - ; source: test_word_splitw_equalities.p8:4478 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_554_else -+ - ; source: test_word_splitw_equalities.p8:4479 fail_word(384,170) - lda #<$0180 - ldy #>$0180 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$aa - ldy #>$aa - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_553_afterif -label_asm_554_else - ; source: test_word_splitw_equalities.p8:4481 cx16.r0L++ - inc cx16.r0L -label_asm_553_afterif - ; source: test_word_splitw_equalities.p8:4483 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4485 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl11a - cpy p8v_sources_msb+1 - bne p8l_lbl11a - ; source: test_word_splitw_equalities.p8:4487 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_equalities.p8:4488 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4489 skip11a: -p8l_skip11a - ; source: test_word_splitw_equalities.p8:4491 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4492 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4494 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_equalities.p8:4495 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4496 skip11b: -p8l_skip11b - ; source: test_word_splitw_equalities.p8:4498 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_555_afterif -+ - ; source: test_word_splitw_equalities.p8:4499 success++ - inc p8b_main.p8v_success -label_asm_555_afterif - ; source: test_word_splitw_equalities.p8:4502 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_557_else -+ - ; source: test_word_splitw_equalities.p8:4503 success++ - inc p8b_main.p8v_success - bra label_asm_556_afterif -label_asm_557_else - ; source: test_word_splitw_equalities.p8:4505 cx16.r0L++ - inc cx16.r0L -label_asm_556_afterif - ; source: test_word_splitw_equalities.p8:4508 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl11c - cpy p8v_sources_msb+1 - bne p8l_lbl11c - ; source: test_word_splitw_equalities.p8:4510 goto skip11c - bra p8l_skip11c - ; source: test_word_splitw_equalities.p8:4511 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4512 skip11c: -p8l_skip11c - ; source: test_word_splitw_equalities.p8:4514 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4515 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4517 goto skip11d - bra p8l_skip11d - ; source: test_word_splitw_equalities.p8:4518 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4519 skip11d: -p8l_skip11d - ; source: test_word_splitw_equalities.p8:4521 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_558_afterif -+ - ; source: test_word_splitw_equalities.p8:4522 success++ - inc p8b_main.p8v_success -label_asm_558_afterif - ; source: test_word_splitw_equalities.p8:4525 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_560_else -+ - ; source: test_word_splitw_equalities.p8:4526 success++ - inc p8b_main.p8v_success - bra label_asm_559_afterif -label_asm_560_else - ; source: test_word_splitw_equalities.p8:4528 cx16.r0L++ - inc cx16.r0L -label_asm_559_afterif - ; source: test_word_splitw_equalities.p8:4530 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4532 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl12a - cpy p8v_sources_msb+1 - bne p8l_lbl12a - ; source: test_word_splitw_equalities.p8:4534 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_equalities.p8:4535 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4536 skip12a: -p8l_skip12a - ; source: test_word_splitw_equalities.p8:4538 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4539 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4541 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_equalities.p8:4542 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4543 skip12b: -p8l_skip12b - ; source: test_word_splitw_equalities.p8:4545 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_561_afterif -+ - ; source: test_word_splitw_equalities.p8:4546 success++ - inc p8b_main.p8v_success -label_asm_561_afterif - ; source: test_word_splitw_equalities.p8:4549 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_563_else -+ - ; source: test_word_splitw_equalities.p8:4550 success++ - inc p8b_main.p8v_success - bra label_asm_562_afterif -label_asm_563_else - ; source: test_word_splitw_equalities.p8:4552 cx16.r0L++ - inc cx16.r0L -label_asm_562_afterif - ; source: test_word_splitw_equalities.p8:4555 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl12c - cpy p8v_sources_msb+1 - bne p8l_lbl12c - ; source: test_word_splitw_equalities.p8:4557 goto skip12c - bra p8l_skip12c - ; source: test_word_splitw_equalities.p8:4558 lbl12c: success++ -p8l_lbl12c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4559 skip12c: -p8l_skip12c - ; source: test_word_splitw_equalities.p8:4561 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4562 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4564 goto skip12d - bra p8l_skip12d - ; source: test_word_splitw_equalities.p8:4565 lbl12d: success++ -p8l_lbl12d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4566 skip12d: -p8l_skip12d - ; source: test_word_splitw_equalities.p8:4568 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_564_afterif -+ - ; source: test_word_splitw_equalities.p8:4569 success++ - inc p8b_main.p8v_success -label_asm_564_afterif - ; source: test_word_splitw_equalities.p8:4572 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_566_else -+ - ; source: test_word_splitw_equalities.p8:4573 success++ - inc p8b_main.p8v_success - bra label_asm_565_afterif -label_asm_566_else - ; source: test_word_splitw_equalities.p8:4575 cx16.r0L++ - inc cx16.r0L -label_asm_565_afterif - ; source: test_word_splitw_equalities.p8:4577 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4578 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:4579 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4581 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl13a - cpy p8v_sources_msb+1 - bne p8l_lbl13a - ; source: test_word_splitw_equalities.p8:4583 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_equalities.p8:4584 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4585 skip13a: -p8l_skip13a - ; source: test_word_splitw_equalities.p8:4587 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4588 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4590 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_equalities.p8:4591 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4592 skip13b: -p8l_skip13b - ; source: test_word_splitw_equalities.p8:4594 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_567_afterif -+ - ; source: test_word_splitw_equalities.p8:4595 success++ - inc p8b_main.p8v_success -label_asm_567_afterif - ; source: test_word_splitw_equalities.p8:4598 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_569_else -+ - ; source: test_word_splitw_equalities.p8:4599 success++ - inc p8b_main.p8v_success - bra label_asm_568_afterif -label_asm_569_else - ; source: test_word_splitw_equalities.p8:4601 cx16.r0L++ - inc cx16.r0L -label_asm_568_afterif - ; source: test_word_splitw_equalities.p8:4604 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl13c - cpy p8v_sources_msb+1 - bne p8l_lbl13c - ; source: test_word_splitw_equalities.p8:4606 goto skip13c - bra p8l_skip13c - ; source: test_word_splitw_equalities.p8:4607 lbl13c: success++ -p8l_lbl13c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4608 skip13c: -p8l_skip13c - ; source: test_word_splitw_equalities.p8:4610 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4611 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4613 goto skip13d - bra p8l_skip13d - ; source: test_word_splitw_equalities.p8:4614 lbl13d: success++ -p8l_lbl13d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4615 skip13d: -p8l_skip13d - ; source: test_word_splitw_equalities.p8:4617 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_570_afterif -+ - ; source: test_word_splitw_equalities.p8:4618 success++ - inc p8b_main.p8v_success -label_asm_570_afterif - ; source: test_word_splitw_equalities.p8:4621 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_572_else -+ - ; source: test_word_splitw_equalities.p8:4622 success++ - inc p8b_main.p8v_success - bra label_asm_571_afterif -label_asm_572_else - ; source: test_word_splitw_equalities.p8:4624 cx16.r0L++ - inc cx16.r0L -label_asm_571_afterif - ; source: test_word_splitw_equalities.p8:4626 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4628 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl14a - cpy p8v_sources_msb+1 - bne p8l_lbl14a - ; source: test_word_splitw_equalities.p8:4630 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_equalities.p8:4631 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4632 skip14a: -p8l_skip14a - ; source: test_word_splitw_equalities.p8:4634 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4635 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4637 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_equalities.p8:4638 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4639 skip14b: -p8l_skip14b - ; source: test_word_splitw_equalities.p8:4641 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_573_afterif -+ - ; source: test_word_splitw_equalities.p8:4642 success++ - inc p8b_main.p8v_success -label_asm_573_afterif - ; source: test_word_splitw_equalities.p8:4645 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_575_else -+ - ; source: test_word_splitw_equalities.p8:4646 success++ - inc p8b_main.p8v_success - bra label_asm_574_afterif -label_asm_575_else - ; source: test_word_splitw_equalities.p8:4648 cx16.r0L++ - inc cx16.r0L -label_asm_574_afterif - ; source: test_word_splitw_equalities.p8:4651 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl14c - cpy p8v_sources_msb+1 - bne p8l_lbl14c - ; source: test_word_splitw_equalities.p8:4653 goto skip14c - bra p8l_skip14c - ; source: test_word_splitw_equalities.p8:4654 lbl14c: success++ -p8l_lbl14c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4655 skip14c: -p8l_skip14c - ; source: test_word_splitw_equalities.p8:4657 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4658 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4660 goto skip14d - bra p8l_skip14d - ; source: test_word_splitw_equalities.p8:4661 lbl14d: success++ -p8l_lbl14d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4662 skip14d: -p8l_skip14d - ; source: test_word_splitw_equalities.p8:4664 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_576_afterif -+ - ; source: test_word_splitw_equalities.p8:4665 success++ - inc p8b_main.p8v_success -label_asm_576_afterif - ; source: test_word_splitw_equalities.p8:4668 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_578_else -+ - ; source: test_word_splitw_equalities.p8:4669 success++ - inc p8b_main.p8v_success - bra label_asm_577_afterif -label_asm_578_else - ; source: test_word_splitw_equalities.p8:4671 cx16.r0L++ - inc cx16.r0L -label_asm_577_afterif - ; source: test_word_splitw_equalities.p8:4673 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4675 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl15a - cpy p8v_sources_msb+1 - bne p8l_lbl15a - ; source: test_word_splitw_equalities.p8:4677 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_equalities.p8:4678 lbl15a: fail_word(385,30464) -p8l_lbl15a - lda #<$0181 - ldy #>$0181 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4679 skip15a: -p8l_skip15a - ; source: test_word_splitw_equalities.p8:4681 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4682 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4684 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_equalities.p8:4685 lbl15b: fail_word(386,30464) -p8l_lbl15b - lda #<$0182 - ldy #>$0182 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4686 skip15b: -p8l_skip15b - ; source: test_word_splitw_equalities.p8:4688 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_579_afterif -+ - ; source: test_word_splitw_equalities.p8:4689 fail_word(387,30464) - lda #<$0183 - ldy #>$0183 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_579_afterif - ; source: test_word_splitw_equalities.p8:4692 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_581_else -+ - ; source: test_word_splitw_equalities.p8:4693 fail_word(388,30464) - lda #<$0184 - ldy #>$0184 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_580_afterif -label_asm_581_else - ; source: test_word_splitw_equalities.p8:4695 cx16.r0L++ - inc cx16.r0L -label_asm_580_afterif - ; source: test_word_splitw_equalities.p8:4698 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl15c - cpy p8v_sources_msb+1 - bne p8l_lbl15c - ; source: test_word_splitw_equalities.p8:4700 goto skip15c - bra p8l_skip15c - ; source: test_word_splitw_equalities.p8:4701 lbl15c: fail_word(389,30464) -p8l_lbl15c - lda #<$0185 - ldy #>$0185 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4702 skip15c: -p8l_skip15c - ; source: test_word_splitw_equalities.p8:4704 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4705 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4707 goto skip15d - bra p8l_skip15d - ; source: test_word_splitw_equalities.p8:4708 lbl15d: fail_word(390,30464) -p8l_lbl15d - lda #<$0186 - ldy #>$0186 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4709 skip15d: -p8l_skip15d - ; source: test_word_splitw_equalities.p8:4711 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_582_afterif -+ - ; source: test_word_splitw_equalities.p8:4712 fail_word(391,30464) - lda #<$0187 - ldy #>$0187 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_582_afterif - ; source: test_word_splitw_equalities.p8:4715 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_584_else -+ - ; source: test_word_splitw_equalities.p8:4716 fail_word(392,30464) - lda #<$0188 - ldy #>$0188 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7700 - ldy #>$7700 - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_583_afterif -label_asm_584_else - ; source: test_word_splitw_equalities.p8:4718 cx16.r0L++ - inc cx16.r0L -label_asm_583_afterif - ; source: test_word_splitw_equalities.p8:4720 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4722 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl16a - cpy p8v_sources_msb+1 - bne p8l_lbl16a - ; source: test_word_splitw_equalities.p8:4724 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_equalities.p8:4725 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4726 skip16a: -p8l_skip16a - ; source: test_word_splitw_equalities.p8:4728 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4729 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4731 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_equalities.p8:4732 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4733 skip16b: -p8l_skip16b - ; source: test_word_splitw_equalities.p8:4735 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_585_afterif -+ - ; source: test_word_splitw_equalities.p8:4736 success++ - inc p8b_main.p8v_success -label_asm_585_afterif - ; source: test_word_splitw_equalities.p8:4739 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_587_else -+ - ; source: test_word_splitw_equalities.p8:4740 success++ - inc p8b_main.p8v_success - bra label_asm_586_afterif -label_asm_587_else - ; source: test_word_splitw_equalities.p8:4742 cx16.r0L++ - inc cx16.r0L -label_asm_586_afterif - ; source: test_word_splitw_equalities.p8:4745 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl16c - cpy p8v_sources_msb+1 - bne p8l_lbl16c - ; source: test_word_splitw_equalities.p8:4747 goto skip16c - bra p8l_skip16c - ; source: test_word_splitw_equalities.p8:4748 lbl16c: success++ -p8l_lbl16c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4749 skip16c: -p8l_skip16c - ; source: test_word_splitw_equalities.p8:4751 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4752 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4754 goto skip16d - bra p8l_skip16d - ; source: test_word_splitw_equalities.p8:4755 lbl16d: success++ -p8l_lbl16d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4756 skip16d: -p8l_skip16d - ; source: test_word_splitw_equalities.p8:4758 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_588_afterif -+ - ; source: test_word_splitw_equalities.p8:4759 success++ - inc p8b_main.p8v_success -label_asm_588_afterif - ; source: test_word_splitw_equalities.p8:4762 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_590_else -+ - ; source: test_word_splitw_equalities.p8:4763 success++ - inc p8b_main.p8v_success - bra label_asm_589_afterif -label_asm_590_else - ; source: test_word_splitw_equalities.p8:4765 cx16.r0L++ - inc cx16.r0L -label_asm_589_afterif - ; source: test_word_splitw_equalities.p8:4767 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4768 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_equalities.p8:4769 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4771 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl17a - cpy p8v_sources_msb+1 - bne p8l_lbl17a - ; source: test_word_splitw_equalities.p8:4773 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_equalities.p8:4774 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4775 skip17a: -p8l_skip17a - ; source: test_word_splitw_equalities.p8:4777 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4778 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4780 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_equalities.p8:4781 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4782 skip17b: -p8l_skip17b - ; source: test_word_splitw_equalities.p8:4784 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_591_afterif -+ - ; source: test_word_splitw_equalities.p8:4785 success++ - inc p8b_main.p8v_success -label_asm_591_afterif - ; source: test_word_splitw_equalities.p8:4788 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_593_else -+ - ; source: test_word_splitw_equalities.p8:4789 success++ - inc p8b_main.p8v_success - bra label_asm_592_afterif -label_asm_593_else - ; source: test_word_splitw_equalities.p8:4791 cx16.r0L++ - inc cx16.r0L -label_asm_592_afterif - ; source: test_word_splitw_equalities.p8:4794 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl17c - cpy p8v_sources_msb+1 - bne p8l_lbl17c - ; source: test_word_splitw_equalities.p8:4796 goto skip17c - bra p8l_skip17c - ; source: test_word_splitw_equalities.p8:4797 lbl17c: success++ -p8l_lbl17c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4798 skip17c: -p8l_skip17c - ; source: test_word_splitw_equalities.p8:4800 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4801 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4803 goto skip17d - bra p8l_skip17d - ; source: test_word_splitw_equalities.p8:4804 lbl17d: success++ -p8l_lbl17d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4805 skip17d: -p8l_skip17d - ; source: test_word_splitw_equalities.p8:4807 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_594_afterif -+ - ; source: test_word_splitw_equalities.p8:4808 success++ - inc p8b_main.p8v_success -label_asm_594_afterif - ; source: test_word_splitw_equalities.p8:4811 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_596_else -+ - ; source: test_word_splitw_equalities.p8:4812 success++ - inc p8b_main.p8v_success - bra label_asm_595_afterif -label_asm_596_else - ; source: test_word_splitw_equalities.p8:4814 cx16.r0L++ - inc cx16.r0L -label_asm_595_afterif - ; source: test_word_splitw_equalities.p8:4816 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4818 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl18a - cpy p8v_sources_msb+1 - bne p8l_lbl18a - ; source: test_word_splitw_equalities.p8:4820 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_equalities.p8:4821 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4822 skip18a: -p8l_skip18a - ; source: test_word_splitw_equalities.p8:4824 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4825 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4827 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_equalities.p8:4828 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4829 skip18b: -p8l_skip18b - ; source: test_word_splitw_equalities.p8:4831 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_597_afterif -+ - ; source: test_word_splitw_equalities.p8:4832 success++ - inc p8b_main.p8v_success -label_asm_597_afterif - ; source: test_word_splitw_equalities.p8:4835 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_599_else -+ - ; source: test_word_splitw_equalities.p8:4836 success++ - inc p8b_main.p8v_success - bra label_asm_598_afterif -label_asm_599_else - ; source: test_word_splitw_equalities.p8:4838 cx16.r0L++ - inc cx16.r0L -label_asm_598_afterif - ; source: test_word_splitw_equalities.p8:4841 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl18c - cpy p8v_sources_msb+1 - bne p8l_lbl18c - ; source: test_word_splitw_equalities.p8:4843 goto skip18c - bra p8l_skip18c - ; source: test_word_splitw_equalities.p8:4844 lbl18c: success++ -p8l_lbl18c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4845 skip18c: -p8l_skip18c - ; source: test_word_splitw_equalities.p8:4847 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4848 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4850 goto skip18d - bra p8l_skip18d - ; source: test_word_splitw_equalities.p8:4851 lbl18d: success++ -p8l_lbl18d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4852 skip18d: -p8l_skip18d - ; source: test_word_splitw_equalities.p8:4854 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_600_afterif -+ - ; source: test_word_splitw_equalities.p8:4855 success++ - inc p8b_main.p8v_success -label_asm_600_afterif - ; source: test_word_splitw_equalities.p8:4858 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_602_else -+ - ; source: test_word_splitw_equalities.p8:4859 success++ - inc p8b_main.p8v_success - bra label_asm_601_afterif -label_asm_602_else - ; source: test_word_splitw_equalities.p8:4861 cx16.r0L++ - inc cx16.r0L -label_asm_601_afterif - ; source: test_word_splitw_equalities.p8:4863 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4865 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl19a - cpy p8v_sources_msb+1 - bne p8l_lbl19a - ; source: test_word_splitw_equalities.p8:4867 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_equalities.p8:4868 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4869 skip19a: -p8l_skip19a - ; source: test_word_splitw_equalities.p8:4871 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4872 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4874 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_equalities.p8:4875 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4876 skip19b: -p8l_skip19b - ; source: test_word_splitw_equalities.p8:4878 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_603_afterif -+ - ; source: test_word_splitw_equalities.p8:4879 success++ - inc p8b_main.p8v_success -label_asm_603_afterif - ; source: test_word_splitw_equalities.p8:4882 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_605_else -+ - ; source: test_word_splitw_equalities.p8:4883 success++ - inc p8b_main.p8v_success - bra label_asm_604_afterif -label_asm_605_else - ; source: test_word_splitw_equalities.p8:4885 cx16.r0L++ - inc cx16.r0L -label_asm_604_afterif - ; source: test_word_splitw_equalities.p8:4888 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl19c - cpy p8v_sources_msb+1 - bne p8l_lbl19c - ; source: test_word_splitw_equalities.p8:4890 goto skip19c - bra p8l_skip19c - ; source: test_word_splitw_equalities.p8:4891 lbl19c: success++ -p8l_lbl19c - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4892 skip19c: -p8l_skip19c - ; source: test_word_splitw_equalities.p8:4894 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4895 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4897 goto skip19d - bra p8l_skip19d - ; source: test_word_splitw_equalities.p8:4898 lbl19d: success++ -p8l_lbl19d - inc p8b_main.p8v_success - ; source: test_word_splitw_equalities.p8:4899 skip19d: -p8l_skip19d - ; source: test_word_splitw_equalities.p8:4901 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_606_afterif -+ - ; source: test_word_splitw_equalities.p8:4902 success++ - inc p8b_main.p8v_success -label_asm_606_afterif - ; source: test_word_splitw_equalities.p8:4905 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_608_else -+ - ; source: test_word_splitw_equalities.p8:4906 success++ - inc p8b_main.p8v_success - bra label_asm_607_afterif -label_asm_608_else - ; source: test_word_splitw_equalities.p8:4908 cx16.r0L++ - inc cx16.r0L -label_asm_607_afterif - ; source: test_word_splitw_equalities.p8:4910 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_equalities.p8:4912 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl20a - cpy p8v_sources_msb+1 - bne p8l_lbl20a - ; source: test_word_splitw_equalities.p8:4914 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_equalities.p8:4915 lbl20a: fail_word(393,32767) -p8l_lbl20a - lda #<$0189 - ldy #>$0189 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4916 skip20a: -p8l_skip20a - ; source: test_word_splitw_equalities.p8:4918 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4919 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4921 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_equalities.p8:4922 lbl20b: fail_word(394,32767) -p8l_lbl20b - lda #<$018a - ldy #>$018a - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4923 skip20b: -p8l_skip20b - ; source: test_word_splitw_equalities.p8:4925 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_609_afterif -+ - ; source: test_word_splitw_equalities.p8:4926 fail_word(395,32767) - lda #<$018b - ldy #>$018b - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_609_afterif - ; source: test_word_splitw_equalities.p8:4929 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_611_else -+ - ; source: test_word_splitw_equalities.p8:4930 fail_word(396,32767) - lda #<$018c - ldy #>$018c - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_610_afterif -label_asm_611_else - ; source: test_word_splitw_equalities.p8:4932 cx16.r0L++ - inc cx16.r0L -label_asm_610_afterif - ; source: test_word_splitw_equalities.p8:4935 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne p8l_lbl20c - cpy p8v_sources_msb+1 - bne p8l_lbl20c - ; source: test_word_splitw_equalities.p8:4937 goto skip20c - bra p8l_skip20c - ; source: test_word_splitw_equalities.p8:4938 lbl20c: fail_word(397,32767) -p8l_lbl20c - lda #<$018d - ldy #>$018d - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4939 skip20c: -p8l_skip20c - ; source: test_word_splitw_equalities.p8:4941 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_equalities.p8:4942 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq ++ -+ jmp (cx16.r3) -+ - ; source: test_word_splitw_equalities.p8:4944 goto skip20d - bra p8l_skip20d - ; source: test_word_splitw_equalities.p8:4945 lbl20d: fail_word(398,32767) -p8l_lbl20d - lda #<$018e - ldy #>$018e - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_equalities.p8:4946 skip20d: -p8l_skip20d - ; source: test_word_splitw_equalities.p8:4948 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_612_afterif -+ - ; source: test_word_splitw_equalities.p8:4949 fail_word(399,32767) - lda #<$018f - ldy #>$018f - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word -label_asm_612_afterif - ; source: test_word_splitw_equalities.p8:4952 if sources[1]!=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_sources_lsb+1 - bne + - cpy p8v_sources_msb+1 - beq label_asm_614_else -+ - ; source: test_word_splitw_equalities.p8:4953 fail_word(400,32767) - lda #<$0190 - ldy #>$0190 - sta p8b_main.p8s_fail_word.p8v_idx - sty p8b_main.p8s_fail_word.p8v_idx+1 - - lda #<$7fff - ldy #>$7fff - sta p8b_main.p8s_fail_word.p8v_v1 - sty p8b_main.p8s_fail_word.p8v_v1+1 - - jsr p8b_main.p8s_fail_word - bra label_asm_613_afterif -label_asm_614_else - ; source: test_word_splitw_equalities.p8:4955 cx16.r0L++ - inc cx16.r0L -label_asm_613_afterif - ; source: test_word_splitw_equalities.p8:4957 verify_success(128) - lda #$80 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_equalities.p8:4002 sub test_not_array_splitw() { -; variables - .section BSS - .send BSS - -; non-zeropage variables -_array_p8v_sources := $270f, $22b8 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $270f, $22b8 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\n(in)equality tests for split words datatype: " - .byte $0d, $28, $49, $4e, $29, $45, $51, $55, $41, $4c, $49, $54, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $20, $53, $50, $4c, $49, $54, $20, $57, $4f - .byte $52, $44, $53, $20, $44, $41, $54, $41, $54, $59, $50, $45, $3a, $20, $00 -string_10 ; PETSCII:"\n==expr: " - .byte $0d, $3d, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_11 ; PETSCII:"\n!=expr: " - .byte $0d, $21, $3d, $45, $58, $50, $52, $3a, $20, $00 -string_13 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_14 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_15 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_16 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 -string_2 ; PETSCII:"==0: " - .byte $3d, $3d, $30, $3a, $20, $00 -string_3 ; PETSCII:"\n!=0: " - .byte $0d, $21, $3d, $30, $3a, $20, $00 -string_4 ; PETSCII:"\n==number: " - .byte $0d, $3d, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_5 ; PETSCII:"\n!=number: " - .byte $0d, $21, $3d, $4e, $55, $4d, $42, $45, $52, $3a, $20, $00 -string_6 ; PETSCII:"\n==var: " - .byte $0d, $3d, $3d, $56, $41, $52, $3a, $20, $00 -string_7 ; PETSCII:"\n!=var: " - .byte $0d, $21, $3d, $56, $41, $52, $3a, $20, $00 -string_8 ; PETSCII:"\n==array[] @split: " - .byte $0d, $3d, $3d, $41, $52, $52, $41, $59, $5b, $5d, $20, $40, $53, $50, $4c, $49 - .byte $54, $3a, $20, $00 -string_9 ; PETSCII:"\n!=array[] @split: " - .byte $0d, $21, $3d, $41, $52, $52, $41, $59, $5b, $5d, $20, $40, $53, $50, $4c, $49 - .byte $54, $3a, $20, $00 - - ; source: test_word_splitw_equalities.p8:14 txt.print("\n(in)equality tests for split words datatype: ") - ; source: test_word_splitw_equalities.p8:18 txt.print("==0: ") - ; source: test_word_splitw_equalities.p8:20 txt.print("\n!=0: ") - ; source: test_word_splitw_equalities.p8:22 txt.print("\n==number: ") - ; source: test_word_splitw_equalities.p8:24 txt.print("\n!=number: ") - ; source: test_word_splitw_equalities.p8:26 txt.print("\n==var: ") - ; source: test_word_splitw_equalities.p8:28 txt.print("\n!=var: ") - ; source: test_word_splitw_equalities.p8:30 txt.print("\n==array[] @split: ") - ; source: test_word_splitw_equalities.p8:32 txt.print("\n!=array[] @split: ") - ; source: test_word_splitw_equalities.p8:34 txt.print("\n==expr: ") - ; source: test_word_splitw_equalities.p8:36 txt.print("\n!=expr: ") - ; source: test_word_splitw_equalities.p8:45 txt.print(" **failed** ") - ; source: test_word_splitw_equalities.p8:47 txt.print(" success, expected ") - ; source: test_word_splitw_equalities.p8:53 txt.print(" **fail#") - ; source: test_word_splitw_equalities.p8:57 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_splitw_equalities.p8 b/compiler/test/comparisons/test_word_splitw_equalities.p8 deleted file mode 100644 index 82bedd6c5..000000000 --- a/compiler/test/comparisons/test_word_splitw_equalities.p8 +++ /dev/null @@ -1,4961 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - ubyte success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\n(in)equality tests for split words datatype: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("==0: ") - test_is_zero() - txt.print("\n!=0: ") - test_not_zero() - txt.print("\n==number: ") - test_is_number() - txt.print("\n!=number: ") - test_not_number() - txt.print("\n==var: ") - test_is_var() - txt.print("\n!=var: ") - test_not_var() - txt.print("\n==array[] @split: ") - test_is_array_splitw() - txt.print("\n!=array[] @split: ") - test_not_array_splitw() - txt.print("\n==expr: ") - test_is_expr() - txt.print("\n!=expr: ") - test_not_expr() - test_stack.test() - } - - sub verify_success(ubyte expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_ub(success) - txt.print(" success, expected ") - txt.print_ub(expected) - } - } - - sub fail_word(uword idx, word v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_w(v1) - txt.print(" **") - } - - sub fail_uword(uword idx, uword v1) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.chrout(':') - txt.print_uw(v1) - txt.print(" **") - } - - - - sub test_is_zero() { - word[] @split sources = [9999, 9999] - success = 0 - - sources[1]=0 - ; direct jump - if sources[1]==0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if sources[1]==0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if sources[1]==0 - success++ - - ; with else - if sources[1]==0 - success++ - else - cx16.r0L++ - - sources[1] = -9999 - ; direct jump - if sources[1]==0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if sources[1]==0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if sources[1]==0 - success-- - - ; with else - if sources[1]==0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - - sub test_not_zero() { - word[] @split sources = [9999, 9999] - success = 0 - - sources[1]=-9999 - ; direct jump - if sources[1]!=0 - goto lbl1 - goto skip1 -lbl1: success++ -skip1: - ; indirect jump - cx16.r3 = &lbl2 - if sources[1]!=0 - goto cx16.r3 - goto skip2 -lbl2: success++ -skip2: - ; no else - if sources[1]!=0 - success++ - - ; with else - if sources[1]!=0 - success++ - else - cx16.r0L++ - - sources[1] = 0 - ; direct jump - if sources[1]!=0 - goto skip3 - success++ -skip3: - ; indirect jump - cx16.r3 = &skip4 - if sources[1]!=0 - goto cx16.r3 - success++ -skip4: - ; no else - success++ - if sources[1]!=0 - success-- - - ; with else - if sources[1]!=0 - cx16.r0L++ - else - success++ - - verify_success(8) - } - - sub test_is_number() { - word[] @split sources = [9999, 9999] - success = 0 - sources[1]=-21829 - ; direct jump - if sources[1]==-21829 - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==-21829 - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]==-21829 - success++ - - ; with else - if sources[1]==-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==170 - goto lbl2a - goto skip2a -lbl2a: fail_word(1,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==170 - goto cx16.r3 - goto skip2b -lbl2b: fail_word(2,-21829) -skip2b: - ; no else - if sources[1]==170 - fail_word(3,-21829) - - ; with else - if sources[1]==170 - fail_word(4,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl3a - goto skip3a -lbl3a: fail_word(5,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==30464 - goto cx16.r3 - goto skip3b -lbl3b: fail_word(6,-21829) -skip3b: - ; no else - if sources[1]==30464 - fail_word(7,-21829) - - ; with else - if sources[1]==30464 - fail_word(8,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==32767 - goto lbl4a - goto skip4a -lbl4a: fail_word(9,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==32767 - goto cx16.r3 - goto skip4b -lbl4b: fail_word(10,-21829) -skip4b: - ; no else - if sources[1]==32767 - fail_word(11,-21829) - - ; with else - if sources[1]==32767 - fail_word(12,-21829) - else - cx16.r0L++ - - sources[1]=0 - ; direct jump - if sources[1]==-21829 - goto lbl5a - goto skip5a -lbl5a: fail_word(13,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==-21829 - goto cx16.r3 - goto skip5b -lbl5b: fail_word(14,0) -skip5b: - ; no else - if sources[1]==-21829 - fail_word(15,0) - - ; with else - if sources[1]==-21829 - fail_word(16,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==170 - goto lbl6a - goto skip6a -lbl6a: fail_word(17,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==170 - goto cx16.r3 - goto skip6b -lbl6b: fail_word(18,0) -skip6b: - ; no else - if sources[1]==170 - fail_word(19,0) - - ; with else - if sources[1]==170 - fail_word(20,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl7a - goto skip7a -lbl7a: fail_word(21,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==30464 - goto cx16.r3 - goto skip7b -lbl7b: fail_word(22,0) -skip7b: - ; no else - if sources[1]==30464 - fail_word(23,0) - - ; with else - if sources[1]==30464 - fail_word(24,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==32767 - goto lbl8a - goto skip8a -lbl8a: fail_word(25,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==32767 - goto cx16.r3 - goto skip8b -lbl8b: fail_word(26,0) -skip8b: - ; no else - if sources[1]==32767 - fail_word(27,0) - - ; with else - if sources[1]==32767 - fail_word(28,0) - else - cx16.r0L++ - - sources[1]=170 - ; direct jump - if sources[1]==-21829 - goto lbl9a - goto skip9a -lbl9a: fail_word(29,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==-21829 - goto cx16.r3 - goto skip9b -lbl9b: fail_word(30,170) -skip9b: - ; no else - if sources[1]==-21829 - fail_word(31,170) - - ; with else - if sources[1]==-21829 - fail_word(32,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==170 - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==170 - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]==170 - success++ - - ; with else - if sources[1]==170 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl11a - goto skip11a -lbl11a: fail_word(33,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==30464 - goto cx16.r3 - goto skip11b -lbl11b: fail_word(34,170) -skip11b: - ; no else - if sources[1]==30464 - fail_word(35,170) - - ; with else - if sources[1]==30464 - fail_word(36,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==32767 - goto lbl12a - goto skip12a -lbl12a: fail_word(37,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==32767 - goto cx16.r3 - goto skip12b -lbl12b: fail_word(38,170) -skip12b: - ; no else - if sources[1]==32767 - fail_word(39,170) - - ; with else - if sources[1]==32767 - fail_word(40,170) - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]==-21829 - goto lbl13a - goto skip13a -lbl13a: fail_word(41,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]==-21829 - goto cx16.r3 - goto skip13b -lbl13b: fail_word(42,30464) -skip13b: - ; no else - if sources[1]==-21829 - fail_word(43,30464) - - ; with else - if sources[1]==-21829 - fail_word(44,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==170 - goto lbl14a - goto skip14a -lbl14a: fail_word(45,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]==170 - goto cx16.r3 - goto skip14b -lbl14b: fail_word(46,30464) -skip14b: - ; no else - if sources[1]==170 - fail_word(47,30464) - - ; with else - if sources[1]==170 - fail_word(48,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]==30464 - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if sources[1]==30464 - success++ - - ; with else - if sources[1]==30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==32767 - goto lbl16a - goto skip16a -lbl16a: fail_word(49,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]==32767 - goto cx16.r3 - goto skip16b -lbl16b: fail_word(50,30464) -skip16b: - ; no else - if sources[1]==32767 - fail_word(51,30464) - - ; with else - if sources[1]==32767 - fail_word(52,30464) - else - cx16.r0L++ - - sources[1]=32767 - ; direct jump - if sources[1]==-21829 - goto lbl17a - goto skip17a -lbl17a: fail_word(53,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]==-21829 - goto cx16.r3 - goto skip17b -lbl17b: fail_word(54,32767) -skip17b: - ; no else - if sources[1]==-21829 - fail_word(55,32767) - - ; with else - if sources[1]==-21829 - fail_word(56,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==170 - goto lbl18a - goto skip18a -lbl18a: fail_word(57,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]==170 - goto cx16.r3 - goto skip18b -lbl18b: fail_word(58,32767) -skip18b: - ; no else - if sources[1]==170 - fail_word(59,32767) - - ; with else - if sources[1]==170 - fail_word(60,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==30464 - goto lbl19a - goto skip19a -lbl19a: fail_word(61,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]==30464 - goto cx16.r3 - goto skip19b -lbl19b: fail_word(62,32767) -skip19b: - ; no else - if sources[1]==30464 - fail_word(63,32767) - - ; with else - if sources[1]==30464 - fail_word(64,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==32767 - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]==32767 - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if sources[1]==32767 - success++ - - ; with else - if sources[1]==32767 - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_number() { - word[] @split sources = [9999, 9999] - success = 0 - sources[1]=-21829 - ; direct jump - if sources[1]!=-21829 - goto lbl1a - goto skip1a -lbl1a: fail_word(65,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=-21829 - goto cx16.r3 - goto skip1b -lbl1b: fail_word(66,-21829) -skip1b: - ; no else - if sources[1]!=-21829 - fail_word(67,-21829) - - ; with else - if sources[1]!=-21829 - fail_word(68,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=170 - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=170 - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=170 - success++ - - ; with else - if sources[1]!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=30464 - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=32767 - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=32767 - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]!=32767 - success++ - - ; with else - if sources[1]!=32767 - success++ - else - cx16.r0L++ - - sources[1]=0 - ; direct jump - if sources[1]!=-21829 - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=-21829 - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=-21829 - success++ - - ; with else - if sources[1]!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=170 - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=170 - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=170 - success++ - - ; with else - if sources[1]!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=30464 - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=32767 - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=32767 - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]!=32767 - success++ - - ; with else - if sources[1]!=32767 - success++ - else - cx16.r0L++ - - sources[1]=170 - ; direct jump - if sources[1]!=-21829 - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=-21829 - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=-21829 - success++ - - ; with else - if sources[1]!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=170 - goto lbl10a - goto skip10a -lbl10a: fail_word(69,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=170 - goto cx16.r3 - goto skip10b -lbl10b: fail_word(70,170) -skip10b: - ; no else - if sources[1]!=170 - fail_word(71,170) - - ; with else - if sources[1]!=170 - fail_word(72,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=30464 - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=32767 - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=32767 - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]!=32767 - success++ - - ; with else - if sources[1]!=32767 - success++ - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]!=-21829 - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]!=-21829 - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if sources[1]!=-21829 - success++ - - ; with else - if sources[1]!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=170 - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]!=170 - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if sources[1]!=170 - success++ - - ; with else - if sources[1]!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl15a - goto skip15a -lbl15a: fail_word(73,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]!=30464 - goto cx16.r3 - goto skip15b -lbl15b: fail_word(74,30464) -skip15b: - ; no else - if sources[1]!=30464 - fail_word(75,30464) - - ; with else - if sources[1]!=30464 - fail_word(76,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=32767 - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]!=32767 - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if sources[1]!=32767 - success++ - - ; with else - if sources[1]!=32767 - success++ - else - cx16.r0L++ - - sources[1]=32767 - ; direct jump - if sources[1]!=-21829 - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]!=-21829 - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if sources[1]!=-21829 - success++ - - ; with else - if sources[1]!=-21829 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=170 - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]!=170 - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if sources[1]!=170 - success++ - - ; with else - if sources[1]!=170 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=30464 - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]!=30464 - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if sources[1]!=30464 - success++ - - ; with else - if sources[1]!=30464 - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=32767 - goto lbl20a - goto skip20a -lbl20a: fail_word(77,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]!=32767 - goto cx16.r3 - goto skip20b -lbl20b: fail_word(78,32767) -skip20b: - ; no else - if sources[1]!=32767 - fail_word(79,32767) - - ; with else - if sources[1]!=32767 - fail_word(80,32767) - else - cx16.r0L++ - - verify_success(64) -} - sub test_is_var() { - word[] @split sources = [9999, 9999] - word[] @split values = [8888,8888] - success = 0 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(81,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(82,-21829) -skip2b: - ; no else - if sources[1]==values[1] - fail_word(83,-21829) - - ; with else - if sources[1]==values[1] - fail_word(84,-21829) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(85,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(86,-21829) -skip3b: - ; no else - if sources[1]==values[1] - fail_word(87,-21829) - - ; with else - if sources[1]==values[1] - fail_word(88,-21829) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(89,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(90,-21829) -skip4b: - ; no else - if sources[1]==values[1] - fail_word(91,-21829) - - ; with else - if sources[1]==values[1] - fail_word(92,-21829) - else - cx16.r0L++ - - sources[1]=0 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(93,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(94,0) -skip5b: - ; no else - if sources[1]==values[1] - fail_word(95,0) - - ; with else - if sources[1]==values[1] - fail_word(96,0) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(97,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(98,0) -skip6b: - ; no else - if sources[1]==values[1] - fail_word(99,0) - - ; with else - if sources[1]==values[1] - fail_word(100,0) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(101,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(102,0) -skip7b: - ; no else - if sources[1]==values[1] - fail_word(103,0) - - ; with else - if sources[1]==values[1] - fail_word(104,0) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl8a - goto skip8a -lbl8a: fail_word(105,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_word(106,0) -skip8b: - ; no else - if sources[1]==values[1] - fail_word(107,0) - - ; with else - if sources[1]==values[1] - fail_word(108,0) - else - cx16.r0L++ - - sources[1]=170 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl9a - goto skip9a -lbl9a: fail_word(109,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_word(110,170) -skip9b: - ; no else - if sources[1]==values[1] - fail_word(111,170) - - ; with else - if sources[1]==values[1] - fail_word(112,170) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(113,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(114,170) -skip11b: - ; no else - if sources[1]==values[1] - fail_word(115,170) - - ; with else - if sources[1]==values[1] - fail_word(116,170) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(117,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(118,170) -skip12b: - ; no else - if sources[1]==values[1] - fail_word(119,170) - - ; with else - if sources[1]==values[1] - fail_word(120,170) - else - cx16.r0L++ - - sources[1]=30464 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(121,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]==values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(122,30464) -skip13b: - ; no else - if sources[1]==values[1] - fail_word(123,30464) - - ; with else - if sources[1]==values[1] - fail_word(124,30464) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(125,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]==values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(126,30464) -skip14b: - ; no else - if sources[1]==values[1] - fail_word(127,30464) - - ; with else - if sources[1]==values[1] - fail_word(128,30464) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]==values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl16a - goto skip16a -lbl16a: fail_word(129,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]==values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_word(130,30464) -skip16b: - ; no else - if sources[1]==values[1] - fail_word(131,30464) - - ; with else - if sources[1]==values[1] - fail_word(132,30464) - else - cx16.r0L++ - - sources[1]=32767 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl17a - goto skip17a -lbl17a: fail_word(133,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]==values[1] - goto cx16.r3 - goto skip17b -lbl17b: fail_word(134,32767) -skip17b: - ; no else - if sources[1]==values[1] - fail_word(135,32767) - - ; with else - if sources[1]==values[1] - fail_word(136,32767) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(137,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]==values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(138,32767) -skip18b: - ; no else - if sources[1]==values[1] - fail_word(139,32767) - - ; with else - if sources[1]==values[1] - fail_word(140,32767) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(141,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]==values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(142,32767) -skip19b: - ; no else - if sources[1]==values[1] - fail_word(143,32767) - - ; with else - if sources[1]==values[1] - fail_word(144,32767) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]==values[1] - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_var() { - word[] @split sources = [9999, 9999] - word[] @split values = [8888,8888] - success = 0 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl1a - goto skip1a -lbl1a: fail_word(145,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_word(146,-21829) -skip1b: - ; no else - if sources[1]!=values[1] - fail_word(147,-21829) - - ; with else - if sources[1]!=values[1] - fail_word(148,-21829) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=0 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=170 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(149,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(150,170) -skip10b: - ; no else - if sources[1]!=values[1] - fail_word(151,170) - - ; with else - if sources[1]!=values[1] - fail_word(152,170) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=30464 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]!=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]!=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_word(153,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]!=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_word(154,30464) -skip15b: - ; no else - if sources[1]!=values[1] - fail_word(155,30464) - - ; with else - if sources[1]!=values[1] - fail_word(156,30464) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]!=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - sources[1]=32767 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]!=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]!=values[1] - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]!=values[1] - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(157,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]!=values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(158,32767) -skip20b: - ; no else - if sources[1]!=values[1] - fail_word(159,32767) - - ; with else - if sources[1]!=values[1] - fail_word(160,32767) - else - cx16.r0L++ - - verify_success(64) -} - sub test_is_expr() { - word[] @split sources = [9999, 9999] - cx16.r4 = 1 - cx16.r5 = 1 - success = 0 - sources[1]=-21829 - ; direct jump - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]==cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if sources[1]==cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+170-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: fail_word(161,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: fail_word(162,-21829) -skip2b: - ; no else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(163,-21829) - - ; with else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(164,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+30464-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: fail_word(165,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: fail_word(166,-21829) -skip3b: - ; no else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(167,-21829) - - ; with else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(168,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+32767-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: fail_word(169,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: fail_word(170,-21829) -skip4b: - ; no else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(171,-21829) - - ; with else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(172,-21829) - else - cx16.r0L++ - - sources[1]=0 - ; direct jump - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: fail_word(173,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: fail_word(174,0) -skip5b: - ; no else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(175,0) - - ; with else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(176,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+170-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: fail_word(177,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: fail_word(178,0) -skip6b: - ; no else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(179,0) - - ; with else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(180,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+30464-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: fail_word(181,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: fail_word(182,0) -skip7b: - ; no else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(183,0) - - ; with else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(184,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+32767-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: fail_word(185,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: fail_word(186,0) -skip8b: - ; no else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(187,0) - - ; with else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(188,0) - else - cx16.r0L++ - - sources[1]=170 - ; direct jump - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: fail_word(189,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: fail_word(190,170) -skip9b: - ; no else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(191,170) - - ; with else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(192,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+170-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]==cx16.r4s+170-cx16.r5s - success++ - - ; with else - if sources[1]==cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+30464-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: fail_word(193,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: fail_word(194,170) -skip11b: - ; no else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(195,170) - - ; with else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(196,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+32767-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: fail_word(197,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: fail_word(198,170) -skip12b: - ; no else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(199,170) - - ; with else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(200,170) - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: fail_word(201,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: fail_word(202,30464) -skip13b: - ; no else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(203,30464) - - ; with else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(204,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+170-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: fail_word(205,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: fail_word(206,30464) -skip14b: - ; no else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(207,30464) - - ; with else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(208,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+30464-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if sources[1]==cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if sources[1]==cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+32767-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: fail_word(209,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: fail_word(210,30464) -skip16b: - ; no else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(211,30464) - - ; with else - if sources[1]==cx16.r4s+32767-cx16.r5s - fail_word(212,30464) - else - cx16.r0L++ - - sources[1]=32767 - ; direct jump - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: fail_word(213,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]==cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: fail_word(214,32767) -skip17b: - ; no else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(215,32767) - - ; with else - if sources[1]==cx16.r4s+-21829-cx16.r5s - fail_word(216,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+170-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: fail_word(217,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]==cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: fail_word(218,32767) -skip18b: - ; no else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(219,32767) - - ; with else - if sources[1]==cx16.r4s+170-cx16.r5s - fail_word(220,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+30464-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: fail_word(221,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]==cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: fail_word(222,32767) -skip19b: - ; no else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(223,32767) - - ; with else - if sources[1]==cx16.r4s+30464-cx16.r5s - fail_word(224,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==cx16.r4s+32767-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]==cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if sources[1]==cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if sources[1]==cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - verify_success(16) -} - sub test_not_expr() { - word[] @split sources = [9999, 9999] - cx16.r4 = 1 - cx16.r5 = 1 - success = 0 - sources[1]=-21829 - ; direct jump - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto lbl1a - goto skip1a -lbl1a: fail_word(225,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip1b -lbl1b: fail_word(226,-21829) -skip1b: - ; no else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - fail_word(227,-21829) - - ; with else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - fail_word(228,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+170-cx16.r5s - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - sources[1]=0 - ; direct jump - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+170-cx16.r5s - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - sources[1]=170 - ; direct jump - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+170-cx16.r5s - goto lbl10a - goto skip10a -lbl10a: fail_word(229,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip10b -lbl10b: fail_word(230,170) -skip10b: - ; no else - if sources[1]!=cx16.r4s+170-cx16.r5s - fail_word(231,170) - - ; with else - if sources[1]!=cx16.r4s+170-cx16.r5s - fail_word(232,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - sources[1]=30464 - ; direct jump - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+170-cx16.r5s - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto lbl15a - goto skip15a -lbl15a: fail_word(233,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip15b -lbl15b: fail_word(234,30464) -skip15b: - ; no else - if sources[1]!=cx16.r4s+30464-cx16.r5s - fail_word(235,30464) - - ; with else - if sources[1]!=cx16.r4s+30464-cx16.r5s - fail_word(236,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+32767-cx16.r5s - success++ - else - cx16.r0L++ - - sources[1]=32767 - ; direct jump - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]!=cx16.r4s+-21829-cx16.r5s - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+-21829-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+170-cx16.r5s - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]!=cx16.r4s+170-cx16.r5s - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+170-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]!=cx16.r4s+30464-cx16.r5s - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - - ; with else - if sources[1]!=cx16.r4s+30464-cx16.r5s - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto lbl20a - goto skip20a -lbl20a: fail_word(237,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]!=cx16.r4s+32767-cx16.r5s - goto cx16.r3 - goto skip20b -lbl20b: fail_word(238,32767) -skip20b: - ; no else - if sources[1]!=cx16.r4s+32767-cx16.r5s - fail_word(239,32767) - - ; with else - if sources[1]!=cx16.r4s+32767-cx16.r5s - fail_word(240,32767) - else - cx16.r0L++ - - verify_success(64) -} - sub test_is_array_splitw() { - - word[] @split values = [9999, 8888] - word[] @split sources = [9999, 8888] - success = 0 - values[1]=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]==values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]==values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(241,-21829) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]==values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(242,-21829) -skip2b: - ; no else - if sources[1]==values[1] - fail_word(243,-21829) - - ; with else - if sources[1]==values[1] - fail_word(244,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl2c - goto skip2c -lbl2c: fail_word(245,-21829) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]==values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_word(246,-21829) -skip2d: - ; no else - if sources[1]==values[1] - fail_word(247,-21829) - - ; with else - if sources[1]==values[1] - fail_word(248,-21829) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(249,-21829) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]==values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(250,-21829) -skip3b: - ; no else - if sources[1]==values[1] - fail_word(251,-21829) - - ; with else - if sources[1]==values[1] - fail_word(252,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl3c - goto skip3c -lbl3c: fail_word(253,-21829) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]==values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_word(254,-21829) -skip3d: - ; no else - if sources[1]==values[1] - fail_word(255,-21829) - - ; with else - if sources[1]==values[1] - fail_word(256,-21829) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(257,-21829) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]==values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(258,-21829) -skip4b: - ; no else - if sources[1]==values[1] - fail_word(259,-21829) - - ; with else - if sources[1]==values[1] - fail_word(260,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl4c - goto skip4c -lbl4c: fail_word(261,-21829) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]==values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_word(262,-21829) -skip4d: - ; no else - if sources[1]==values[1] - fail_word(263,-21829) - - ; with else - if sources[1]==values[1] - fail_word(264,-21829) - else - cx16.r0L++ - - values[1]=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(265,0) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]==values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(266,0) -skip5b: - ; no else - if sources[1]==values[1] - fail_word(267,0) - - ; with else - if sources[1]==values[1] - fail_word(268,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl5c - goto skip5c -lbl5c: fail_word(269,0) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]==values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_word(270,0) -skip5d: - ; no else - if sources[1]==values[1] - fail_word(271,0) - - ; with else - if sources[1]==values[1] - fail_word(272,0) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(273,0) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]==values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(274,0) -skip6b: - ; no else - if sources[1]==values[1] - fail_word(275,0) - - ; with else - if sources[1]==values[1] - fail_word(276,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl6c - goto skip6c -lbl6c: fail_word(277,0) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]==values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_word(278,0) -skip6d: - ; no else - if sources[1]==values[1] - fail_word(279,0) - - ; with else - if sources[1]==values[1] - fail_word(280,0) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(281,0) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]==values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(282,0) -skip7b: - ; no else - if sources[1]==values[1] - fail_word(283,0) - - ; with else - if sources[1]==values[1] - fail_word(284,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl7c - goto skip7c -lbl7c: fail_word(285,0) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]==values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_word(286,0) -skip7d: - ; no else - if sources[1]==values[1] - fail_word(287,0) - - ; with else - if sources[1]==values[1] - fail_word(288,0) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl8a - goto skip8a -lbl8a: fail_word(289,0) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]==values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_word(290,0) -skip8b: - ; no else - if sources[1]==values[1] - fail_word(291,0) - - ; with else - if sources[1]==values[1] - fail_word(292,0) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl8c - goto skip8c -lbl8c: fail_word(293,0) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]==values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_word(294,0) -skip8d: - ; no else - if sources[1]==values[1] - fail_word(295,0) - - ; with else - if sources[1]==values[1] - fail_word(296,0) - else - cx16.r0L++ - - values[1]=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl9a - goto skip9a -lbl9a: fail_word(297,170) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]==values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_word(298,170) -skip9b: - ; no else - if sources[1]==values[1] - fail_word(299,170) - - ; with else - if sources[1]==values[1] - fail_word(300,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl9c - goto skip9c -lbl9c: fail_word(301,170) -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]==values[1] - goto cx16.r3 - goto skip9d -lbl9d: fail_word(302,170) -skip9d: - ; no else - if sources[1]==values[1] - fail_word(303,170) - - ; with else - if sources[1]==values[1] - fail_word(304,170) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]==values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]==values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(305,170) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]==values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(306,170) -skip11b: - ; no else - if sources[1]==values[1] - fail_word(307,170) - - ; with else - if sources[1]==values[1] - fail_word(308,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl11c - goto skip11c -lbl11c: fail_word(309,170) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]==values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_word(310,170) -skip11d: - ; no else - if sources[1]==values[1] - fail_word(311,170) - - ; with else - if sources[1]==values[1] - fail_word(312,170) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(313,170) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]==values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(314,170) -skip12b: - ; no else - if sources[1]==values[1] - fail_word(315,170) - - ; with else - if sources[1]==values[1] - fail_word(316,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl12c - goto skip12c -lbl12c: fail_word(317,170) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]==values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_word(318,170) -skip12d: - ; no else - if sources[1]==values[1] - fail_word(319,170) - - ; with else - if sources[1]==values[1] - fail_word(320,170) - else - cx16.r0L++ - - values[1]=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(321,30464) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]==values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(322,30464) -skip13b: - ; no else - if sources[1]==values[1] - fail_word(323,30464) - - ; with else - if sources[1]==values[1] - fail_word(324,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl13c - goto skip13c -lbl13c: fail_word(325,30464) -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]==values[1] - goto cx16.r3 - goto skip13d -lbl13d: fail_word(326,30464) -skip13d: - ; no else - if sources[1]==values[1] - fail_word(327,30464) - - ; with else - if sources[1]==values[1] - fail_word(328,30464) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(329,30464) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]==values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(330,30464) -skip14b: - ; no else - if sources[1]==values[1] - fail_word(331,30464) - - ; with else - if sources[1]==values[1] - fail_word(332,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl14c - goto skip14c -lbl14c: fail_word(333,30464) -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]==values[1] - goto cx16.r3 - goto skip14d -lbl14d: fail_word(334,30464) -skip14d: - ; no else - if sources[1]==values[1] - fail_word(335,30464) - - ; with else - if sources[1]==values[1] - fail_word(336,30464) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]==values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl15c - goto skip15c -lbl15c: success++ -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]==values[1] - goto cx16.r3 - goto skip15d -lbl15d: success++ -skip15d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl16a - goto skip16a -lbl16a: fail_word(337,30464) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]==values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_word(338,30464) -skip16b: - ; no else - if sources[1]==values[1] - fail_word(339,30464) - - ; with else - if sources[1]==values[1] - fail_word(340,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl16c - goto skip16c -lbl16c: fail_word(341,30464) -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]==values[1] - goto cx16.r3 - goto skip16d -lbl16d: fail_word(342,30464) -skip16d: - ; no else - if sources[1]==values[1] - fail_word(343,30464) - - ; with else - if sources[1]==values[1] - fail_word(344,30464) - else - cx16.r0L++ - - values[1]=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if sources[1]==values[1] - goto lbl17a - goto skip17a -lbl17a: fail_word(345,32767) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]==values[1] - goto cx16.r3 - goto skip17b -lbl17b: fail_word(346,32767) -skip17b: - ; no else - if sources[1]==values[1] - fail_word(347,32767) - - ; with else - if sources[1]==values[1] - fail_word(348,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl17c - goto skip17c -lbl17c: fail_word(349,32767) -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]==values[1] - goto cx16.r3 - goto skip17d -lbl17d: fail_word(350,32767) -skip17d: - ; no else - if sources[1]==values[1] - fail_word(351,32767) - - ; with else - if sources[1]==values[1] - fail_word(352,32767) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]==values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(353,32767) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]==values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(354,32767) -skip18b: - ; no else - if sources[1]==values[1] - fail_word(355,32767) - - ; with else - if sources[1]==values[1] - fail_word(356,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl18c - goto skip18c -lbl18c: fail_word(357,32767) -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]==values[1] - goto cx16.r3 - goto skip18d -lbl18d: fail_word(358,32767) -skip18d: - ; no else - if sources[1]==values[1] - fail_word(359,32767) - - ; with else - if sources[1]==values[1] - fail_word(360,32767) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]==values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(361,32767) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]==values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(362,32767) -skip19b: - ; no else - if sources[1]==values[1] - fail_word(363,32767) - - ; with else - if sources[1]==values[1] - fail_word(364,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl19c - goto skip19c -lbl19c: fail_word(365,32767) -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]==values[1] - goto cx16.r3 - goto skip19d -lbl19d: fail_word(366,32767) -skip19d: - ; no else - if sources[1]==values[1] - fail_word(367,32767) - - ; with else - if sources[1]==values[1] - fail_word(368,32767) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]==values[1] - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]==values[1] - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]==values[1] - goto lbl20c - goto skip20c -lbl20c: success++ -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]==values[1] - goto cx16.r3 - goto skip20d -lbl20d: success++ -skip20d: - ; no else - if sources[1]==values[1] - success++ - - ; with else - if sources[1]==values[1] - success++ - else - cx16.r0L++ - - verify_success(32) -} - sub test_not_array_splitw() { - - word[] @split values = [9999, 8888] - word[] @split sources = [9999, 8888] - success = 0 - values[1]=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl1a - goto skip1a -lbl1a: fail_word(369,-21829) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if sources[1]!=values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_word(370,-21829) -skip1b: - ; no else - if sources[1]!=values[1] - fail_word(371,-21829) - - ; with else - if sources[1]!=values[1] - fail_word(372,-21829) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl1c - goto skip1c -lbl1c: fail_word(373,-21829) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]!=values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_word(374,-21829) -skip1d: - ; no else - if sources[1]!=values[1] - fail_word(375,-21829) - - ; with else - if sources[1]!=values[1] - fail_word(376,-21829) - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if sources[1]!=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]!=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if sources[1]!=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]!=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if sources[1]!=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]!=values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if sources[1]!=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]!=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if sources[1]!=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]!=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if sources[1]!=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl7c - goto skip7c -lbl7c: success++ -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]!=values[1] - goto cx16.r3 - goto skip7d -lbl7d: success++ -skip7d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if sources[1]!=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]!=values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if sources[1]!=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]!=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(377,170) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if sources[1]!=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(378,170) -skip10b: - ; no else - if sources[1]!=values[1] - fail_word(379,170) - - ; with else - if sources[1]!=values[1] - fail_word(380,170) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl10c - goto skip10c -lbl10c: fail_word(381,170) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]!=values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_word(382,170) -skip10d: - ; no else - if sources[1]!=values[1] - fail_word(383,170) - - ; with else - if sources[1]!=values[1] - fail_word(384,170) - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if sources[1]!=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]!=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if sources[1]!=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl12c - goto skip12c -lbl12c: success++ -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]!=values[1] - goto cx16.r3 - goto skip12d -lbl12d: success++ -skip12d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if sources[1]!=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl13c - goto skip13c -lbl13c: success++ -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]!=values[1] - goto cx16.r3 - goto skip13d -lbl13d: success++ -skip13d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if sources[1]!=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl14c - goto skip14c -lbl14c: success++ -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]!=values[1] - goto cx16.r3 - goto skip14d -lbl14d: success++ -skip14d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_word(385,30464) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if sources[1]!=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_word(386,30464) -skip15b: - ; no else - if sources[1]!=values[1] - fail_word(387,30464) - - ; with else - if sources[1]!=values[1] - fail_word(388,30464) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl15c - goto skip15c -lbl15c: fail_word(389,30464) -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]!=values[1] - goto cx16.r3 - goto skip15d -lbl15d: fail_word(390,30464) -skip15d: - ; no else - if sources[1]!=values[1] - fail_word(391,30464) - - ; with else - if sources[1]!=values[1] - fail_word(392,30464) - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if sources[1]!=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl16c - goto skip16c -lbl16c: success++ -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]!=values[1] - goto cx16.r3 - goto skip16d -lbl16d: success++ -skip16d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if sources[1]!=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if sources[1]!=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl17c - goto skip17c -lbl17c: success++ -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]!=values[1] - goto cx16.r3 - goto skip17d -lbl17d: success++ -skip17d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if sources[1]!=values[1] - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if sources[1]!=values[1] - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl18c - goto skip18c -lbl18c: success++ -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]!=values[1] - goto cx16.r3 - goto skip18d -lbl18d: success++ -skip18d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if sources[1]!=values[1] - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if sources[1]!=values[1] - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl19c - goto skip19c -lbl19c: success++ -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]!=values[1] - goto cx16.r3 - goto skip19d -lbl19d: success++ -skip19d: - ; no else - if sources[1]!=values[1] - success++ - - ; with else - if sources[1]!=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if sources[1]!=values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(393,32767) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if sources[1]!=values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(394,32767) -skip20b: - ; no else - if sources[1]!=values[1] - fail_word(395,32767) - - ; with else - if sources[1]!=values[1] - fail_word(396,32767) - else - cx16.r0L++ - - ; direct jump - if sources[1]!=values[1] - goto lbl20c - goto skip20c -lbl20c: fail_word(397,32767) -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]!=values[1] - goto cx16.r3 - goto skip20d -lbl20d: fail_word(398,32767) -skip20d: - ; no else - if sources[1]!=values[1] - fail_word(399,32767) - - ; with else - if sources[1]!=values[1] - fail_word(400,32767) - else - cx16.r0L++ - - verify_success(128) -} - -} - diff --git a/compiler/test/comparisons/test_word_splitw_gt.asm b/compiler/test/comparisons/test_word_splitw_gt.asm deleted file mode 100644 index 626069a7f..000000000 --- a/compiler/test/comparisons/test_word_splitw_gt.asm +++ /dev/null @@ -1,15884 +0,0 @@ -; w65c02 assembly code for 'test_word_splitw_gt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:51 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_splitw_gt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .word ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_splitw_gt.p8:9 uword success = 0 - ; source: test_word_splitw_gt.p8:10 str datatype = "word" - ; source: test_word_splitw_gt.p8:11 uword @shared comparison - ; source: test_word_splitw_gt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_splitw_gt.p8:14 txt.print("\ngreater-than split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #array[]: ") - ldy #>prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gt.p8:53 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:54 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:56 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_splitw_gt.p8:58 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_gt.p8:59 lbl1a: fail_word(1) -p8l_lbl1a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:60 skip1a: -p8l_skip1a - ; source: test_word_splitw_gt.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:63 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:65 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_gt.p8:66 lbl1b: fail_word(2) -p8l_lbl1b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:67 skip1b: -p8l_skip1b - ; source: test_word_splitw_gt.p8:69 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_splitw_gt.p8:70 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_3_afterif - ; source: test_word_splitw_gt.p8:73 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_splitw_gt.p8:74 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_splitw_gt.p8:76 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_4_afterif - ; source: test_word_splitw_gt.p8:79 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl1c - ; source: test_word_splitw_gt.p8:81 goto skip1c - bra p8l_skip1c - ; source: test_word_splitw_gt.p8:82 lbl1c: fail_word(5) -p8l_lbl1c - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:83 skip1c: -p8l_skip1c - ; source: test_word_splitw_gt.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:86 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:88 goto skip1d - bra p8l_skip1d - ; source: test_word_splitw_gt.p8:89 lbl1d: fail_word(6) -p8l_lbl1d - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:90 skip1d: -p8l_skip1d - ; source: test_word_splitw_gt.p8:92 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_6_afterif - ; source: test_word_splitw_gt.p8:93 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_6_afterif - ; source: test_word_splitw_gt.p8:96 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_8_else - ; source: test_word_splitw_gt.p8:97 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_splitw_gt.p8:99 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_7_afterif - ; source: test_word_splitw_gt.p8:101 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:103 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_splitw_gt.p8:105 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_gt.p8:106 lbl2a: fail_word(9) -p8l_lbl2a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:107 skip2a: -p8l_skip2a - ; source: test_word_splitw_gt.p8:109 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:110 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:112 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_gt.p8:113 lbl2b: fail_word(10) -p8l_lbl2b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:114 skip2b: -p8l_skip2b - ; source: test_word_splitw_gt.p8:116 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_9_afterif - ; source: test_word_splitw_gt.p8:117 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_9_afterif - ; source: test_word_splitw_gt.p8:120 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_11_else - ; source: test_word_splitw_gt.p8:121 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_splitw_gt.p8:123 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_10_afterif - ; source: test_word_splitw_gt.p8:126 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl2c - ; source: test_word_splitw_gt.p8:128 goto skip2c - bra p8l_skip2c - ; source: test_word_splitw_gt.p8:129 lbl2c: fail_word(13) -p8l_lbl2c - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:130 skip2c: -p8l_skip2c - ; source: test_word_splitw_gt.p8:132 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:133 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:135 goto skip2d - bra p8l_skip2d - ; source: test_word_splitw_gt.p8:136 lbl2d: fail_word(14) -p8l_lbl2d - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:137 skip2d: -p8l_skip2d - ; source: test_word_splitw_gt.p8:139 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_12_afterif - ; source: test_word_splitw_gt.p8:140 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_12_afterif - ; source: test_word_splitw_gt.p8:143 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_14_else - ; source: test_word_splitw_gt.p8:144 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_splitw_gt.p8:146 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_13_afterif - ; source: test_word_splitw_gt.p8:148 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:150 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_splitw_gt.p8:152 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_gt.p8:153 lbl3a: fail_word(17) -p8l_lbl3a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:154 skip3a: -p8l_skip3a - ; source: test_word_splitw_gt.p8:156 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:157 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:159 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_gt.p8:160 lbl3b: fail_word(18) -p8l_lbl3b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:161 skip3b: -p8l_skip3b - ; source: test_word_splitw_gt.p8:163 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_splitw_gt.p8:164 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_15_afterif - ; source: test_word_splitw_gt.p8:167 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_splitw_gt.p8:168 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_splitw_gt.p8:170 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_16_afterif - ; source: test_word_splitw_gt.p8:173 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl3c - ; source: test_word_splitw_gt.p8:175 goto skip3c - bra p8l_skip3c - ; source: test_word_splitw_gt.p8:176 lbl3c: fail_word(21) -p8l_lbl3c - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:177 skip3c: -p8l_skip3c - ; source: test_word_splitw_gt.p8:179 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:180 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:182 goto skip3d - bra p8l_skip3d - ; source: test_word_splitw_gt.p8:183 lbl3d: fail_word(22) -p8l_lbl3d - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:184 skip3d: -p8l_skip3d - ; source: test_word_splitw_gt.p8:186 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_splitw_gt.p8:187 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_18_afterif - ; source: test_word_splitw_gt.p8:190 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_splitw_gt.p8:191 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_splitw_gt.p8:193 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_19_afterif - ; source: test_word_splitw_gt.p8:195 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:197 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_splitw_gt.p8:199 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_gt.p8:200 lbl4a: fail_word(25) -p8l_lbl4a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:201 skip4a: -p8l_skip4a - ; source: test_word_splitw_gt.p8:203 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:204 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:206 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_gt.p8:207 lbl4b: fail_word(26) -p8l_lbl4b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:208 skip4b: -p8l_skip4b - ; source: test_word_splitw_gt.p8:210 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_splitw_gt.p8:211 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_21_afterif - ; source: test_word_splitw_gt.p8:214 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_splitw_gt.p8:215 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_splitw_gt.p8:217 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_22_afterif - ; source: test_word_splitw_gt.p8:220 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl4c - ; source: test_word_splitw_gt.p8:222 goto skip4c - bra p8l_skip4c - ; source: test_word_splitw_gt.p8:223 lbl4c: fail_word(29) -p8l_lbl4c - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:224 skip4c: -p8l_skip4c - ; source: test_word_splitw_gt.p8:226 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:227 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:229 goto skip4d - bra p8l_skip4d - ; source: test_word_splitw_gt.p8:230 lbl4d: fail_word(30) -p8l_lbl4d - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:231 skip4d: -p8l_skip4d - ; source: test_word_splitw_gt.p8:233 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_splitw_gt.p8:234 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_24_afterif - ; source: test_word_splitw_gt.p8:237 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_splitw_gt.p8:238 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_splitw_gt.p8:240 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_25_afterif - ; source: test_word_splitw_gt.p8:242 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:244 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_splitw_gt.p8:246 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_gt.p8:247 lbl5a: fail_word(33) -p8l_lbl5a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:248 skip5a: -p8l_skip5a - ; source: test_word_splitw_gt.p8:250 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:251 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:253 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_gt.p8:254 lbl5b: fail_word(34) -p8l_lbl5b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:255 skip5b: -p8l_skip5b - ; source: test_word_splitw_gt.p8:257 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_27_afterif - ; source: test_word_splitw_gt.p8:258 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_27_afterif - ; source: test_word_splitw_gt.p8:261 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_29_else - ; source: test_word_splitw_gt.p8:262 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_splitw_gt.p8:264 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_28_afterif - ; source: test_word_splitw_gt.p8:267 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl5c - ; source: test_word_splitw_gt.p8:269 goto skip5c - bra p8l_skip5c - ; source: test_word_splitw_gt.p8:270 lbl5c: fail_word(37) -p8l_lbl5c - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:271 skip5c: -p8l_skip5c - ; source: test_word_splitw_gt.p8:273 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:274 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:276 goto skip5d - bra p8l_skip5d - ; source: test_word_splitw_gt.p8:277 lbl5d: fail_word(38) -p8l_lbl5d - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:278 skip5d: -p8l_skip5d - ; source: test_word_splitw_gt.p8:280 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_30_afterif - ; source: test_word_splitw_gt.p8:281 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_30_afterif - ; source: test_word_splitw_gt.p8:284 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_32_else - ; source: test_word_splitw_gt.p8:285 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_splitw_gt.p8:287 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_31_afterif - ; source: test_word_splitw_gt.p8:289 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:291 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_splitw_gt.p8:293 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_gt.p8:294 lbl6a: fail_word(41) -p8l_lbl6a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:295 skip6a: -p8l_skip6a - ; source: test_word_splitw_gt.p8:297 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:298 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:300 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_gt.p8:301 lbl6b: fail_word(42) -p8l_lbl6b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:302 skip6b: -p8l_skip6b - ; source: test_word_splitw_gt.p8:304 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_33_afterif - ; source: test_word_splitw_gt.p8:305 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_33_afterif - ; source: test_word_splitw_gt.p8:308 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_35_else - ; source: test_word_splitw_gt.p8:309 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_splitw_gt.p8:311 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_34_afterif - ; source: test_word_splitw_gt.p8:314 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl6c - ; source: test_word_splitw_gt.p8:316 goto skip6c - bra p8l_skip6c - ; source: test_word_splitw_gt.p8:317 lbl6c: fail_word(45) -p8l_lbl6c - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:318 skip6c: -p8l_skip6c - ; source: test_word_splitw_gt.p8:320 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:321 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:323 goto skip6d - bra p8l_skip6d - ; source: test_word_splitw_gt.p8:324 lbl6d: fail_word(46) -p8l_lbl6d - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:325 skip6d: -p8l_skip6d - ; source: test_word_splitw_gt.p8:327 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_splitw_gt.p8:328 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_36_afterif - ; source: test_word_splitw_gt.p8:331 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_splitw_gt.p8:332 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_splitw_gt.p8:334 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_37_afterif - ; source: test_word_splitw_gt.p8:336 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:338 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_splitw_gt.p8:340 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_gt.p8:341 lbl7a: fail_word(49) -p8l_lbl7a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:342 skip7a: -p8l_skip7a - ; source: test_word_splitw_gt.p8:344 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:345 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:347 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_gt.p8:348 lbl7b: fail_word(50) -p8l_lbl7b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:349 skip7b: -p8l_skip7b - ; source: test_word_splitw_gt.p8:351 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_splitw_gt.p8:352 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_39_afterif - ; source: test_word_splitw_gt.p8:355 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_splitw_gt.p8:356 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_splitw_gt.p8:358 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_40_afterif - ; source: test_word_splitw_gt.p8:361 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl7c - ; source: test_word_splitw_gt.p8:363 goto skip7c - bra p8l_skip7c - ; source: test_word_splitw_gt.p8:364 lbl7c: fail_word(53) -p8l_lbl7c - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:365 skip7c: -p8l_skip7c - ; source: test_word_splitw_gt.p8:367 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:368 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:370 goto skip7d - bra p8l_skip7d - ; source: test_word_splitw_gt.p8:371 lbl7d: fail_word(54) -p8l_lbl7d - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:372 skip7d: -p8l_skip7d - ; source: test_word_splitw_gt.p8:374 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_splitw_gt.p8:375 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_42_afterif - ; source: test_word_splitw_gt.p8:378 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_splitw_gt.p8:379 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_splitw_gt.p8:381 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_43_afterif - ; source: test_word_splitw_gt.p8:383 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gt.p8:384 sources[1]=-1 - ldy #1 - lda #<-1 - sta p8v_sources_lsb,y - lda #>-1 - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:385 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:387 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_splitw_gt.p8:389 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_gt.p8:390 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:391 skip8a: -p8l_skip8a - ; source: test_word_splitw_gt.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:394 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:396 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_gt.p8:397 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:398 skip8b: -p8l_skip8b - ; source: test_word_splitw_gt.p8:400 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_splitw_gt.p8:401 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_45_afterif - ; source: test_word_splitw_gt.p8:404 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_splitw_gt.p8:405 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_splitw_gt.p8:407 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_word_splitw_gt.p8:410 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl8c - ; source: test_word_splitw_gt.p8:412 goto skip8c - bra p8l_skip8c - ; source: test_word_splitw_gt.p8:413 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:414 skip8c: -p8l_skip8c - ; source: test_word_splitw_gt.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:417 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:419 goto skip8d - bra p8l_skip8d - ; source: test_word_splitw_gt.p8:420 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:421 skip8d: -p8l_skip8d - ; source: test_word_splitw_gt.p8:423 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_48_afterif - ; source: test_word_splitw_gt.p8:424 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_48_afterif - ; source: test_word_splitw_gt.p8:427 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_50_else - ; source: test_word_splitw_gt.p8:428 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_splitw_gt.p8:430 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_word_splitw_gt.p8:432 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:434 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_splitw_gt.p8:436 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_gt.p8:437 lbl9a: fail_word(57) -p8l_lbl9a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:438 skip9a: -p8l_skip9a - ; source: test_word_splitw_gt.p8:440 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:441 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:443 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_gt.p8:444 lbl9b: fail_word(58) -p8l_lbl9b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:445 skip9b: -p8l_skip9b - ; source: test_word_splitw_gt.p8:447 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_51_afterif - ; source: test_word_splitw_gt.p8:448 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_51_afterif - ; source: test_word_splitw_gt.p8:451 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_53_else - ; source: test_word_splitw_gt.p8:452 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_splitw_gt.p8:454 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_52_afterif - ; source: test_word_splitw_gt.p8:457 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl9c - ; source: test_word_splitw_gt.p8:459 goto skip9c - bra p8l_skip9c - ; source: test_word_splitw_gt.p8:460 lbl9c: fail_word(61) -p8l_lbl9c - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:461 skip9c: -p8l_skip9c - ; source: test_word_splitw_gt.p8:463 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:464 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:466 goto skip9d - bra p8l_skip9d - ; source: test_word_splitw_gt.p8:467 lbl9d: fail_word(62) -p8l_lbl9d - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:468 skip9d: -p8l_skip9d - ; source: test_word_splitw_gt.p8:470 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_54_afterif - ; source: test_word_splitw_gt.p8:471 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_54_afterif - ; source: test_word_splitw_gt.p8:474 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_56_else - ; source: test_word_splitw_gt.p8:475 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_splitw_gt.p8:477 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_55_afterif - ; source: test_word_splitw_gt.p8:479 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:481 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_splitw_gt.p8:483 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_gt.p8:484 lbl10a: fail_word(65) -p8l_lbl10a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:485 skip10a: -p8l_skip10a - ; source: test_word_splitw_gt.p8:487 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:488 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:490 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_gt.p8:491 lbl10b: fail_word(66) -p8l_lbl10b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:492 skip10b: -p8l_skip10b - ; source: test_word_splitw_gt.p8:494 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_splitw_gt.p8:495 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_57_afterif - ; source: test_word_splitw_gt.p8:498 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_splitw_gt.p8:499 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_splitw_gt.p8:501 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_58_afterif - ; source: test_word_splitw_gt.p8:504 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl10c - ; source: test_word_splitw_gt.p8:506 goto skip10c - bra p8l_skip10c - ; source: test_word_splitw_gt.p8:507 lbl10c: fail_word(69) -p8l_lbl10c - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:508 skip10c: -p8l_skip10c - ; source: test_word_splitw_gt.p8:510 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:511 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:513 goto skip10d - bra p8l_skip10d - ; source: test_word_splitw_gt.p8:514 lbl10d: fail_word(70) -p8l_lbl10d - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:515 skip10d: -p8l_skip10d - ; source: test_word_splitw_gt.p8:517 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_splitw_gt.p8:518 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_60_afterif - ; source: test_word_splitw_gt.p8:521 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_splitw_gt.p8:522 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_splitw_gt.p8:524 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_61_afterif - ; source: test_word_splitw_gt.p8:526 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:528 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_splitw_gt.p8:530 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_gt.p8:531 lbl11a: fail_word(73) -p8l_lbl11a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:532 skip11a: -p8l_skip11a - ; source: test_word_splitw_gt.p8:534 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:535 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:537 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_gt.p8:538 lbl11b: fail_word(74) -p8l_lbl11b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:539 skip11b: -p8l_skip11b - ; source: test_word_splitw_gt.p8:541 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_splitw_gt.p8:542 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_63_afterif - ; source: test_word_splitw_gt.p8:545 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_splitw_gt.p8:546 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_splitw_gt.p8:548 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_64_afterif - ; source: test_word_splitw_gt.p8:551 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl11c - ; source: test_word_splitw_gt.p8:553 goto skip11c - bra p8l_skip11c - ; source: test_word_splitw_gt.p8:554 lbl11c: fail_word(77) -p8l_lbl11c - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:555 skip11c: -p8l_skip11c - ; source: test_word_splitw_gt.p8:557 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:558 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:560 goto skip11d - bra p8l_skip11d - ; source: test_word_splitw_gt.p8:561 lbl11d: fail_word(78) -p8l_lbl11d - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:562 skip11d: -p8l_skip11d - ; source: test_word_splitw_gt.p8:564 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_splitw_gt.p8:565 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_66_afterif - ; source: test_word_splitw_gt.p8:568 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_splitw_gt.p8:569 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_splitw_gt.p8:571 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_67_afterif - ; source: test_word_splitw_gt.p8:573 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:575 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_splitw_gt.p8:577 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_gt.p8:578 lbl12a: fail_word(81) -p8l_lbl12a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:579 skip12a: -p8l_skip12a - ; source: test_word_splitw_gt.p8:581 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:582 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:584 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_gt.p8:585 lbl12b: fail_word(82) -p8l_lbl12b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:586 skip12b: -p8l_skip12b - ; source: test_word_splitw_gt.p8:588 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_69_afterif - ; source: test_word_splitw_gt.p8:589 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_69_afterif - ; source: test_word_splitw_gt.p8:592 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_71_else - ; source: test_word_splitw_gt.p8:593 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_splitw_gt.p8:595 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_70_afterif - ; source: test_word_splitw_gt.p8:598 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl12c - ; source: test_word_splitw_gt.p8:600 goto skip12c - bra p8l_skip12c - ; source: test_word_splitw_gt.p8:601 lbl12c: fail_word(85) -p8l_lbl12c - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:602 skip12c: -p8l_skip12c - ; source: test_word_splitw_gt.p8:604 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:605 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:607 goto skip12d - bra p8l_skip12d - ; source: test_word_splitw_gt.p8:608 lbl12d: fail_word(86) -p8l_lbl12d - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:609 skip12d: -p8l_skip12d - ; source: test_word_splitw_gt.p8:611 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_72_afterif - ; source: test_word_splitw_gt.p8:612 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_72_afterif - ; source: test_word_splitw_gt.p8:615 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_74_else - ; source: test_word_splitw_gt.p8:616 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_splitw_gt.p8:618 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_73_afterif - ; source: test_word_splitw_gt.p8:620 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:622 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_splitw_gt.p8:624 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_gt.p8:625 lbl13a: fail_word(89) -p8l_lbl13a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:626 skip13a: -p8l_skip13a - ; source: test_word_splitw_gt.p8:628 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:629 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:631 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_gt.p8:632 lbl13b: fail_word(90) -p8l_lbl13b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:633 skip13b: -p8l_skip13b - ; source: test_word_splitw_gt.p8:635 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_75_afterif - ; source: test_word_splitw_gt.p8:636 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_75_afterif - ; source: test_word_splitw_gt.p8:639 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_77_else - ; source: test_word_splitw_gt.p8:640 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_splitw_gt.p8:642 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_76_afterif - ; source: test_word_splitw_gt.p8:645 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl13c - ; source: test_word_splitw_gt.p8:647 goto skip13c - bra p8l_skip13c - ; source: test_word_splitw_gt.p8:648 lbl13c: fail_word(93) -p8l_lbl13c - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:649 skip13c: -p8l_skip13c - ; source: test_word_splitw_gt.p8:651 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:652 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:654 goto skip13d - bra p8l_skip13d - ; source: test_word_splitw_gt.p8:655 lbl13d: fail_word(94) -p8l_lbl13d - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:656 skip13d: -p8l_skip13d - ; source: test_word_splitw_gt.p8:658 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_splitw_gt.p8:659 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_78_afterif - ; source: test_word_splitw_gt.p8:662 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_splitw_gt.p8:663 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_splitw_gt.p8:665 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_79_afterif - ; source: test_word_splitw_gt.p8:667 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:669 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_splitw_gt.p8:671 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_gt.p8:672 lbl14a: fail_word(97) -p8l_lbl14a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:673 skip14a: -p8l_skip14a - ; source: test_word_splitw_gt.p8:675 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:676 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:678 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_gt.p8:679 lbl14b: fail_word(98) -p8l_lbl14b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:680 skip14b: -p8l_skip14b - ; source: test_word_splitw_gt.p8:682 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_splitw_gt.p8:683 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_81_afterif - ; source: test_word_splitw_gt.p8:686 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_splitw_gt.p8:687 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_splitw_gt.p8:689 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_82_afterif - ; source: test_word_splitw_gt.p8:692 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl14c - ; source: test_word_splitw_gt.p8:694 goto skip14c - bra p8l_skip14c - ; source: test_word_splitw_gt.p8:695 lbl14c: fail_word(101) -p8l_lbl14c - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:696 skip14c: -p8l_skip14c - ; source: test_word_splitw_gt.p8:698 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:699 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:701 goto skip14d - bra p8l_skip14d - ; source: test_word_splitw_gt.p8:702 lbl14d: fail_word(102) -p8l_lbl14d - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:703 skip14d: -p8l_skip14d - ; source: test_word_splitw_gt.p8:705 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_splitw_gt.p8:706 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_84_afterif - ; source: test_word_splitw_gt.p8:709 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_splitw_gt.p8:710 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_splitw_gt.p8:712 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_85_afterif - ; source: test_word_splitw_gt.p8:714 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_splitw_gt.p8:715 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:716 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:718 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_splitw_gt.p8:720 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_gt.p8:721 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:722 skip15a: -p8l_skip15a - ; source: test_word_splitw_gt.p8:724 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:725 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:727 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_gt.p8:728 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:729 skip15b: -p8l_skip15b - ; source: test_word_splitw_gt.p8:731 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_splitw_gt.p8:732 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_87_afterif - ; source: test_word_splitw_gt.p8:735 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_splitw_gt.p8:736 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_splitw_gt.p8:738 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_word_splitw_gt.p8:741 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl15c - ; source: test_word_splitw_gt.p8:743 goto skip15c - bra p8l_skip15c - ; source: test_word_splitw_gt.p8:744 lbl15c: success++ -p8l_lbl15c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:745 skip15c: -p8l_skip15c - ; source: test_word_splitw_gt.p8:747 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:748 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:750 goto skip15d - bra p8l_skip15d - ; source: test_word_splitw_gt.p8:751 lbl15d: success++ -p8l_lbl15d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:752 skip15d: -p8l_skip15d - ; source: test_word_splitw_gt.p8:754 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_90_afterif - ; source: test_word_splitw_gt.p8:755 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_90_afterif - ; source: test_word_splitw_gt.p8:758 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_92_else - ; source: test_word_splitw_gt.p8:759 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_splitw_gt.p8:761 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_word_splitw_gt.p8:763 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:765 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_splitw_gt.p8:767 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_gt.p8:768 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:769 skip16a: -p8l_skip16a - ; source: test_word_splitw_gt.p8:771 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:772 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:774 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_gt.p8:775 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:776 skip16b: -p8l_skip16b - ; source: test_word_splitw_gt.p8:778 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_93_afterif - ; source: test_word_splitw_gt.p8:779 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_93_afterif - ; source: test_word_splitw_gt.p8:782 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_95_else - ; source: test_word_splitw_gt.p8:783 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_splitw_gt.p8:785 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_word_splitw_gt.p8:788 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl16c - ; source: test_word_splitw_gt.p8:790 goto skip16c - bra p8l_skip16c - ; source: test_word_splitw_gt.p8:791 lbl16c: success++ -p8l_lbl16c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:792 skip16c: -p8l_skip16c - ; source: test_word_splitw_gt.p8:794 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:795 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:797 goto skip16d - bra p8l_skip16d - ; source: test_word_splitw_gt.p8:798 lbl16d: success++ -p8l_lbl16d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:799 skip16d: -p8l_skip16d - ; source: test_word_splitw_gt.p8:801 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_96_afterif - ; source: test_word_splitw_gt.p8:802 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_96_afterif - ; source: test_word_splitw_gt.p8:805 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_98_else - ; source: test_word_splitw_gt.p8:806 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_splitw_gt.p8:808 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_word_splitw_gt.p8:810 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:812 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_splitw_gt.p8:814 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_gt.p8:815 lbl17a: fail_word(105) -p8l_lbl17a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:816 skip17a: -p8l_skip17a - ; source: test_word_splitw_gt.p8:818 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:819 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:821 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_gt.p8:822 lbl17b: fail_word(106) -p8l_lbl17b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:823 skip17b: -p8l_skip17b - ; source: test_word_splitw_gt.p8:825 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_splitw_gt.p8:826 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_99_afterif - ; source: test_word_splitw_gt.p8:829 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_splitw_gt.p8:830 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_splitw_gt.p8:832 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_100_afterif - ; source: test_word_splitw_gt.p8:835 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl17c - ; source: test_word_splitw_gt.p8:837 goto skip17c - bra p8l_skip17c - ; source: test_word_splitw_gt.p8:838 lbl17c: fail_word(109) -p8l_lbl17c - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:839 skip17c: -p8l_skip17c - ; source: test_word_splitw_gt.p8:841 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:842 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:844 goto skip17d - bra p8l_skip17d - ; source: test_word_splitw_gt.p8:845 lbl17d: fail_word(110) -p8l_lbl17d - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:846 skip17d: -p8l_skip17d - ; source: test_word_splitw_gt.p8:848 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_splitw_gt.p8:849 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_102_afterif - ; source: test_word_splitw_gt.p8:852 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_splitw_gt.p8:853 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_splitw_gt.p8:855 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_103_afterif - ; source: test_word_splitw_gt.p8:857 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:859 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_splitw_gt.p8:861 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_gt.p8:862 lbl18a: fail_word(113) -p8l_lbl18a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:863 skip18a: -p8l_skip18a - ; source: test_word_splitw_gt.p8:865 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:866 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:868 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_gt.p8:869 lbl18b: fail_word(114) -p8l_lbl18b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:870 skip18b: -p8l_skip18b - ; source: test_word_splitw_gt.p8:872 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_splitw_gt.p8:873 fail_word(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_105_afterif - ; source: test_word_splitw_gt.p8:876 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_splitw_gt.p8:877 fail_word(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_splitw_gt.p8:879 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_106_afterif - ; source: test_word_splitw_gt.p8:882 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl18c - ; source: test_word_splitw_gt.p8:884 goto skip18c - bra p8l_skip18c - ; source: test_word_splitw_gt.p8:885 lbl18c: fail_word(117) -p8l_lbl18c - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:886 skip18c: -p8l_skip18c - ; source: test_word_splitw_gt.p8:888 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:889 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:891 goto skip18d - bra p8l_skip18d - ; source: test_word_splitw_gt.p8:892 lbl18d: fail_word(118) -p8l_lbl18d - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:893 skip18d: -p8l_skip18d - ; source: test_word_splitw_gt.p8:895 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_splitw_gt.p8:896 fail_word(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_108_afterif - ; source: test_word_splitw_gt.p8:899 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_splitw_gt.p8:900 fail_word(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_splitw_gt.p8:902 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_109_afterif - ; source: test_word_splitw_gt.p8:904 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:906 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_splitw_gt.p8:908 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_gt.p8:909 lbl19a: fail_word(121) -p8l_lbl19a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:910 skip19a: -p8l_skip19a - ; source: test_word_splitw_gt.p8:912 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:913 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:915 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_gt.p8:916 lbl19b: fail_word(122) -p8l_lbl19b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:917 skip19b: -p8l_skip19b - ; source: test_word_splitw_gt.p8:919 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_111_afterif - ; source: test_word_splitw_gt.p8:920 fail_word(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_111_afterif - ; source: test_word_splitw_gt.p8:923 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_113_else - ; source: test_word_splitw_gt.p8:924 fail_word(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_splitw_gt.p8:926 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_112_afterif - ; source: test_word_splitw_gt.p8:929 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl19c - ; source: test_word_splitw_gt.p8:931 goto skip19c - bra p8l_skip19c - ; source: test_word_splitw_gt.p8:932 lbl19c: fail_word(125) -p8l_lbl19c - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:933 skip19c: -p8l_skip19c - ; source: test_word_splitw_gt.p8:935 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:936 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:938 goto skip19d - bra p8l_skip19d - ; source: test_word_splitw_gt.p8:939 lbl19d: fail_word(126) -p8l_lbl19d - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:940 skip19d: -p8l_skip19d - ; source: test_word_splitw_gt.p8:942 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_114_afterif - ; source: test_word_splitw_gt.p8:943 fail_word(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_114_afterif - ; source: test_word_splitw_gt.p8:946 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_116_else - ; source: test_word_splitw_gt.p8:947 fail_word(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_splitw_gt.p8:949 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_115_afterif - ; source: test_word_splitw_gt.p8:951 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:953 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_splitw_gt.p8:955 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_gt.p8:956 lbl20a: fail_word(129) -p8l_lbl20a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:957 skip20a: -p8l_skip20a - ; source: test_word_splitw_gt.p8:959 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:960 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:962 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_gt.p8:963 lbl20b: fail_word(130) -p8l_lbl20b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:964 skip20b: -p8l_skip20b - ; source: test_word_splitw_gt.p8:966 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_117_afterif - ; source: test_word_splitw_gt.p8:967 fail_word(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_117_afterif - ; source: test_word_splitw_gt.p8:970 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_119_else - ; source: test_word_splitw_gt.p8:971 fail_word(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_splitw_gt.p8:973 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_118_afterif - ; source: test_word_splitw_gt.p8:976 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl20c - ; source: test_word_splitw_gt.p8:978 goto skip20c - bra p8l_skip20c - ; source: test_word_splitw_gt.p8:979 lbl20c: fail_word(133) -p8l_lbl20c - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:980 skip20c: -p8l_skip20c - ; source: test_word_splitw_gt.p8:982 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:983 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:985 goto skip20d - bra p8l_skip20d - ; source: test_word_splitw_gt.p8:986 lbl20d: fail_word(134) -p8l_lbl20d - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:987 skip20d: -p8l_skip20d - ; source: test_word_splitw_gt.p8:989 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_splitw_gt.p8:990 fail_word(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_120_afterif - ; source: test_word_splitw_gt.p8:993 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_splitw_gt.p8:994 fail_word(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_splitw_gt.p8:996 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_121_afterif - ; source: test_word_splitw_gt.p8:998 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1000 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_splitw_gt.p8:1002 goto skip21a - bra p8l_skip21a - ; source: test_word_splitw_gt.p8:1003 lbl21a: fail_word(137) -p8l_lbl21a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1004 skip21a: -p8l_skip21a - ; source: test_word_splitw_gt.p8:1006 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1007 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1009 goto skip21b - bra p8l_skip21b - ; source: test_word_splitw_gt.p8:1010 lbl21b: fail_word(138) -p8l_lbl21b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1011 skip21b: -p8l_skip21b - ; source: test_word_splitw_gt.p8:1013 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_splitw_gt.p8:1014 fail_word(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_123_afterif - ; source: test_word_splitw_gt.p8:1017 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_splitw_gt.p8:1018 fail_word(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_splitw_gt.p8:1020 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_124_afterif - ; source: test_word_splitw_gt.p8:1023 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl21c - ; source: test_word_splitw_gt.p8:1025 goto skip21c - bra p8l_skip21c - ; source: test_word_splitw_gt.p8:1026 lbl21c: fail_word(141) -p8l_lbl21c - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1027 skip21c: -p8l_skip21c - ; source: test_word_splitw_gt.p8:1029 cx16.r3 = &lbl21d - lda #p8l_lbl21d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1030 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1032 goto skip21d - bra p8l_skip21d - ; source: test_word_splitw_gt.p8:1033 lbl21d: fail_word(142) -p8l_lbl21d - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1034 skip21d: -p8l_skip21d - ; source: test_word_splitw_gt.p8:1036 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_splitw_gt.p8:1037 fail_word(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_126_afterif - ; source: test_word_splitw_gt.p8:1040 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_splitw_gt.p8:1041 fail_word(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_splitw_gt.p8:1043 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_127_afterif - ; source: test_word_splitw_gt.p8:1045 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gt.p8:1046 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:1047 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1049 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_splitw_gt.p8:1051 goto skip22a - bra p8l_skip22a - ; source: test_word_splitw_gt.p8:1052 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1053 skip22a: -p8l_skip22a - ; source: test_word_splitw_gt.p8:1055 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1056 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1058 goto skip22b - bra p8l_skip22b - ; source: test_word_splitw_gt.p8:1059 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1060 skip22b: -p8l_skip22b - ; source: test_word_splitw_gt.p8:1062 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_splitw_gt.p8:1063 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_129_afterif - ; source: test_word_splitw_gt.p8:1066 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_splitw_gt.p8:1067 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_splitw_gt.p8:1069 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_word_splitw_gt.p8:1072 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl22c - ; source: test_word_splitw_gt.p8:1074 goto skip22c - bra p8l_skip22c - ; source: test_word_splitw_gt.p8:1075 lbl22c: success++ -p8l_lbl22c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1076 skip22c: -p8l_skip22c - ; source: test_word_splitw_gt.p8:1078 cx16.r3 = &lbl22d - lda #p8l_lbl22d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1079 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1081 goto skip22d - bra p8l_skip22d - ; source: test_word_splitw_gt.p8:1082 lbl22d: success++ -p8l_lbl22d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1083 skip22d: -p8l_skip22d - ; source: test_word_splitw_gt.p8:1085 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_132_afterif - ; source: test_word_splitw_gt.p8:1086 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_132_afterif - ; source: test_word_splitw_gt.p8:1089 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_134_else - ; source: test_word_splitw_gt.p8:1090 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_splitw_gt.p8:1092 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_word_splitw_gt.p8:1094 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1096 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_splitw_gt.p8:1098 goto skip23a - bra p8l_skip23a - ; source: test_word_splitw_gt.p8:1099 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1100 skip23a: -p8l_skip23a - ; source: test_word_splitw_gt.p8:1102 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1103 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1105 goto skip23b - bra p8l_skip23b - ; source: test_word_splitw_gt.p8:1106 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1107 skip23b: -p8l_skip23b - ; source: test_word_splitw_gt.p8:1109 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_135_afterif - ; source: test_word_splitw_gt.p8:1110 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_135_afterif - ; source: test_word_splitw_gt.p8:1113 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_137_else - ; source: test_word_splitw_gt.p8:1114 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_splitw_gt.p8:1116 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_word_splitw_gt.p8:1119 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl23c - ; source: test_word_splitw_gt.p8:1121 goto skip23c - bra p8l_skip23c - ; source: test_word_splitw_gt.p8:1122 lbl23c: success++ -p8l_lbl23c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1123 skip23c: -p8l_skip23c - ; source: test_word_splitw_gt.p8:1125 cx16.r3 = &lbl23d - lda #p8l_lbl23d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1126 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1128 goto skip23d - bra p8l_skip23d - ; source: test_word_splitw_gt.p8:1129 lbl23d: success++ -p8l_lbl23d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1130 skip23d: -p8l_skip23d - ; source: test_word_splitw_gt.p8:1132 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_138_afterif - ; source: test_word_splitw_gt.p8:1133 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_138_afterif - ; source: test_word_splitw_gt.p8:1136 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_140_else - ; source: test_word_splitw_gt.p8:1137 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_splitw_gt.p8:1139 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_word_splitw_gt.p8:1141 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1143 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_splitw_gt.p8:1145 goto skip24a - bra p8l_skip24a - ; source: test_word_splitw_gt.p8:1146 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1147 skip24a: -p8l_skip24a - ; source: test_word_splitw_gt.p8:1149 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1150 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1152 goto skip24b - bra p8l_skip24b - ; source: test_word_splitw_gt.p8:1153 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1154 skip24b: -p8l_skip24b - ; source: test_word_splitw_gt.p8:1156 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_splitw_gt.p8:1157 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_141_afterif - ; source: test_word_splitw_gt.p8:1160 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_splitw_gt.p8:1161 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_splitw_gt.p8:1163 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_word_splitw_gt.p8:1166 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl24c - ; source: test_word_splitw_gt.p8:1168 goto skip24c - bra p8l_skip24c - ; source: test_word_splitw_gt.p8:1169 lbl24c: success++ -p8l_lbl24c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1170 skip24c: -p8l_skip24c - ; source: test_word_splitw_gt.p8:1172 cx16.r3 = &lbl24d - lda #p8l_lbl24d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1173 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1175 goto skip24d - bra p8l_skip24d - ; source: test_word_splitw_gt.p8:1176 lbl24d: success++ -p8l_lbl24d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1177 skip24d: -p8l_skip24d - ; source: test_word_splitw_gt.p8:1179 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_splitw_gt.p8:1180 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_144_afterif - ; source: test_word_splitw_gt.p8:1183 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_splitw_gt.p8:1184 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_splitw_gt.p8:1186 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_word_splitw_gt.p8:1188 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1190 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_splitw_gt.p8:1192 goto skip25a - bra p8l_skip25a - ; source: test_word_splitw_gt.p8:1193 lbl25a: fail_word(145) -p8l_lbl25a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1194 skip25a: -p8l_skip25a - ; source: test_word_splitw_gt.p8:1196 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1197 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1199 goto skip25b - bra p8l_skip25b - ; source: test_word_splitw_gt.p8:1200 lbl25b: fail_word(146) -p8l_lbl25b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1201 skip25b: -p8l_skip25b - ; source: test_word_splitw_gt.p8:1203 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_splitw_gt.p8:1204 fail_word(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_147_afterif - ; source: test_word_splitw_gt.p8:1207 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_splitw_gt.p8:1208 fail_word(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_splitw_gt.p8:1210 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_148_afterif - ; source: test_word_splitw_gt.p8:1213 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl25c - ; source: test_word_splitw_gt.p8:1215 goto skip25c - bra p8l_skip25c - ; source: test_word_splitw_gt.p8:1216 lbl25c: fail_word(149) -p8l_lbl25c - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1217 skip25c: -p8l_skip25c - ; source: test_word_splitw_gt.p8:1219 cx16.r3 = &lbl25d - lda #p8l_lbl25d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1220 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1222 goto skip25d - bra p8l_skip25d - ; source: test_word_splitw_gt.p8:1223 lbl25d: fail_word(150) -p8l_lbl25d - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1224 skip25d: -p8l_skip25d - ; source: test_word_splitw_gt.p8:1226 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_150_afterif - ; source: test_word_splitw_gt.p8:1227 fail_word(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_150_afterif - ; source: test_word_splitw_gt.p8:1230 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_152_else - ; source: test_word_splitw_gt.p8:1231 fail_word(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_splitw_gt.p8:1233 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_151_afterif - ; source: test_word_splitw_gt.p8:1235 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1237 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_splitw_gt.p8:1239 goto skip26a - bra p8l_skip26a - ; source: test_word_splitw_gt.p8:1240 lbl26a: fail_word(153) -p8l_lbl26a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1241 skip26a: -p8l_skip26a - ; source: test_word_splitw_gt.p8:1243 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1244 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1246 goto skip26b - bra p8l_skip26b - ; source: test_word_splitw_gt.p8:1247 lbl26b: fail_word(154) -p8l_lbl26b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1248 skip26b: -p8l_skip26b - ; source: test_word_splitw_gt.p8:1250 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_153_afterif - ; source: test_word_splitw_gt.p8:1251 fail_word(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_153_afterif - ; source: test_word_splitw_gt.p8:1254 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_155_else - ; source: test_word_splitw_gt.p8:1255 fail_word(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_splitw_gt.p8:1257 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_154_afterif - ; source: test_word_splitw_gt.p8:1260 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl26c - ; source: test_word_splitw_gt.p8:1262 goto skip26c - bra p8l_skip26c - ; source: test_word_splitw_gt.p8:1263 lbl26c: fail_word(157) -p8l_lbl26c - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1264 skip26c: -p8l_skip26c - ; source: test_word_splitw_gt.p8:1266 cx16.r3 = &lbl26d - lda #p8l_lbl26d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1267 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1269 goto skip26d - bra p8l_skip26d - ; source: test_word_splitw_gt.p8:1270 lbl26d: fail_word(158) -p8l_lbl26d - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1271 skip26d: -p8l_skip26d - ; source: test_word_splitw_gt.p8:1273 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_156_afterif - ; source: test_word_splitw_gt.p8:1274 fail_word(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_156_afterif - ; source: test_word_splitw_gt.p8:1277 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_158_else - ; source: test_word_splitw_gt.p8:1278 fail_word(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_splitw_gt.p8:1280 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_157_afterif - ; source: test_word_splitw_gt.p8:1282 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1284 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_splitw_gt.p8:1286 goto skip27a - bra p8l_skip27a - ; source: test_word_splitw_gt.p8:1287 lbl27a: fail_word(161) -p8l_lbl27a - ldy #>$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1288 skip27a: -p8l_skip27a - ; source: test_word_splitw_gt.p8:1290 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1291 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1293 goto skip27b - bra p8l_skip27b - ; source: test_word_splitw_gt.p8:1294 lbl27b: fail_word(162) -p8l_lbl27b - ldy #>$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1295 skip27b: -p8l_skip27b - ; source: test_word_splitw_gt.p8:1297 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_159_afterif - ; source: test_word_splitw_gt.p8:1298 fail_word(163) - ldy #>$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_159_afterif - ; source: test_word_splitw_gt.p8:1301 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_161_else - ; source: test_word_splitw_gt.p8:1302 fail_word(164) - ldy #>$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_splitw_gt.p8:1304 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_160_afterif - ; source: test_word_splitw_gt.p8:1307 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl27c - ; source: test_word_splitw_gt.p8:1309 goto skip27c - bra p8l_skip27c - ; source: test_word_splitw_gt.p8:1310 lbl27c: fail_word(165) -p8l_lbl27c - ldy #>$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1311 skip27c: -p8l_skip27c - ; source: test_word_splitw_gt.p8:1313 cx16.r3 = &lbl27d - lda #p8l_lbl27d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1314 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1316 goto skip27d - bra p8l_skip27d - ; source: test_word_splitw_gt.p8:1317 lbl27d: fail_word(166) -p8l_lbl27d - ldy #>$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1318 skip27d: -p8l_skip27d - ; source: test_word_splitw_gt.p8:1320 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_162_afterif - ; source: test_word_splitw_gt.p8:1321 fail_word(167) - ldy #>$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_162_afterif - ; source: test_word_splitw_gt.p8:1324 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_164_else - ; source: test_word_splitw_gt.p8:1325 fail_word(168) - ldy #>$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_splitw_gt.p8:1327 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_163_afterif - ; source: test_word_splitw_gt.p8:1329 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1331 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_splitw_gt.p8:1333 goto skip28a - bra p8l_skip28a - ; source: test_word_splitw_gt.p8:1334 lbl28a: fail_word(169) -p8l_lbl28a - ldy #>$a9 - lda #<$a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1335 skip28a: -p8l_skip28a - ; source: test_word_splitw_gt.p8:1337 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1338 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1340 goto skip28b - bra p8l_skip28b - ; source: test_word_splitw_gt.p8:1341 lbl28b: fail_word(170) -p8l_lbl28b - ldy #>$aa - lda #<$aa - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1342 skip28b: -p8l_skip28b - ; source: test_word_splitw_gt.p8:1344 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_165_afterif - ; source: test_word_splitw_gt.p8:1345 fail_word(171) - ldy #>$ab - lda #<$ab - jsr p8b_main.p8s_fail_word -label_asm_165_afterif - ; source: test_word_splitw_gt.p8:1348 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_167_else - ; source: test_word_splitw_gt.p8:1349 fail_word(172) - ldy #>$ac - lda #<$ac - jsr p8b_main.p8s_fail_word - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_splitw_gt.p8:1351 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_166_afterif - ; source: test_word_splitw_gt.p8:1354 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl28c - ; source: test_word_splitw_gt.p8:1356 goto skip28c - bra p8l_skip28c - ; source: test_word_splitw_gt.p8:1357 lbl28c: fail_word(173) -p8l_lbl28c - ldy #>$ad - lda #<$ad - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1358 skip28c: -p8l_skip28c - ; source: test_word_splitw_gt.p8:1360 cx16.r3 = &lbl28d - lda #p8l_lbl28d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1361 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1363 goto skip28d - bra p8l_skip28d - ; source: test_word_splitw_gt.p8:1364 lbl28d: fail_word(174) -p8l_lbl28d - ldy #>$ae - lda #<$ae - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1365 skip28d: -p8l_skip28d - ; source: test_word_splitw_gt.p8:1367 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_168_afterif - ; source: test_word_splitw_gt.p8:1368 fail_word(175) - ldy #>$af - lda #<$af - jsr p8b_main.p8s_fail_word -label_asm_168_afterif - ; source: test_word_splitw_gt.p8:1371 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_170_else - ; source: test_word_splitw_gt.p8:1372 fail_word(176) - ldy #>$b0 - lda #<$b0 - jsr p8b_main.p8s_fail_word - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_splitw_gt.p8:1374 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_169_afterif - ; source: test_word_splitw_gt.p8:1376 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gt.p8:1377 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:1378 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1380 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_splitw_gt.p8:1382 goto skip29a - bra p8l_skip29a - ; source: test_word_splitw_gt.p8:1383 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1384 skip29a: -p8l_skip29a - ; source: test_word_splitw_gt.p8:1386 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1387 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1389 goto skip29b - bra p8l_skip29b - ; source: test_word_splitw_gt.p8:1390 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1391 skip29b: -p8l_skip29b - ; source: test_word_splitw_gt.p8:1393 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_171_afterif - ; source: test_word_splitw_gt.p8:1394 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_171_afterif - ; source: test_word_splitw_gt.p8:1397 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_173_else - ; source: test_word_splitw_gt.p8:1398 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_splitw_gt.p8:1400 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_word_splitw_gt.p8:1403 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl29c - ; source: test_word_splitw_gt.p8:1405 goto skip29c - bra p8l_skip29c - ; source: test_word_splitw_gt.p8:1406 lbl29c: success++ -p8l_lbl29c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1407 skip29c: -p8l_skip29c - ; source: test_word_splitw_gt.p8:1409 cx16.r3 = &lbl29d - lda #p8l_lbl29d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1410 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1412 goto skip29d - bra p8l_skip29d - ; source: test_word_splitw_gt.p8:1413 lbl29d: success++ -p8l_lbl29d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1414 skip29d: -p8l_skip29d - ; source: test_word_splitw_gt.p8:1416 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_174_afterif - ; source: test_word_splitw_gt.p8:1417 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_174_afterif - ; source: test_word_splitw_gt.p8:1420 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_176_else - ; source: test_word_splitw_gt.p8:1421 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_splitw_gt.p8:1423 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_word_splitw_gt.p8:1425 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1427 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_splitw_gt.p8:1429 goto skip30a - bra p8l_skip30a - ; source: test_word_splitw_gt.p8:1430 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1431 skip30a: -p8l_skip30a - ; source: test_word_splitw_gt.p8:1433 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1434 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1436 goto skip30b - bra p8l_skip30b - ; source: test_word_splitw_gt.p8:1437 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1438 skip30b: -p8l_skip30b - ; source: test_word_splitw_gt.p8:1440 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_177_afterif - ; source: test_word_splitw_gt.p8:1441 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_177_afterif - ; source: test_word_splitw_gt.p8:1444 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_179_else - ; source: test_word_splitw_gt.p8:1445 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_splitw_gt.p8:1447 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_word_splitw_gt.p8:1450 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl30c - ; source: test_word_splitw_gt.p8:1452 goto skip30c - bra p8l_skip30c - ; source: test_word_splitw_gt.p8:1453 lbl30c: success++ -p8l_lbl30c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1454 skip30c: -p8l_skip30c - ; source: test_word_splitw_gt.p8:1456 cx16.r3 = &lbl30d - lda #p8l_lbl30d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1457 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1459 goto skip30d - bra p8l_skip30d - ; source: test_word_splitw_gt.p8:1460 lbl30d: success++ -p8l_lbl30d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1461 skip30d: -p8l_skip30d - ; source: test_word_splitw_gt.p8:1463 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_180_afterif - ; source: test_word_splitw_gt.p8:1464 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_180_afterif - ; source: test_word_splitw_gt.p8:1467 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_182_else - ; source: test_word_splitw_gt.p8:1468 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_splitw_gt.p8:1470 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_word_splitw_gt.p8:1472 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1474 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_splitw_gt.p8:1476 goto skip31a - bra p8l_skip31a - ; source: test_word_splitw_gt.p8:1477 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1478 skip31a: -p8l_skip31a - ; source: test_word_splitw_gt.p8:1480 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1481 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1483 goto skip31b - bra p8l_skip31b - ; source: test_word_splitw_gt.p8:1484 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1485 skip31b: -p8l_skip31b - ; source: test_word_splitw_gt.p8:1487 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_183_afterif - ; source: test_word_splitw_gt.p8:1488 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_183_afterif - ; source: test_word_splitw_gt.p8:1491 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_185_else - ; source: test_word_splitw_gt.p8:1492 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_splitw_gt.p8:1494 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_word_splitw_gt.p8:1497 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl31c - ; source: test_word_splitw_gt.p8:1499 goto skip31c - bra p8l_skip31c - ; source: test_word_splitw_gt.p8:1500 lbl31c: success++ -p8l_lbl31c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1501 skip31c: -p8l_skip31c - ; source: test_word_splitw_gt.p8:1503 cx16.r3 = &lbl31d - lda #p8l_lbl31d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1504 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1506 goto skip31d - bra p8l_skip31d - ; source: test_word_splitw_gt.p8:1507 lbl31d: success++ -p8l_lbl31d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1508 skip31d: -p8l_skip31d - ; source: test_word_splitw_gt.p8:1510 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_186_afterif - ; source: test_word_splitw_gt.p8:1511 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_186_afterif - ; source: test_word_splitw_gt.p8:1514 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_188_else - ; source: test_word_splitw_gt.p8:1515 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_splitw_gt.p8:1517 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_word_splitw_gt.p8:1519 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1521 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_splitw_gt.p8:1523 goto skip32a - bra p8l_skip32a - ; source: test_word_splitw_gt.p8:1524 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1525 skip32a: -p8l_skip32a - ; source: test_word_splitw_gt.p8:1527 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1528 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1530 goto skip32b - bra p8l_skip32b - ; source: test_word_splitw_gt.p8:1531 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1532 skip32b: -p8l_skip32b - ; source: test_word_splitw_gt.p8:1534 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_189_afterif - ; source: test_word_splitw_gt.p8:1535 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_189_afterif - ; source: test_word_splitw_gt.p8:1538 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_191_else - ; source: test_word_splitw_gt.p8:1539 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_splitw_gt.p8:1541 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_word_splitw_gt.p8:1544 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl32c - ; source: test_word_splitw_gt.p8:1546 goto skip32c - bra p8l_skip32c - ; source: test_word_splitw_gt.p8:1547 lbl32c: success++ -p8l_lbl32c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1548 skip32c: -p8l_skip32c - ; source: test_word_splitw_gt.p8:1550 cx16.r3 = &lbl32d - lda #p8l_lbl32d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1551 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1553 goto skip32d - bra p8l_skip32d - ; source: test_word_splitw_gt.p8:1554 lbl32d: success++ -p8l_lbl32d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1555 skip32d: -p8l_skip32d - ; source: test_word_splitw_gt.p8:1557 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_192_afterif - ; source: test_word_splitw_gt.p8:1558 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_192_afterif - ; source: test_word_splitw_gt.p8:1561 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_194_else - ; source: test_word_splitw_gt.p8:1562 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_splitw_gt.p8:1564 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_word_splitw_gt.p8:1566 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1568 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_splitw_gt.p8:1570 goto skip33a - bra p8l_skip33a - ; source: test_word_splitw_gt.p8:1571 lbl33a: fail_word(177) -p8l_lbl33a - ldy #>$b1 - lda #<$b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1572 skip33a: -p8l_skip33a - ; source: test_word_splitw_gt.p8:1574 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1575 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1577 goto skip33b - bra p8l_skip33b - ; source: test_word_splitw_gt.p8:1578 lbl33b: fail_word(178) -p8l_lbl33b - ldy #>$b2 - lda #<$b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1579 skip33b: -p8l_skip33b - ; source: test_word_splitw_gt.p8:1581 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_195_afterif - ; source: test_word_splitw_gt.p8:1582 fail_word(179) - ldy #>$b3 - lda #<$b3 - jsr p8b_main.p8s_fail_word -label_asm_195_afterif - ; source: test_word_splitw_gt.p8:1585 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_197_else - ; source: test_word_splitw_gt.p8:1586 fail_word(180) - ldy #>$b4 - lda #<$b4 - jsr p8b_main.p8s_fail_word - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_splitw_gt.p8:1588 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_196_afterif - ; source: test_word_splitw_gt.p8:1591 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl33c - ; source: test_word_splitw_gt.p8:1593 goto skip33c - bra p8l_skip33c - ; source: test_word_splitw_gt.p8:1594 lbl33c: fail_word(181) -p8l_lbl33c - ldy #>$b5 - lda #<$b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1595 skip33c: -p8l_skip33c - ; source: test_word_splitw_gt.p8:1597 cx16.r3 = &lbl33d - lda #p8l_lbl33d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1598 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1600 goto skip33d - bra p8l_skip33d - ; source: test_word_splitw_gt.p8:1601 lbl33d: fail_word(182) -p8l_lbl33d - ldy #>$b6 - lda #<$b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1602 skip33d: -p8l_skip33d - ; source: test_word_splitw_gt.p8:1604 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_198_afterif - ; source: test_word_splitw_gt.p8:1605 fail_word(183) - ldy #>$b7 - lda #<$b7 - jsr p8b_main.p8s_fail_word -label_asm_198_afterif - ; source: test_word_splitw_gt.p8:1608 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_200_else - ; source: test_word_splitw_gt.p8:1609 fail_word(184) - ldy #>$b8 - lda #<$b8 - jsr p8b_main.p8s_fail_word - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_splitw_gt.p8:1611 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_199_afterif - ; source: test_word_splitw_gt.p8:1613 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1615 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_splitw_gt.p8:1617 goto skip34a - bra p8l_skip34a - ; source: test_word_splitw_gt.p8:1618 lbl34a: fail_word(185) -p8l_lbl34a - ldy #>$b9 - lda #<$b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1619 skip34a: -p8l_skip34a - ; source: test_word_splitw_gt.p8:1621 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1622 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1624 goto skip34b - bra p8l_skip34b - ; source: test_word_splitw_gt.p8:1625 lbl34b: fail_word(186) -p8l_lbl34b - ldy #>$ba - lda #<$ba - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1626 skip34b: -p8l_skip34b - ; source: test_word_splitw_gt.p8:1628 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_201_afterif - ; source: test_word_splitw_gt.p8:1629 fail_word(187) - ldy #>$bb - lda #<$bb - jsr p8b_main.p8s_fail_word -label_asm_201_afterif - ; source: test_word_splitw_gt.p8:1632 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_203_else - ; source: test_word_splitw_gt.p8:1633 fail_word(188) - ldy #>$bc - lda #<$bc - jsr p8b_main.p8s_fail_word - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_splitw_gt.p8:1635 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_202_afterif - ; source: test_word_splitw_gt.p8:1638 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl34c - ; source: test_word_splitw_gt.p8:1640 goto skip34c - bra p8l_skip34c - ; source: test_word_splitw_gt.p8:1641 lbl34c: fail_word(189) -p8l_lbl34c - ldy #>$bd - lda #<$bd - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1642 skip34c: -p8l_skip34c - ; source: test_word_splitw_gt.p8:1644 cx16.r3 = &lbl34d - lda #p8l_lbl34d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1645 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1647 goto skip34d - bra p8l_skip34d - ; source: test_word_splitw_gt.p8:1648 lbl34d: fail_word(190) -p8l_lbl34d - ldy #>$be - lda #<$be - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1649 skip34d: -p8l_skip34d - ; source: test_word_splitw_gt.p8:1651 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_204_afterif - ; source: test_word_splitw_gt.p8:1652 fail_word(191) - ldy #>$bf - lda #<$bf - jsr p8b_main.p8s_fail_word -label_asm_204_afterif - ; source: test_word_splitw_gt.p8:1655 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_206_else - ; source: test_word_splitw_gt.p8:1656 fail_word(192) - ldy #>$c0 - lda #<$c0 - jsr p8b_main.p8s_fail_word - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_splitw_gt.p8:1658 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_205_afterif - ; source: test_word_splitw_gt.p8:1660 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1662 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_splitw_gt.p8:1664 goto skip35a - bra p8l_skip35a - ; source: test_word_splitw_gt.p8:1665 lbl35a: fail_word(193) -p8l_lbl35a - ldy #>$c1 - lda #<$c1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1666 skip35a: -p8l_skip35a - ; source: test_word_splitw_gt.p8:1668 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1669 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1671 goto skip35b - bra p8l_skip35b - ; source: test_word_splitw_gt.p8:1672 lbl35b: fail_word(194) -p8l_lbl35b - ldy #>$c2 - lda #<$c2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1673 skip35b: -p8l_skip35b - ; source: test_word_splitw_gt.p8:1675 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_207_afterif - ; source: test_word_splitw_gt.p8:1676 fail_word(195) - ldy #>$c3 - lda #<$c3 - jsr p8b_main.p8s_fail_word -label_asm_207_afterif - ; source: test_word_splitw_gt.p8:1679 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_209_else - ; source: test_word_splitw_gt.p8:1680 fail_word(196) - ldy #>$c4 - lda #<$c4 - jsr p8b_main.p8s_fail_word - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_splitw_gt.p8:1682 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_208_afterif - ; source: test_word_splitw_gt.p8:1685 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl35c - ; source: test_word_splitw_gt.p8:1687 goto skip35c - bra p8l_skip35c - ; source: test_word_splitw_gt.p8:1688 lbl35c: fail_word(197) -p8l_lbl35c - ldy #>$c5 - lda #<$c5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1689 skip35c: -p8l_skip35c - ; source: test_word_splitw_gt.p8:1691 cx16.r3 = &lbl35d - lda #p8l_lbl35d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1692 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1694 goto skip35d - bra p8l_skip35d - ; source: test_word_splitw_gt.p8:1695 lbl35d: fail_word(198) -p8l_lbl35d - ldy #>$c6 - lda #<$c6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1696 skip35d: -p8l_skip35d - ; source: test_word_splitw_gt.p8:1698 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_210_afterif - ; source: test_word_splitw_gt.p8:1699 fail_word(199) - ldy #>$c7 - lda #<$c7 - jsr p8b_main.p8s_fail_word -label_asm_210_afterif - ; source: test_word_splitw_gt.p8:1702 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_212_else - ; source: test_word_splitw_gt.p8:1703 fail_word(200) - ldy #>$c8 - lda #<$c8 - jsr p8b_main.p8s_fail_word - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_splitw_gt.p8:1705 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_211_afterif - ; source: test_word_splitw_gt.p8:1707 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gt.p8:1708 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:1709 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1711 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_splitw_gt.p8:1713 goto skip36a - bra p8l_skip36a - ; source: test_word_splitw_gt.p8:1714 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1715 skip36a: -p8l_skip36a - ; source: test_word_splitw_gt.p8:1717 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1718 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1720 goto skip36b - bra p8l_skip36b - ; source: test_word_splitw_gt.p8:1721 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1722 skip36b: -p8l_skip36b - ; source: test_word_splitw_gt.p8:1724 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_213_afterif - ; source: test_word_splitw_gt.p8:1725 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_213_afterif - ; source: test_word_splitw_gt.p8:1728 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_215_else - ; source: test_word_splitw_gt.p8:1729 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_splitw_gt.p8:1731 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_word_splitw_gt.p8:1734 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl36c - ; source: test_word_splitw_gt.p8:1736 goto skip36c - bra p8l_skip36c - ; source: test_word_splitw_gt.p8:1737 lbl36c: success++ -p8l_lbl36c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1738 skip36c: -p8l_skip36c - ; source: test_word_splitw_gt.p8:1740 cx16.r3 = &lbl36d - lda #p8l_lbl36d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1741 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1743 goto skip36d - bra p8l_skip36d - ; source: test_word_splitw_gt.p8:1744 lbl36d: success++ -p8l_lbl36d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1745 skip36d: -p8l_skip36d - ; source: test_word_splitw_gt.p8:1747 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_216_afterif - ; source: test_word_splitw_gt.p8:1748 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_216_afterif - ; source: test_word_splitw_gt.p8:1751 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_218_else - ; source: test_word_splitw_gt.p8:1752 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_splitw_gt.p8:1754 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_word_splitw_gt.p8:1756 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1758 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_splitw_gt.p8:1760 goto skip37a - bra p8l_skip37a - ; source: test_word_splitw_gt.p8:1761 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1762 skip37a: -p8l_skip37a - ; source: test_word_splitw_gt.p8:1764 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1765 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1767 goto skip37b - bra p8l_skip37b - ; source: test_word_splitw_gt.p8:1768 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1769 skip37b: -p8l_skip37b - ; source: test_word_splitw_gt.p8:1771 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_219_afterif - ; source: test_word_splitw_gt.p8:1772 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_219_afterif - ; source: test_word_splitw_gt.p8:1775 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_221_else - ; source: test_word_splitw_gt.p8:1776 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_splitw_gt.p8:1778 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_word_splitw_gt.p8:1781 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl37c - ; source: test_word_splitw_gt.p8:1783 goto skip37c - bra p8l_skip37c - ; source: test_word_splitw_gt.p8:1784 lbl37c: success++ -p8l_lbl37c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1785 skip37c: -p8l_skip37c - ; source: test_word_splitw_gt.p8:1787 cx16.r3 = &lbl37d - lda #p8l_lbl37d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1788 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1790 goto skip37d - bra p8l_skip37d - ; source: test_word_splitw_gt.p8:1791 lbl37d: success++ -p8l_lbl37d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1792 skip37d: -p8l_skip37d - ; source: test_word_splitw_gt.p8:1794 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_222_afterif - ; source: test_word_splitw_gt.p8:1795 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_222_afterif - ; source: test_word_splitw_gt.p8:1798 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_224_else - ; source: test_word_splitw_gt.p8:1799 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_splitw_gt.p8:1801 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_word_splitw_gt.p8:1803 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1805 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_splitw_gt.p8:1807 goto skip38a - bra p8l_skip38a - ; source: test_word_splitw_gt.p8:1808 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1809 skip38a: -p8l_skip38a - ; source: test_word_splitw_gt.p8:1811 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1812 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1814 goto skip38b - bra p8l_skip38b - ; source: test_word_splitw_gt.p8:1815 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1816 skip38b: -p8l_skip38b - ; source: test_word_splitw_gt.p8:1818 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_225_afterif - ; source: test_word_splitw_gt.p8:1819 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_225_afterif - ; source: test_word_splitw_gt.p8:1822 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_227_else - ; source: test_word_splitw_gt.p8:1823 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_splitw_gt.p8:1825 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_word_splitw_gt.p8:1828 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl38c - ; source: test_word_splitw_gt.p8:1830 goto skip38c - bra p8l_skip38c - ; source: test_word_splitw_gt.p8:1831 lbl38c: success++ -p8l_lbl38c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1832 skip38c: -p8l_skip38c - ; source: test_word_splitw_gt.p8:1834 cx16.r3 = &lbl38d - lda #p8l_lbl38d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1835 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1837 goto skip38d - bra p8l_skip38d - ; source: test_word_splitw_gt.p8:1838 lbl38d: success++ -p8l_lbl38d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1839 skip38d: -p8l_skip38d - ; source: test_word_splitw_gt.p8:1841 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_228_afterif - ; source: test_word_splitw_gt.p8:1842 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_228_afterif - ; source: test_word_splitw_gt.p8:1845 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_230_else - ; source: test_word_splitw_gt.p8:1846 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_splitw_gt.p8:1848 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_word_splitw_gt.p8:1850 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1852 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_splitw_gt.p8:1854 goto skip39a - bra p8l_skip39a - ; source: test_word_splitw_gt.p8:1855 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1856 skip39a: -p8l_skip39a - ; source: test_word_splitw_gt.p8:1858 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1859 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1861 goto skip39b - bra p8l_skip39b - ; source: test_word_splitw_gt.p8:1862 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1863 skip39b: -p8l_skip39b - ; source: test_word_splitw_gt.p8:1865 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_231_afterif - ; source: test_word_splitw_gt.p8:1866 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_231_afterif - ; source: test_word_splitw_gt.p8:1869 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_233_else - ; source: test_word_splitw_gt.p8:1870 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_splitw_gt.p8:1872 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_word_splitw_gt.p8:1875 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl39c - ; source: test_word_splitw_gt.p8:1877 goto skip39c - bra p8l_skip39c - ; source: test_word_splitw_gt.p8:1878 lbl39c: success++ -p8l_lbl39c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1879 skip39c: -p8l_skip39c - ; source: test_word_splitw_gt.p8:1881 cx16.r3 = &lbl39d - lda #p8l_lbl39d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1882 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1884 goto skip39d - bra p8l_skip39d - ; source: test_word_splitw_gt.p8:1885 lbl39d: success++ -p8l_lbl39d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1886 skip39d: -p8l_skip39d - ; source: test_word_splitw_gt.p8:1888 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_234_afterif - ; source: test_word_splitw_gt.p8:1889 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_234_afterif - ; source: test_word_splitw_gt.p8:1892 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_236_else - ; source: test_word_splitw_gt.p8:1893 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_splitw_gt.p8:1895 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_word_splitw_gt.p8:1897 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1899 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_splitw_gt.p8:1901 goto skip40a - bra p8l_skip40a - ; source: test_word_splitw_gt.p8:1902 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1903 skip40a: -p8l_skip40a - ; source: test_word_splitw_gt.p8:1905 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1906 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1908 goto skip40b - bra p8l_skip40b - ; source: test_word_splitw_gt.p8:1909 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1910 skip40b: -p8l_skip40b - ; source: test_word_splitw_gt.p8:1912 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_237_afterif - ; source: test_word_splitw_gt.p8:1913 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_237_afterif - ; source: test_word_splitw_gt.p8:1916 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_239_else - ; source: test_word_splitw_gt.p8:1917 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_splitw_gt.p8:1919 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_word_splitw_gt.p8:1922 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl40c - ; source: test_word_splitw_gt.p8:1924 goto skip40c - bra p8l_skip40c - ; source: test_word_splitw_gt.p8:1925 lbl40c: success++ -p8l_lbl40c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1926 skip40c: -p8l_skip40c - ; source: test_word_splitw_gt.p8:1928 cx16.r3 = &lbl40d - lda #p8l_lbl40d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1929 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1931 goto skip40d - bra p8l_skip40d - ; source: test_word_splitw_gt.p8:1932 lbl40d: success++ -p8l_lbl40d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:1933 skip40d: -p8l_skip40d - ; source: test_word_splitw_gt.p8:1935 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_240_afterif - ; source: test_word_splitw_gt.p8:1936 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_240_afterif - ; source: test_word_splitw_gt.p8:1939 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_242_else - ; source: test_word_splitw_gt.p8:1940 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_splitw_gt.p8:1942 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_word_splitw_gt.p8:1944 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1946 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_splitw_gt.p8:1948 goto skip41a - bra p8l_skip41a - ; source: test_word_splitw_gt.p8:1949 lbl41a: fail_word(201) -p8l_lbl41a - ldy #>$c9 - lda #<$c9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1950 skip41a: -p8l_skip41a - ; source: test_word_splitw_gt.p8:1952 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1953 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1955 goto skip41b - bra p8l_skip41b - ; source: test_word_splitw_gt.p8:1956 lbl41b: fail_word(202) -p8l_lbl41b - ldy #>$ca - lda #<$ca - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1957 skip41b: -p8l_skip41b - ; source: test_word_splitw_gt.p8:1959 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_243_afterif - ; source: test_word_splitw_gt.p8:1960 fail_word(203) - ldy #>$cb - lda #<$cb - jsr p8b_main.p8s_fail_word -label_asm_243_afterif - ; source: test_word_splitw_gt.p8:1963 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_245_else - ; source: test_word_splitw_gt.p8:1964 fail_word(204) - ldy #>$cc - lda #<$cc - jsr p8b_main.p8s_fail_word - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_splitw_gt.p8:1966 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_244_afterif - ; source: test_word_splitw_gt.p8:1969 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl41c - ; source: test_word_splitw_gt.p8:1971 goto skip41c - bra p8l_skip41c - ; source: test_word_splitw_gt.p8:1972 lbl41c: fail_word(205) -p8l_lbl41c - ldy #>$cd - lda #<$cd - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1973 skip41c: -p8l_skip41c - ; source: test_word_splitw_gt.p8:1975 cx16.r3 = &lbl41d - lda #p8l_lbl41d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:1976 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:1978 goto skip41d - bra p8l_skip41d - ; source: test_word_splitw_gt.p8:1979 lbl41d: fail_word(206) -p8l_lbl41d - ldy #>$ce - lda #<$ce - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1980 skip41d: -p8l_skip41d - ; source: test_word_splitw_gt.p8:1982 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_246_afterif - ; source: test_word_splitw_gt.p8:1983 fail_word(207) - ldy #>$cf - lda #<$cf - jsr p8b_main.p8s_fail_word -label_asm_246_afterif - ; source: test_word_splitw_gt.p8:1986 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_248_else - ; source: test_word_splitw_gt.p8:1987 fail_word(208) - ldy #>$d0 - lda #<$d0 - jsr p8b_main.p8s_fail_word - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_splitw_gt.p8:1989 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_247_afterif - ; source: test_word_splitw_gt.p8:1991 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:1993 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_splitw_gt.p8:1995 goto skip42a - bra p8l_skip42a - ; source: test_word_splitw_gt.p8:1996 lbl42a: fail_word(209) -p8l_lbl42a - ldy #>$d1 - lda #<$d1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:1997 skip42a: -p8l_skip42a - ; source: test_word_splitw_gt.p8:1999 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2000 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2002 goto skip42b - bra p8l_skip42b - ; source: test_word_splitw_gt.p8:2003 lbl42b: fail_word(210) -p8l_lbl42b - ldy #>$d2 - lda #<$d2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2004 skip42b: -p8l_skip42b - ; source: test_word_splitw_gt.p8:2006 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_249_afterif - ; source: test_word_splitw_gt.p8:2007 fail_word(211) - ldy #>$d3 - lda #<$d3 - jsr p8b_main.p8s_fail_word -label_asm_249_afterif - ; source: test_word_splitw_gt.p8:2010 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_251_else - ; source: test_word_splitw_gt.p8:2011 fail_word(212) - ldy #>$d4 - lda #<$d4 - jsr p8b_main.p8s_fail_word - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_splitw_gt.p8:2013 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_250_afterif - ; source: test_word_splitw_gt.p8:2016 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl42c - ; source: test_word_splitw_gt.p8:2018 goto skip42c - bra p8l_skip42c - ; source: test_word_splitw_gt.p8:2019 lbl42c: fail_word(213) -p8l_lbl42c - ldy #>$d5 - lda #<$d5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2020 skip42c: -p8l_skip42c - ; source: test_word_splitw_gt.p8:2022 cx16.r3 = &lbl42d - lda #p8l_lbl42d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2023 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2025 goto skip42d - bra p8l_skip42d - ; source: test_word_splitw_gt.p8:2026 lbl42d: fail_word(214) -p8l_lbl42d - ldy #>$d6 - lda #<$d6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2027 skip42d: -p8l_skip42d - ; source: test_word_splitw_gt.p8:2029 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_252_afterif - ; source: test_word_splitw_gt.p8:2030 fail_word(215) - ldy #>$d7 - lda #<$d7 - jsr p8b_main.p8s_fail_word -label_asm_252_afterif - ; source: test_word_splitw_gt.p8:2033 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_254_else - ; source: test_word_splitw_gt.p8:2034 fail_word(216) - ldy #>$d8 - lda #<$d8 - jsr p8b_main.p8s_fail_word - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_splitw_gt.p8:2036 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_253_afterif - ; source: test_word_splitw_gt.p8:2038 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gt.p8:2039 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_gt.p8:2040 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2042 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_splitw_gt.p8:2044 goto skip43a - bra p8l_skip43a - ; source: test_word_splitw_gt.p8:2045 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2046 skip43a: -p8l_skip43a - ; source: test_word_splitw_gt.p8:2048 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2049 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2051 goto skip43b - bra p8l_skip43b - ; source: test_word_splitw_gt.p8:2052 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2053 skip43b: -p8l_skip43b - ; source: test_word_splitw_gt.p8:2055 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_255_afterif - ; source: test_word_splitw_gt.p8:2056 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_255_afterif - ; source: test_word_splitw_gt.p8:2059 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_257_else - ; source: test_word_splitw_gt.p8:2060 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_splitw_gt.p8:2062 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_word_splitw_gt.p8:2065 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl43c - ; source: test_word_splitw_gt.p8:2067 goto skip43c - bra p8l_skip43c - ; source: test_word_splitw_gt.p8:2068 lbl43c: success++ -p8l_lbl43c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2069 skip43c: -p8l_skip43c - ; source: test_word_splitw_gt.p8:2071 cx16.r3 = &lbl43d - lda #p8l_lbl43d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2072 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2074 goto skip43d - bra p8l_skip43d - ; source: test_word_splitw_gt.p8:2075 lbl43d: success++ -p8l_lbl43d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2076 skip43d: -p8l_skip43d - ; source: test_word_splitw_gt.p8:2078 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_258_afterif - ; source: test_word_splitw_gt.p8:2079 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_258_afterif - ; source: test_word_splitw_gt.p8:2082 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_260_else - ; source: test_word_splitw_gt.p8:2083 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_splitw_gt.p8:2085 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_word_splitw_gt.p8:2087 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2089 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_splitw_gt.p8:2091 goto skip44a - bra p8l_skip44a - ; source: test_word_splitw_gt.p8:2092 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2093 skip44a: -p8l_skip44a - ; source: test_word_splitw_gt.p8:2095 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2096 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2098 goto skip44b - bra p8l_skip44b - ; source: test_word_splitw_gt.p8:2099 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2100 skip44b: -p8l_skip44b - ; source: test_word_splitw_gt.p8:2102 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_261_afterif - ; source: test_word_splitw_gt.p8:2103 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_261_afterif - ; source: test_word_splitw_gt.p8:2106 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_263_else - ; source: test_word_splitw_gt.p8:2107 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_splitw_gt.p8:2109 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_word_splitw_gt.p8:2112 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl44c - ; source: test_word_splitw_gt.p8:2114 goto skip44c - bra p8l_skip44c - ; source: test_word_splitw_gt.p8:2115 lbl44c: success++ -p8l_lbl44c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2116 skip44c: -p8l_skip44c - ; source: test_word_splitw_gt.p8:2118 cx16.r3 = &lbl44d - lda #p8l_lbl44d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2119 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2121 goto skip44d - bra p8l_skip44d - ; source: test_word_splitw_gt.p8:2122 lbl44d: success++ -p8l_lbl44d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2123 skip44d: -p8l_skip44d - ; source: test_word_splitw_gt.p8:2125 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_264_afterif - ; source: test_word_splitw_gt.p8:2126 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_264_afterif - ; source: test_word_splitw_gt.p8:2129 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_266_else - ; source: test_word_splitw_gt.p8:2130 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_splitw_gt.p8:2132 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_word_splitw_gt.p8:2134 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2136 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_splitw_gt.p8:2138 goto skip45a - bra p8l_skip45a - ; source: test_word_splitw_gt.p8:2139 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2140 skip45a: -p8l_skip45a - ; source: test_word_splitw_gt.p8:2142 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2143 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2145 goto skip45b - bra p8l_skip45b - ; source: test_word_splitw_gt.p8:2146 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2147 skip45b: -p8l_skip45b - ; source: test_word_splitw_gt.p8:2149 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_267_afterif - ; source: test_word_splitw_gt.p8:2150 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_267_afterif - ; source: test_word_splitw_gt.p8:2153 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_269_else - ; source: test_word_splitw_gt.p8:2154 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_splitw_gt.p8:2156 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_word_splitw_gt.p8:2159 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl45c - ; source: test_word_splitw_gt.p8:2161 goto skip45c - bra p8l_skip45c - ; source: test_word_splitw_gt.p8:2162 lbl45c: success++ -p8l_lbl45c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2163 skip45c: -p8l_skip45c - ; source: test_word_splitw_gt.p8:2165 cx16.r3 = &lbl45d - lda #p8l_lbl45d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2166 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2168 goto skip45d - bra p8l_skip45d - ; source: test_word_splitw_gt.p8:2169 lbl45d: success++ -p8l_lbl45d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2170 skip45d: -p8l_skip45d - ; source: test_word_splitw_gt.p8:2172 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_270_afterif - ; source: test_word_splitw_gt.p8:2173 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_270_afterif - ; source: test_word_splitw_gt.p8:2176 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_272_else - ; source: test_word_splitw_gt.p8:2177 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_splitw_gt.p8:2179 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_word_splitw_gt.p8:2181 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2183 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_splitw_gt.p8:2185 goto skip46a - bra p8l_skip46a - ; source: test_word_splitw_gt.p8:2186 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2187 skip46a: -p8l_skip46a - ; source: test_word_splitw_gt.p8:2189 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2190 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2192 goto skip46b - bra p8l_skip46b - ; source: test_word_splitw_gt.p8:2193 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2194 skip46b: -p8l_skip46b - ; source: test_word_splitw_gt.p8:2196 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_273_afterif - ; source: test_word_splitw_gt.p8:2197 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_273_afterif - ; source: test_word_splitw_gt.p8:2200 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_275_else - ; source: test_word_splitw_gt.p8:2201 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_splitw_gt.p8:2203 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_word_splitw_gt.p8:2206 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl46c - ; source: test_word_splitw_gt.p8:2208 goto skip46c - bra p8l_skip46c - ; source: test_word_splitw_gt.p8:2209 lbl46c: success++ -p8l_lbl46c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2210 skip46c: -p8l_skip46c - ; source: test_word_splitw_gt.p8:2212 cx16.r3 = &lbl46d - lda #p8l_lbl46d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2213 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2215 goto skip46d - bra p8l_skip46d - ; source: test_word_splitw_gt.p8:2216 lbl46d: success++ -p8l_lbl46d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2217 skip46d: -p8l_skip46d - ; source: test_word_splitw_gt.p8:2219 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_276_afterif - ; source: test_word_splitw_gt.p8:2220 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_276_afterif - ; source: test_word_splitw_gt.p8:2223 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_278_else - ; source: test_word_splitw_gt.p8:2224 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_splitw_gt.p8:2226 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_word_splitw_gt.p8:2228 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2230 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_splitw_gt.p8:2232 goto skip47a - bra p8l_skip47a - ; source: test_word_splitw_gt.p8:2233 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2234 skip47a: -p8l_skip47a - ; source: test_word_splitw_gt.p8:2236 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2237 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2239 goto skip47b - bra p8l_skip47b - ; source: test_word_splitw_gt.p8:2240 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2241 skip47b: -p8l_skip47b - ; source: test_word_splitw_gt.p8:2243 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_279_afterif - ; source: test_word_splitw_gt.p8:2244 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_279_afterif - ; source: test_word_splitw_gt.p8:2247 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_281_else - ; source: test_word_splitw_gt.p8:2248 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_splitw_gt.p8:2250 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_word_splitw_gt.p8:2253 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl47c - ; source: test_word_splitw_gt.p8:2255 goto skip47c - bra p8l_skip47c - ; source: test_word_splitw_gt.p8:2256 lbl47c: success++ -p8l_lbl47c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2257 skip47c: -p8l_skip47c - ; source: test_word_splitw_gt.p8:2259 cx16.r3 = &lbl47d - lda #p8l_lbl47d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2260 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2262 goto skip47d - bra p8l_skip47d - ; source: test_word_splitw_gt.p8:2263 lbl47d: success++ -p8l_lbl47d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2264 skip47d: -p8l_skip47d - ; source: test_word_splitw_gt.p8:2266 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_282_afterif - ; source: test_word_splitw_gt.p8:2267 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_282_afterif - ; source: test_word_splitw_gt.p8:2270 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_284_else - ; source: test_word_splitw_gt.p8:2271 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_splitw_gt.p8:2273 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_word_splitw_gt.p8:2275 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2277 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_splitw_gt.p8:2279 goto skip48a - bra p8l_skip48a - ; source: test_word_splitw_gt.p8:2280 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2281 skip48a: -p8l_skip48a - ; source: test_word_splitw_gt.p8:2283 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2284 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2286 goto skip48b - bra p8l_skip48b - ; source: test_word_splitw_gt.p8:2287 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2288 skip48b: -p8l_skip48b - ; source: test_word_splitw_gt.p8:2290 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_285_afterif - ; source: test_word_splitw_gt.p8:2291 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_285_afterif - ; source: test_word_splitw_gt.p8:2294 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_287_else - ; source: test_word_splitw_gt.p8:2295 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_splitw_gt.p8:2297 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_word_splitw_gt.p8:2300 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl48c - ; source: test_word_splitw_gt.p8:2302 goto skip48c - bra p8l_skip48c - ; source: test_word_splitw_gt.p8:2303 lbl48c: success++ -p8l_lbl48c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2304 skip48c: -p8l_skip48c - ; source: test_word_splitw_gt.p8:2306 cx16.r3 = &lbl48d - lda #p8l_lbl48d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2307 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2309 goto skip48d - bra p8l_skip48d - ; source: test_word_splitw_gt.p8:2310 lbl48d: success++ -p8l_lbl48d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gt.p8:2311 skip48d: -p8l_skip48d - ; source: test_word_splitw_gt.p8:2313 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_288_afterif - ; source: test_word_splitw_gt.p8:2314 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_288_afterif - ; source: test_word_splitw_gt.p8:2317 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_290_else - ; source: test_word_splitw_gt.p8:2318 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_splitw_gt.p8:2320 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_word_splitw_gt.p8:2322 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gt.p8:2324 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_splitw_gt.p8:2326 goto skip49a - bra p8l_skip49a - ; source: test_word_splitw_gt.p8:2327 lbl49a: fail_word(217) -p8l_lbl49a - ldy #>$d9 - lda #<$d9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2328 skip49a: -p8l_skip49a - ; source: test_word_splitw_gt.p8:2330 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2331 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2333 goto skip49b - bra p8l_skip49b - ; source: test_word_splitw_gt.p8:2334 lbl49b: fail_word(218) -p8l_lbl49b - ldy #>$da - lda #<$da - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2335 skip49b: -p8l_skip49b - ; source: test_word_splitw_gt.p8:2337 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_291_afterif - ; source: test_word_splitw_gt.p8:2338 fail_word(219) - ldy #>$db - lda #<$db - jsr p8b_main.p8s_fail_word -label_asm_291_afterif - ; source: test_word_splitw_gt.p8:2341 if x>values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi label_asm_293_else - ; source: test_word_splitw_gt.p8:2342 fail_word(220) - ldy #>$dc - lda #<$dc - jsr p8b_main.p8s_fail_word - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_splitw_gt.p8:2344 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_292_afterif - ; source: test_word_splitw_gt.p8:2347 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi p8l_lbl49c - ; source: test_word_splitw_gt.p8:2349 goto skip49c - bra p8l_skip49c - ; source: test_word_splitw_gt.p8:2350 lbl49c: fail_word(221) -p8l_lbl49c - ldy #>$dd - lda #<$dd - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2351 skip49c: -p8l_skip49c - ; source: test_word_splitw_gt.p8:2353 cx16.r3 = &lbl49d - lda #p8l_lbl49d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gt.p8:2354 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gt.p8:2356 goto skip49d - bra p8l_skip49d - ; source: test_word_splitw_gt.p8:2357 lbl49d: fail_word(222) -p8l_lbl49d - ldy #>$de - lda #<$de - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gt.p8:2358 skip49d: -p8l_skip49d - ; source: test_word_splitw_gt.p8:2360 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_294_afterif - ; source: test_word_splitw_gt.p8:2361 fail_word(223) - ldy #>$df - lda #<$df - jsr p8b_main.p8s_fail_word -label_asm_294_afterif - ; source: test_word_splitw_gt.p8:2364 if sources[1]>values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi label_asm_296_else - ; source: test_word_splitw_gt.p8:2365 fail_word(224) - ldy #>$e0 - lda #<$e0 - jsr p8b_main.p8s_fail_word - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_splitw_gt.p8:2367 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_295_afterif - ; source: test_word_splitw_gt.p8:2369 verify_success(224) - ldy #>$e0 - lda #<$e0 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_gt.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-than split words array tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $54, $48, $41, $4e, $20, $53, $50 - .byte $4c, $49, $54, $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59, $20 - .byte $54, $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n>array[]: " - .byte $0d, $3e, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_4 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_5 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_6 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_7 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 - - ; source: test_word_splitw_gt.p8:14 txt.print("\ngreater-than split words array tests for: ") - ; source: test_word_splitw_gt.p8:18 txt.print("\n>array[]: ") - ; source: test_word_splitw_gt.p8:27 txt.print(" **failed** ") - ; source: test_word_splitw_gt.p8:29 txt.print(" success, expected ") - ; source: test_word_splitw_gt.p8:35 txt.print(" **fail#") - ; source: test_word_splitw_gt.p8:37 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_splitw_gt.p8 b/compiler/test/comparisons/test_word_splitw_gt.p8 deleted file mode 100644 index db24e86a0..000000000 --- a/compiler/test/comparisons/test_word_splitw_gt.p8 +++ /dev/null @@ -1,2373 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\ngreater-than split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>array[]: ") - test_cmp_array() - test_stack.test() - } - - sub verify_success(uword expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_uw(success) - txt.print(" success, expected ") - txt.print_uw(expected) - } - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_array() { - word @shared x - word[] @split values = [0, 0] - word[] @split sources = [0, 0] - success = 0 - x=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl1a - goto skip1a -lbl1a: fail_word(1) -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>values[1] - goto cx16.r3 - goto skip1b -lbl1b: fail_word(2) -skip1b: - ; no else - if x>values[1] - fail_word(3) - - ; with else - if x>values[1] - fail_word(4) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl1c - goto skip1c -lbl1c: fail_word(5) -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]>values[1] - goto cx16.r3 - goto skip1d -lbl1d: fail_word(6) -skip1d: - ; no else - if sources[1]>values[1] - fail_word(7) - - ; with else - if sources[1]>values[1] - fail_word(8) - else - success++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(9) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(10) -skip2b: - ; no else - if x>values[1] - fail_word(11) - - ; with else - if x>values[1] - fail_word(12) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl2c - goto skip2c -lbl2c: fail_word(13) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]>values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_word(14) -skip2d: - ; no else - if sources[1]>values[1] - fail_word(15) - - ; with else - if sources[1]>values[1] - fail_word(16) - else - success++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(17) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(18) -skip3b: - ; no else - if x>values[1] - fail_word(19) - - ; with else - if x>values[1] - fail_word(20) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl3c - goto skip3c -lbl3c: fail_word(21) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]>values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_word(22) -skip3d: - ; no else - if sources[1]>values[1] - fail_word(23) - - ; with else - if sources[1]>values[1] - fail_word(24) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(25) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(26) -skip4b: - ; no else - if x>values[1] - fail_word(27) - - ; with else - if x>values[1] - fail_word(28) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl4c - goto skip4c -lbl4c: fail_word(29) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]>values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_word(30) -skip4d: - ; no else - if sources[1]>values[1] - fail_word(31) - - ; with else - if sources[1]>values[1] - fail_word(32) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(33) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(34) -skip5b: - ; no else - if x>values[1] - fail_word(35) - - ; with else - if x>values[1] - fail_word(36) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl5c - goto skip5c -lbl5c: fail_word(37) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]>values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_word(38) -skip5d: - ; no else - if sources[1]>values[1] - fail_word(39) - - ; with else - if sources[1]>values[1] - fail_word(40) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(41) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(42) -skip6b: - ; no else - if x>values[1] - fail_word(43) - - ; with else - if x>values[1] - fail_word(44) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl6c - goto skip6c -lbl6c: fail_word(45) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]>values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_word(46) -skip6d: - ; no else - if sources[1]>values[1] - fail_word(47) - - ; with else - if sources[1]>values[1] - fail_word(48) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(49) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(50) -skip7b: - ; no else - if x>values[1] - fail_word(51) - - ; with else - if x>values[1] - fail_word(52) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl7c - goto skip7c -lbl7c: fail_word(53) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]>values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_word(54) -skip7d: - ; no else - if sources[1]>values[1] - fail_word(55) - - ; with else - if sources[1]>values[1] - fail_word(56) - else - success++ - - x=-1 - sources[1]=-1 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]>values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl9a - goto skip9a -lbl9a: fail_word(57) -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>values[1] - goto cx16.r3 - goto skip9b -lbl9b: fail_word(58) -skip9b: - ; no else - if x>values[1] - fail_word(59) - - ; with else - if x>values[1] - fail_word(60) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl9c - goto skip9c -lbl9c: fail_word(61) -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]>values[1] - goto cx16.r3 - goto skip9d -lbl9d: fail_word(62) -skip9d: - ; no else - if sources[1]>values[1] - fail_word(63) - - ; with else - if sources[1]>values[1] - fail_word(64) - else - success++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(65) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(66) -skip10b: - ; no else - if x>values[1] - fail_word(67) - - ; with else - if x>values[1] - fail_word(68) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl10c - goto skip10c -lbl10c: fail_word(69) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]>values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_word(70) -skip10d: - ; no else - if sources[1]>values[1] - fail_word(71) - - ; with else - if sources[1]>values[1] - fail_word(72) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(73) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(74) -skip11b: - ; no else - if x>values[1] - fail_word(75) - - ; with else - if x>values[1] - fail_word(76) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl11c - goto skip11c -lbl11c: fail_word(77) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]>values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_word(78) -skip11d: - ; no else - if sources[1]>values[1] - fail_word(79) - - ; with else - if sources[1]>values[1] - fail_word(80) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(81) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(82) -skip12b: - ; no else - if x>values[1] - fail_word(83) - - ; with else - if x>values[1] - fail_word(84) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl12c - goto skip12c -lbl12c: fail_word(85) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]>values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_word(86) -skip12d: - ; no else - if sources[1]>values[1] - fail_word(87) - - ; with else - if sources[1]>values[1] - fail_word(88) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(89) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(90) -skip13b: - ; no else - if x>values[1] - fail_word(91) - - ; with else - if x>values[1] - fail_word(92) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl13c - goto skip13c -lbl13c: fail_word(93) -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]>values[1] - goto cx16.r3 - goto skip13d -lbl13d: fail_word(94) -skip13d: - ; no else - if sources[1]>values[1] - fail_word(95) - - ; with else - if sources[1]>values[1] - fail_word(96) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(97) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(98) -skip14b: - ; no else - if x>values[1] - fail_word(99) - - ; with else - if x>values[1] - fail_word(100) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl14c - goto skip14c -lbl14c: fail_word(101) -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]>values[1] - goto cx16.r3 - goto skip14d -lbl14d: fail_word(102) -skip14d: - ; no else - if sources[1]>values[1] - fail_word(103) - - ; with else - if sources[1]>values[1] - fail_word(104) - else - success++ - - x=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl15c - goto skip15c -lbl15c: success++ -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]>values[1] - goto cx16.r3 - goto skip15d -lbl15d: success++ -skip15d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl16c - goto skip16c -lbl16c: success++ -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]>values[1] - goto cx16.r3 - goto skip16d -lbl16d: success++ -skip16d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl17a - goto skip17a -lbl17a: fail_word(105) -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>values[1] - goto cx16.r3 - goto skip17b -lbl17b: fail_word(106) -skip17b: - ; no else - if x>values[1] - fail_word(107) - - ; with else - if x>values[1] - fail_word(108) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl17c - goto skip17c -lbl17c: fail_word(109) -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]>values[1] - goto cx16.r3 - goto skip17d -lbl17d: fail_word(110) -skip17d: - ; no else - if sources[1]>values[1] - fail_word(111) - - ; with else - if sources[1]>values[1] - fail_word(112) - else - success++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(113) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(114) -skip18b: - ; no else - if x>values[1] - fail_word(115) - - ; with else - if x>values[1] - fail_word(116) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl18c - goto skip18c -lbl18c: fail_word(117) -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]>values[1] - goto cx16.r3 - goto skip18d -lbl18d: fail_word(118) -skip18d: - ; no else - if sources[1]>values[1] - fail_word(119) - - ; with else - if sources[1]>values[1] - fail_word(120) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(121) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(122) -skip19b: - ; no else - if x>values[1] - fail_word(123) - - ; with else - if x>values[1] - fail_word(124) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl19c - goto skip19c -lbl19c: fail_word(125) -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]>values[1] - goto cx16.r3 - goto skip19d -lbl19d: fail_word(126) -skip19d: - ; no else - if sources[1]>values[1] - fail_word(127) - - ; with else - if sources[1]>values[1] - fail_word(128) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(129) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(130) -skip20b: - ; no else - if x>values[1] - fail_word(131) - - ; with else - if x>values[1] - fail_word(132) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl20c - goto skip20c -lbl20c: fail_word(133) -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]>values[1] - goto cx16.r3 - goto skip20d -lbl20d: fail_word(134) -skip20d: - ; no else - if sources[1]>values[1] - fail_word(135) - - ; with else - if sources[1]>values[1] - fail_word(136) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl21a - goto skip21a -lbl21a: fail_word(137) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>values[1] - goto cx16.r3 - goto skip21b -lbl21b: fail_word(138) -skip21b: - ; no else - if x>values[1] - fail_word(139) - - ; with else - if x>values[1] - fail_word(140) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl21c - goto skip21c -lbl21c: fail_word(141) -skip21c: - ; indirect jump - cx16.r3 = &lbl21d - if sources[1]>values[1] - goto cx16.r3 - goto skip21d -lbl21d: fail_word(142) -skip21d: - ; no else - if sources[1]>values[1] - fail_word(143) - - ; with else - if sources[1]>values[1] - fail_word(144) - else - success++ - - x=1 - sources[1]=1 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>values[1] - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl22c - goto skip22c -lbl22c: success++ -skip22c: - ; indirect jump - cx16.r3 = &lbl22d - if sources[1]>values[1] - goto cx16.r3 - goto skip22d -lbl22d: success++ -skip22d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>values[1] - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl23c - goto skip23c -lbl23c: success++ -skip23c: - ; indirect jump - cx16.r3 = &lbl23d - if sources[1]>values[1] - goto cx16.r3 - goto skip23d -lbl23d: success++ -skip23d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>values[1] - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl24c - goto skip24c -lbl24c: success++ -skip24c: - ; indirect jump - cx16.r3 = &lbl24d - if sources[1]>values[1] - goto cx16.r3 - goto skip24d -lbl24d: success++ -skip24d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl25a - goto skip25a -lbl25a: fail_word(145) -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>values[1] - goto cx16.r3 - goto skip25b -lbl25b: fail_word(146) -skip25b: - ; no else - if x>values[1] - fail_word(147) - - ; with else - if x>values[1] - fail_word(148) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl25c - goto skip25c -lbl25c: fail_word(149) -skip25c: - ; indirect jump - cx16.r3 = &lbl25d - if sources[1]>values[1] - goto cx16.r3 - goto skip25d -lbl25d: fail_word(150) -skip25d: - ; no else - if sources[1]>values[1] - fail_word(151) - - ; with else - if sources[1]>values[1] - fail_word(152) - else - success++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl26a - goto skip26a -lbl26a: fail_word(153) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>values[1] - goto cx16.r3 - goto skip26b -lbl26b: fail_word(154) -skip26b: - ; no else - if x>values[1] - fail_word(155) - - ; with else - if x>values[1] - fail_word(156) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl26c - goto skip26c -lbl26c: fail_word(157) -skip26c: - ; indirect jump - cx16.r3 = &lbl26d - if sources[1]>values[1] - goto cx16.r3 - goto skip26d -lbl26d: fail_word(158) -skip26d: - ; no else - if sources[1]>values[1] - fail_word(159) - - ; with else - if sources[1]>values[1] - fail_word(160) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl27a - goto skip27a -lbl27a: fail_word(161) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>values[1] - goto cx16.r3 - goto skip27b -lbl27b: fail_word(162) -skip27b: - ; no else - if x>values[1] - fail_word(163) - - ; with else - if x>values[1] - fail_word(164) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl27c - goto skip27c -lbl27c: fail_word(165) -skip27c: - ; indirect jump - cx16.r3 = &lbl27d - if sources[1]>values[1] - goto cx16.r3 - goto skip27d -lbl27d: fail_word(166) -skip27d: - ; no else - if sources[1]>values[1] - fail_word(167) - - ; with else - if sources[1]>values[1] - fail_word(168) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl28a - goto skip28a -lbl28a: fail_word(169) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>values[1] - goto cx16.r3 - goto skip28b -lbl28b: fail_word(170) -skip28b: - ; no else - if x>values[1] - fail_word(171) - - ; with else - if x>values[1] - fail_word(172) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl28c - goto skip28c -lbl28c: fail_word(173) -skip28c: - ; indirect jump - cx16.r3 = &lbl28d - if sources[1]>values[1] - goto cx16.r3 - goto skip28d -lbl28d: fail_word(174) -skip28d: - ; no else - if sources[1]>values[1] - fail_word(175) - - ; with else - if sources[1]>values[1] - fail_word(176) - else - success++ - - x=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>values[1] - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl29c - goto skip29c -lbl29c: success++ -skip29c: - ; indirect jump - cx16.r3 = &lbl29d - if sources[1]>values[1] - goto cx16.r3 - goto skip29d -lbl29d: success++ -skip29d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>values[1] - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl30c - goto skip30c -lbl30c: success++ -skip30c: - ; indirect jump - cx16.r3 = &lbl30d - if sources[1]>values[1] - goto cx16.r3 - goto skip30d -lbl30d: success++ -skip30d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>values[1] - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl31c - goto skip31c -lbl31c: success++ -skip31c: - ; indirect jump - cx16.r3 = &lbl31d - if sources[1]>values[1] - goto cx16.r3 - goto skip31d -lbl31d: success++ -skip31d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>values[1] - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl32c - goto skip32c -lbl32c: success++ -skip32c: - ; indirect jump - cx16.r3 = &lbl32d - if sources[1]>values[1] - goto cx16.r3 - goto skip32d -lbl32d: success++ -skip32d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl33a - goto skip33a -lbl33a: fail_word(177) -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>values[1] - goto cx16.r3 - goto skip33b -lbl33b: fail_word(178) -skip33b: - ; no else - if x>values[1] - fail_word(179) - - ; with else - if x>values[1] - fail_word(180) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl33c - goto skip33c -lbl33c: fail_word(181) -skip33c: - ; indirect jump - cx16.r3 = &lbl33d - if sources[1]>values[1] - goto cx16.r3 - goto skip33d -lbl33d: fail_word(182) -skip33d: - ; no else - if sources[1]>values[1] - fail_word(183) - - ; with else - if sources[1]>values[1] - fail_word(184) - else - success++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl34a - goto skip34a -lbl34a: fail_word(185) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>values[1] - goto cx16.r3 - goto skip34b -lbl34b: fail_word(186) -skip34b: - ; no else - if x>values[1] - fail_word(187) - - ; with else - if x>values[1] - fail_word(188) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl34c - goto skip34c -lbl34c: fail_word(189) -skip34c: - ; indirect jump - cx16.r3 = &lbl34d - if sources[1]>values[1] - goto cx16.r3 - goto skip34d -lbl34d: fail_word(190) -skip34d: - ; no else - if sources[1]>values[1] - fail_word(191) - - ; with else - if sources[1]>values[1] - fail_word(192) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl35a - goto skip35a -lbl35a: fail_word(193) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>values[1] - goto cx16.r3 - goto skip35b -lbl35b: fail_word(194) -skip35b: - ; no else - if x>values[1] - fail_word(195) - - ; with else - if x>values[1] - fail_word(196) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl35c - goto skip35c -lbl35c: fail_word(197) -skip35c: - ; indirect jump - cx16.r3 = &lbl35d - if sources[1]>values[1] - goto cx16.r3 - goto skip35d -lbl35d: fail_word(198) -skip35d: - ; no else - if sources[1]>values[1] - fail_word(199) - - ; with else - if sources[1]>values[1] - fail_word(200) - else - success++ - - x=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>values[1] - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl36c - goto skip36c -lbl36c: success++ -skip36c: - ; indirect jump - cx16.r3 = &lbl36d - if sources[1]>values[1] - goto cx16.r3 - goto skip36d -lbl36d: success++ -skip36d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>values[1] - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl37c - goto skip37c -lbl37c: success++ -skip37c: - ; indirect jump - cx16.r3 = &lbl37d - if sources[1]>values[1] - goto cx16.r3 - goto skip37d -lbl37d: success++ -skip37d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>values[1] - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl38c - goto skip38c -lbl38c: success++ -skip38c: - ; indirect jump - cx16.r3 = &lbl38d - if sources[1]>values[1] - goto cx16.r3 - goto skip38d -lbl38d: success++ -skip38d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>values[1] - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl39c - goto skip39c -lbl39c: success++ -skip39c: - ; indirect jump - cx16.r3 = &lbl39d - if sources[1]>values[1] - goto cx16.r3 - goto skip39d -lbl39d: success++ -skip39d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>values[1] - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl40c - goto skip40c -lbl40c: success++ -skip40c: - ; indirect jump - cx16.r3 = &lbl40d - if sources[1]>values[1] - goto cx16.r3 - goto skip40d -lbl40d: success++ -skip40d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl41a - goto skip41a -lbl41a: fail_word(201) -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>values[1] - goto cx16.r3 - goto skip41b -lbl41b: fail_word(202) -skip41b: - ; no else - if x>values[1] - fail_word(203) - - ; with else - if x>values[1] - fail_word(204) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl41c - goto skip41c -lbl41c: fail_word(205) -skip41c: - ; indirect jump - cx16.r3 = &lbl41d - if sources[1]>values[1] - goto cx16.r3 - goto skip41d -lbl41d: fail_word(206) -skip41d: - ; no else - if sources[1]>values[1] - fail_word(207) - - ; with else - if sources[1]>values[1] - fail_word(208) - else - success++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl42a - goto skip42a -lbl42a: fail_word(209) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>values[1] - goto cx16.r3 - goto skip42b -lbl42b: fail_word(210) -skip42b: - ; no else - if x>values[1] - fail_word(211) - - ; with else - if x>values[1] - fail_word(212) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl42c - goto skip42c -lbl42c: fail_word(213) -skip42c: - ; indirect jump - cx16.r3 = &lbl42d - if sources[1]>values[1] - goto cx16.r3 - goto skip42d -lbl42d: fail_word(214) -skip42d: - ; no else - if sources[1]>values[1] - fail_word(215) - - ; with else - if sources[1]>values[1] - fail_word(216) - else - success++ - - x=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if x>values[1] - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>values[1] - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl43c - goto skip43c -lbl43c: success++ -skip43c: - ; indirect jump - cx16.r3 = &lbl43d - if sources[1]>values[1] - goto cx16.r3 - goto skip43d -lbl43d: success++ -skip43d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>values[1] - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>values[1] - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl44c - goto skip44c -lbl44c: success++ -skip44c: - ; indirect jump - cx16.r3 = &lbl44d - if sources[1]>values[1] - goto cx16.r3 - goto skip44d -lbl44d: success++ -skip44d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>values[1] - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>values[1] - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl45c - goto skip45c -lbl45c: success++ -skip45c: - ; indirect jump - cx16.r3 = &lbl45d - if sources[1]>values[1] - goto cx16.r3 - goto skip45d -lbl45d: success++ -skip45d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>values[1] - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>values[1] - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl46c - goto skip46c -lbl46c: success++ -skip46c: - ; indirect jump - cx16.r3 = &lbl46d - if sources[1]>values[1] - goto cx16.r3 - goto skip46d -lbl46d: success++ -skip46d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>values[1] - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>values[1] - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl47c - goto skip47c -lbl47c: success++ -skip47c: - ; indirect jump - cx16.r3 = &lbl47d - if sources[1]>values[1] - goto cx16.r3 - goto skip47d -lbl47d: success++ -skip47d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>values[1] - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>values[1] - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>values[1] - success++ - - ; with else - if x>values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>values[1] - goto lbl48c - goto skip48c -lbl48c: success++ -skip48c: - ; indirect jump - cx16.r3 = &lbl48d - if sources[1]>values[1] - goto cx16.r3 - goto skip48d -lbl48d: success++ -skip48d: - ; no else - if sources[1]>values[1] - success++ - - ; with else - if sources[1]>values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x>values[1] - goto lbl49a - goto skip49a -lbl49a: fail_word(217) -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>values[1] - goto cx16.r3 - goto skip49b -lbl49b: fail_word(218) -skip49b: - ; no else - if x>values[1] - fail_word(219) - - ; with else - if x>values[1] - fail_word(220) - else - success++ - - ; direct jump - if sources[1]>values[1] - goto lbl49c - goto skip49c -lbl49c: fail_word(221) -skip49c: - ; indirect jump - cx16.r3 = &lbl49d - if sources[1]>values[1] - goto cx16.r3 - goto skip49d -lbl49d: fail_word(222) -skip49d: - ; no else - if sources[1]>values[1] - fail_word(223) - - ; with else - if sources[1]>values[1] - fail_word(224) - else - success++ - - verify_success(224) -} - -} - diff --git a/compiler/test/comparisons/test_word_splitw_gte.asm b/compiler/test/comparisons/test_word_splitw_gte.asm deleted file mode 100644 index a7f7d8a2d..000000000 --- a/compiler/test/comparisons/test_word_splitw_gte.asm +++ /dev/null @@ -1,16682 +0,0 @@ -; w65c02 assembly code for 'test_word_splitw_gte' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:51 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_splitw_gte.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .word ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_splitw_gte.p8:9 uword success = 0 - ; source: test_word_splitw_gte.p8:10 str datatype = "word" - ; source: test_word_splitw_gte.p8:11 uword @shared comparison - ; source: test_word_splitw_gte.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_splitw_gte.p8:14 txt.print("\ngreater-equal split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #=array[]: ") - ldy #>prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gte.p8:53 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:54 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:56 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_splitw_gte.p8:58 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_gte.p8:59 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:60 skip1a: -p8l_skip1a - ; source: test_word_splitw_gte.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:63 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:65 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_gte.p8:66 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:67 skip1b: -p8l_skip1b - ; source: test_word_splitw_gte.p8:69 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_splitw_gte.p8:70 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_3_afterif - ; source: test_word_splitw_gte.p8:73 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_splitw_gte.p8:74 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_splitw_gte.p8:76 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_word_splitw_gte.p8:79 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl1c - ; source: test_word_splitw_gte.p8:81 goto skip1c - bra p8l_skip1c - ; source: test_word_splitw_gte.p8:82 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:83 skip1c: -p8l_skip1c - ; source: test_word_splitw_gte.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:86 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:88 goto skip1d - bra p8l_skip1d - ; source: test_word_splitw_gte.p8:89 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:90 skip1d: -p8l_skip1d - ; source: test_word_splitw_gte.p8:92 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_6_afterif - ; source: test_word_splitw_gte.p8:93 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_6_afterif - ; source: test_word_splitw_gte.p8:96 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_8_else - ; source: test_word_splitw_gte.p8:97 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_splitw_gte.p8:99 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_word_splitw_gte.p8:101 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:103 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_splitw_gte.p8:105 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_gte.p8:106 lbl2a: fail_word(1) -p8l_lbl2a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:107 skip2a: -p8l_skip2a - ; source: test_word_splitw_gte.p8:109 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:110 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:112 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_gte.p8:113 lbl2b: fail_word(2) -p8l_lbl2b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:114 skip2b: -p8l_skip2b - ; source: test_word_splitw_gte.p8:116 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_9_afterif - ; source: test_word_splitw_gte.p8:117 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_9_afterif - ; source: test_word_splitw_gte.p8:120 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_11_else - ; source: test_word_splitw_gte.p8:121 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_splitw_gte.p8:123 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_10_afterif - ; source: test_word_splitw_gte.p8:126 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl2c - ; source: test_word_splitw_gte.p8:128 goto skip2c - bra p8l_skip2c - ; source: test_word_splitw_gte.p8:129 lbl2c: fail_word(5) -p8l_lbl2c - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:130 skip2c: -p8l_skip2c - ; source: test_word_splitw_gte.p8:132 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:133 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:135 goto skip2d - bra p8l_skip2d - ; source: test_word_splitw_gte.p8:136 lbl2d: fail_word(6) -p8l_lbl2d - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:137 skip2d: -p8l_skip2d - ; source: test_word_splitw_gte.p8:139 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_12_afterif - ; source: test_word_splitw_gte.p8:140 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_12_afterif - ; source: test_word_splitw_gte.p8:143 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_14_else - ; source: test_word_splitw_gte.p8:144 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_splitw_gte.p8:146 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_13_afterif - ; source: test_word_splitw_gte.p8:148 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:150 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_splitw_gte.p8:152 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_gte.p8:153 lbl3a: fail_word(9) -p8l_lbl3a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:154 skip3a: -p8l_skip3a - ; source: test_word_splitw_gte.p8:156 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:157 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:159 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_gte.p8:160 lbl3b: fail_word(10) -p8l_lbl3b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:161 skip3b: -p8l_skip3b - ; source: test_word_splitw_gte.p8:163 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_splitw_gte.p8:164 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_15_afterif - ; source: test_word_splitw_gte.p8:167 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_splitw_gte.p8:168 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_splitw_gte.p8:170 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_16_afterif - ; source: test_word_splitw_gte.p8:173 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl3c - ; source: test_word_splitw_gte.p8:175 goto skip3c - bra p8l_skip3c - ; source: test_word_splitw_gte.p8:176 lbl3c: fail_word(13) -p8l_lbl3c - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:177 skip3c: -p8l_skip3c - ; source: test_word_splitw_gte.p8:179 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:180 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:182 goto skip3d - bra p8l_skip3d - ; source: test_word_splitw_gte.p8:183 lbl3d: fail_word(14) -p8l_lbl3d - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:184 skip3d: -p8l_skip3d - ; source: test_word_splitw_gte.p8:186 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_splitw_gte.p8:187 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_18_afterif - ; source: test_word_splitw_gte.p8:190 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_splitw_gte.p8:191 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_splitw_gte.p8:193 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_19_afterif - ; source: test_word_splitw_gte.p8:195 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:197 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_splitw_gte.p8:199 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_gte.p8:200 lbl4a: fail_word(17) -p8l_lbl4a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:201 skip4a: -p8l_skip4a - ; source: test_word_splitw_gte.p8:203 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:204 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:206 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_gte.p8:207 lbl4b: fail_word(18) -p8l_lbl4b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:208 skip4b: -p8l_skip4b - ; source: test_word_splitw_gte.p8:210 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_splitw_gte.p8:211 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_21_afterif - ; source: test_word_splitw_gte.p8:214 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_splitw_gte.p8:215 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_splitw_gte.p8:217 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_22_afterif - ; source: test_word_splitw_gte.p8:220 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl4c - ; source: test_word_splitw_gte.p8:222 goto skip4c - bra p8l_skip4c - ; source: test_word_splitw_gte.p8:223 lbl4c: fail_word(21) -p8l_lbl4c - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:224 skip4c: -p8l_skip4c - ; source: test_word_splitw_gte.p8:226 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:227 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:229 goto skip4d - bra p8l_skip4d - ; source: test_word_splitw_gte.p8:230 lbl4d: fail_word(22) -p8l_lbl4d - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:231 skip4d: -p8l_skip4d - ; source: test_word_splitw_gte.p8:233 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_splitw_gte.p8:234 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_24_afterif - ; source: test_word_splitw_gte.p8:237 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_splitw_gte.p8:238 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_splitw_gte.p8:240 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_25_afterif - ; source: test_word_splitw_gte.p8:242 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:244 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_splitw_gte.p8:246 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_gte.p8:247 lbl5a: fail_word(25) -p8l_lbl5a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:248 skip5a: -p8l_skip5a - ; source: test_word_splitw_gte.p8:250 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:251 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:253 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_gte.p8:254 lbl5b: fail_word(26) -p8l_lbl5b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:255 skip5b: -p8l_skip5b - ; source: test_word_splitw_gte.p8:257 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_27_afterif - ; source: test_word_splitw_gte.p8:258 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_27_afterif - ; source: test_word_splitw_gte.p8:261 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_29_else - ; source: test_word_splitw_gte.p8:262 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_splitw_gte.p8:264 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_28_afterif - ; source: test_word_splitw_gte.p8:267 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl5c - ; source: test_word_splitw_gte.p8:269 goto skip5c - bra p8l_skip5c - ; source: test_word_splitw_gte.p8:270 lbl5c: fail_word(29) -p8l_lbl5c - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:271 skip5c: -p8l_skip5c - ; source: test_word_splitw_gte.p8:273 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:274 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:276 goto skip5d - bra p8l_skip5d - ; source: test_word_splitw_gte.p8:277 lbl5d: fail_word(30) -p8l_lbl5d - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:278 skip5d: -p8l_skip5d - ; source: test_word_splitw_gte.p8:280 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_30_afterif - ; source: test_word_splitw_gte.p8:281 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_30_afterif - ; source: test_word_splitw_gte.p8:284 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_32_else - ; source: test_word_splitw_gte.p8:285 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_splitw_gte.p8:287 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_31_afterif - ; source: test_word_splitw_gte.p8:289 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:291 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_splitw_gte.p8:293 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_gte.p8:294 lbl6a: fail_word(33) -p8l_lbl6a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:295 skip6a: -p8l_skip6a - ; source: test_word_splitw_gte.p8:297 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:298 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:300 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_gte.p8:301 lbl6b: fail_word(34) -p8l_lbl6b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:302 skip6b: -p8l_skip6b - ; source: test_word_splitw_gte.p8:304 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_33_afterif - ; source: test_word_splitw_gte.p8:305 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_33_afterif - ; source: test_word_splitw_gte.p8:308 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_35_else - ; source: test_word_splitw_gte.p8:309 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_splitw_gte.p8:311 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_34_afterif - ; source: test_word_splitw_gte.p8:314 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl6c - ; source: test_word_splitw_gte.p8:316 goto skip6c - bra p8l_skip6c - ; source: test_word_splitw_gte.p8:317 lbl6c: fail_word(37) -p8l_lbl6c - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:318 skip6c: -p8l_skip6c - ; source: test_word_splitw_gte.p8:320 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:321 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:323 goto skip6d - bra p8l_skip6d - ; source: test_word_splitw_gte.p8:324 lbl6d: fail_word(38) -p8l_lbl6d - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:325 skip6d: -p8l_skip6d - ; source: test_word_splitw_gte.p8:327 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_splitw_gte.p8:328 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_36_afterif - ; source: test_word_splitw_gte.p8:331 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_splitw_gte.p8:332 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_splitw_gte.p8:334 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_37_afterif - ; source: test_word_splitw_gte.p8:336 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:338 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_splitw_gte.p8:340 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_gte.p8:341 lbl7a: fail_word(41) -p8l_lbl7a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:342 skip7a: -p8l_skip7a - ; source: test_word_splitw_gte.p8:344 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:345 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:347 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_gte.p8:348 lbl7b: fail_word(42) -p8l_lbl7b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:349 skip7b: -p8l_skip7b - ; source: test_word_splitw_gte.p8:351 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_splitw_gte.p8:352 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_39_afterif - ; source: test_word_splitw_gte.p8:355 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_splitw_gte.p8:356 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_splitw_gte.p8:358 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_40_afterif - ; source: test_word_splitw_gte.p8:361 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl7c - ; source: test_word_splitw_gte.p8:363 goto skip7c - bra p8l_skip7c - ; source: test_word_splitw_gte.p8:364 lbl7c: fail_word(45) -p8l_lbl7c - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:365 skip7c: -p8l_skip7c - ; source: test_word_splitw_gte.p8:367 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:368 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:370 goto skip7d - bra p8l_skip7d - ; source: test_word_splitw_gte.p8:371 lbl7d: fail_word(46) -p8l_lbl7d - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:372 skip7d: -p8l_skip7d - ; source: test_word_splitw_gte.p8:374 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_splitw_gte.p8:375 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_42_afterif - ; source: test_word_splitw_gte.p8:378 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_splitw_gte.p8:379 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_splitw_gte.p8:381 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_43_afterif - ; source: test_word_splitw_gte.p8:383 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gte.p8:384 sources[1]=-1 - ldy #1 - lda #<-1 - sta p8v_sources_lsb,y - lda #>-1 - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:385 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:387 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_splitw_gte.p8:389 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_gte.p8:390 lbl8a: success++ -p8l_lbl8a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:391 skip8a: -p8l_skip8a - ; source: test_word_splitw_gte.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:394 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:396 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_gte.p8:397 lbl8b: success++ -p8l_lbl8b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:398 skip8b: -p8l_skip8b - ; source: test_word_splitw_gte.p8:400 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_splitw_gte.p8:401 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_45_afterif - ; source: test_word_splitw_gte.p8:404 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_splitw_gte.p8:405 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_splitw_gte.p8:407 cx16.r0L++ - inc cx16.r0L -label_asm_46_afterif - ; source: test_word_splitw_gte.p8:410 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl8c - ; source: test_word_splitw_gte.p8:412 goto skip8c - bra p8l_skip8c - ; source: test_word_splitw_gte.p8:413 lbl8c: success++ -p8l_lbl8c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:414 skip8c: -p8l_skip8c - ; source: test_word_splitw_gte.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:417 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:419 goto skip8d - bra p8l_skip8d - ; source: test_word_splitw_gte.p8:420 lbl8d: success++ -p8l_lbl8d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:421 skip8d: -p8l_skip8d - ; source: test_word_splitw_gte.p8:423 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_48_afterif - ; source: test_word_splitw_gte.p8:424 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_48_afterif - ; source: test_word_splitw_gte.p8:427 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_50_else - ; source: test_word_splitw_gte.p8:428 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_splitw_gte.p8:430 cx16.r0L++ - inc cx16.r0L -label_asm_49_afterif - ; source: test_word_splitw_gte.p8:432 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:434 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_splitw_gte.p8:436 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_gte.p8:437 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:438 skip9a: -p8l_skip9a - ; source: test_word_splitw_gte.p8:440 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:441 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:443 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_gte.p8:444 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:445 skip9b: -p8l_skip9b - ; source: test_word_splitw_gte.p8:447 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_51_afterif - ; source: test_word_splitw_gte.p8:448 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_51_afterif - ; source: test_word_splitw_gte.p8:451 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_53_else - ; source: test_word_splitw_gte.p8:452 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_splitw_gte.p8:454 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_word_splitw_gte.p8:457 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl9c - ; source: test_word_splitw_gte.p8:459 goto skip9c - bra p8l_skip9c - ; source: test_word_splitw_gte.p8:460 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:461 skip9c: -p8l_skip9c - ; source: test_word_splitw_gte.p8:463 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:464 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:466 goto skip9d - bra p8l_skip9d - ; source: test_word_splitw_gte.p8:467 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:468 skip9d: -p8l_skip9d - ; source: test_word_splitw_gte.p8:470 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_54_afterif - ; source: test_word_splitw_gte.p8:471 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_54_afterif - ; source: test_word_splitw_gte.p8:474 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_56_else - ; source: test_word_splitw_gte.p8:475 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_splitw_gte.p8:477 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_word_splitw_gte.p8:479 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:481 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_splitw_gte.p8:483 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_gte.p8:484 lbl10a: fail_word(49) -p8l_lbl10a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:485 skip10a: -p8l_skip10a - ; source: test_word_splitw_gte.p8:487 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:488 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:490 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_gte.p8:491 lbl10b: fail_word(50) -p8l_lbl10b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:492 skip10b: -p8l_skip10b - ; source: test_word_splitw_gte.p8:494 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_splitw_gte.p8:495 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_57_afterif - ; source: test_word_splitw_gte.p8:498 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_splitw_gte.p8:499 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_splitw_gte.p8:501 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_58_afterif - ; source: test_word_splitw_gte.p8:504 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl10c - ; source: test_word_splitw_gte.p8:506 goto skip10c - bra p8l_skip10c - ; source: test_word_splitw_gte.p8:507 lbl10c: fail_word(53) -p8l_lbl10c - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:508 skip10c: -p8l_skip10c - ; source: test_word_splitw_gte.p8:510 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:511 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:513 goto skip10d - bra p8l_skip10d - ; source: test_word_splitw_gte.p8:514 lbl10d: fail_word(54) -p8l_lbl10d - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:515 skip10d: -p8l_skip10d - ; source: test_word_splitw_gte.p8:517 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_splitw_gte.p8:518 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_60_afterif - ; source: test_word_splitw_gte.p8:521 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_splitw_gte.p8:522 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_splitw_gte.p8:524 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_61_afterif - ; source: test_word_splitw_gte.p8:526 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:528 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_splitw_gte.p8:530 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_gte.p8:531 lbl11a: fail_word(57) -p8l_lbl11a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:532 skip11a: -p8l_skip11a - ; source: test_word_splitw_gte.p8:534 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:535 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:537 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_gte.p8:538 lbl11b: fail_word(58) -p8l_lbl11b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:539 skip11b: -p8l_skip11b - ; source: test_word_splitw_gte.p8:541 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_splitw_gte.p8:542 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_63_afterif - ; source: test_word_splitw_gte.p8:545 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_splitw_gte.p8:546 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_splitw_gte.p8:548 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_64_afterif - ; source: test_word_splitw_gte.p8:551 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl11c - ; source: test_word_splitw_gte.p8:553 goto skip11c - bra p8l_skip11c - ; source: test_word_splitw_gte.p8:554 lbl11c: fail_word(61) -p8l_lbl11c - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:555 skip11c: -p8l_skip11c - ; source: test_word_splitw_gte.p8:557 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:558 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:560 goto skip11d - bra p8l_skip11d - ; source: test_word_splitw_gte.p8:561 lbl11d: fail_word(62) -p8l_lbl11d - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:562 skip11d: -p8l_skip11d - ; source: test_word_splitw_gte.p8:564 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_splitw_gte.p8:565 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_66_afterif - ; source: test_word_splitw_gte.p8:568 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_splitw_gte.p8:569 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_splitw_gte.p8:571 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_67_afterif - ; source: test_word_splitw_gte.p8:573 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:575 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_splitw_gte.p8:577 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_gte.p8:578 lbl12a: fail_word(65) -p8l_lbl12a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:579 skip12a: -p8l_skip12a - ; source: test_word_splitw_gte.p8:581 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:582 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:584 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_gte.p8:585 lbl12b: fail_word(66) -p8l_lbl12b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:586 skip12b: -p8l_skip12b - ; source: test_word_splitw_gte.p8:588 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_69_afterif - ; source: test_word_splitw_gte.p8:589 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_69_afterif - ; source: test_word_splitw_gte.p8:592 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_71_else - ; source: test_word_splitw_gte.p8:593 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_splitw_gte.p8:595 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_70_afterif - ; source: test_word_splitw_gte.p8:598 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl12c - ; source: test_word_splitw_gte.p8:600 goto skip12c - bra p8l_skip12c - ; source: test_word_splitw_gte.p8:601 lbl12c: fail_word(69) -p8l_lbl12c - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:602 skip12c: -p8l_skip12c - ; source: test_word_splitw_gte.p8:604 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:605 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:607 goto skip12d - bra p8l_skip12d - ; source: test_word_splitw_gte.p8:608 lbl12d: fail_word(70) -p8l_lbl12d - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:609 skip12d: -p8l_skip12d - ; source: test_word_splitw_gte.p8:611 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_72_afterif - ; source: test_word_splitw_gte.p8:612 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_72_afterif - ; source: test_word_splitw_gte.p8:615 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_74_else - ; source: test_word_splitw_gte.p8:616 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_splitw_gte.p8:618 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_73_afterif - ; source: test_word_splitw_gte.p8:620 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:622 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_splitw_gte.p8:624 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_gte.p8:625 lbl13a: fail_word(73) -p8l_lbl13a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:626 skip13a: -p8l_skip13a - ; source: test_word_splitw_gte.p8:628 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:629 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:631 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_gte.p8:632 lbl13b: fail_word(74) -p8l_lbl13b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:633 skip13b: -p8l_skip13b - ; source: test_word_splitw_gte.p8:635 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_75_afterif - ; source: test_word_splitw_gte.p8:636 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_75_afterif - ; source: test_word_splitw_gte.p8:639 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_77_else - ; source: test_word_splitw_gte.p8:640 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_splitw_gte.p8:642 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_76_afterif - ; source: test_word_splitw_gte.p8:645 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl13c - ; source: test_word_splitw_gte.p8:647 goto skip13c - bra p8l_skip13c - ; source: test_word_splitw_gte.p8:648 lbl13c: fail_word(77) -p8l_lbl13c - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:649 skip13c: -p8l_skip13c - ; source: test_word_splitw_gte.p8:651 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:652 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:654 goto skip13d - bra p8l_skip13d - ; source: test_word_splitw_gte.p8:655 lbl13d: fail_word(78) -p8l_lbl13d - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:656 skip13d: -p8l_skip13d - ; source: test_word_splitw_gte.p8:658 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_splitw_gte.p8:659 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_78_afterif - ; source: test_word_splitw_gte.p8:662 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_splitw_gte.p8:663 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_splitw_gte.p8:665 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_79_afterif - ; source: test_word_splitw_gte.p8:667 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:669 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_splitw_gte.p8:671 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_gte.p8:672 lbl14a: fail_word(81) -p8l_lbl14a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:673 skip14a: -p8l_skip14a - ; source: test_word_splitw_gte.p8:675 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:676 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:678 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_gte.p8:679 lbl14b: fail_word(82) -p8l_lbl14b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:680 skip14b: -p8l_skip14b - ; source: test_word_splitw_gte.p8:682 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_splitw_gte.p8:683 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_81_afterif - ; source: test_word_splitw_gte.p8:686 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_splitw_gte.p8:687 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_splitw_gte.p8:689 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_82_afterif - ; source: test_word_splitw_gte.p8:692 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl14c - ; source: test_word_splitw_gte.p8:694 goto skip14c - bra p8l_skip14c - ; source: test_word_splitw_gte.p8:695 lbl14c: fail_word(85) -p8l_lbl14c - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:696 skip14c: -p8l_skip14c - ; source: test_word_splitw_gte.p8:698 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:699 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:701 goto skip14d - bra p8l_skip14d - ; source: test_word_splitw_gte.p8:702 lbl14d: fail_word(86) -p8l_lbl14d - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:703 skip14d: -p8l_skip14d - ; source: test_word_splitw_gte.p8:705 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_splitw_gte.p8:706 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_84_afterif - ; source: test_word_splitw_gte.p8:709 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_splitw_gte.p8:710 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_splitw_gte.p8:712 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_85_afterif - ; source: test_word_splitw_gte.p8:714 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_splitw_gte.p8:715 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:716 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:718 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_splitw_gte.p8:720 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_gte.p8:721 lbl15a: success++ -p8l_lbl15a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:722 skip15a: -p8l_skip15a - ; source: test_word_splitw_gte.p8:724 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:725 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:727 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_gte.p8:728 lbl15b: success++ -p8l_lbl15b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:729 skip15b: -p8l_skip15b - ; source: test_word_splitw_gte.p8:731 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_splitw_gte.p8:732 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_87_afterif - ; source: test_word_splitw_gte.p8:735 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_splitw_gte.p8:736 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_splitw_gte.p8:738 cx16.r0L++ - inc cx16.r0L -label_asm_88_afterif - ; source: test_word_splitw_gte.p8:741 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl15c - ; source: test_word_splitw_gte.p8:743 goto skip15c - bra p8l_skip15c - ; source: test_word_splitw_gte.p8:744 lbl15c: success++ -p8l_lbl15c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:745 skip15c: -p8l_skip15c - ; source: test_word_splitw_gte.p8:747 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:748 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:750 goto skip15d - bra p8l_skip15d - ; source: test_word_splitw_gte.p8:751 lbl15d: success++ -p8l_lbl15d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:752 skip15d: -p8l_skip15d - ; source: test_word_splitw_gte.p8:754 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_90_afterif - ; source: test_word_splitw_gte.p8:755 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_90_afterif - ; source: test_word_splitw_gte.p8:758 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_92_else - ; source: test_word_splitw_gte.p8:759 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_splitw_gte.p8:761 cx16.r0L++ - inc cx16.r0L -label_asm_91_afterif - ; source: test_word_splitw_gte.p8:763 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:765 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_splitw_gte.p8:767 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_gte.p8:768 lbl16a: success++ -p8l_lbl16a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:769 skip16a: -p8l_skip16a - ; source: test_word_splitw_gte.p8:771 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:772 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:774 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_gte.p8:775 lbl16b: success++ -p8l_lbl16b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:776 skip16b: -p8l_skip16b - ; source: test_word_splitw_gte.p8:778 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_93_afterif - ; source: test_word_splitw_gte.p8:779 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_93_afterif - ; source: test_word_splitw_gte.p8:782 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_95_else - ; source: test_word_splitw_gte.p8:783 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_splitw_gte.p8:785 cx16.r0L++ - inc cx16.r0L -label_asm_94_afterif - ; source: test_word_splitw_gte.p8:788 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl16c - ; source: test_word_splitw_gte.p8:790 goto skip16c - bra p8l_skip16c - ; source: test_word_splitw_gte.p8:791 lbl16c: success++ -p8l_lbl16c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:792 skip16c: -p8l_skip16c - ; source: test_word_splitw_gte.p8:794 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:795 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:797 goto skip16d - bra p8l_skip16d - ; source: test_word_splitw_gte.p8:798 lbl16d: success++ -p8l_lbl16d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:799 skip16d: -p8l_skip16d - ; source: test_word_splitw_gte.p8:801 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_96_afterif - ; source: test_word_splitw_gte.p8:802 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_96_afterif - ; source: test_word_splitw_gte.p8:805 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_98_else - ; source: test_word_splitw_gte.p8:806 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_splitw_gte.p8:808 cx16.r0L++ - inc cx16.r0L -label_asm_97_afterif - ; source: test_word_splitw_gte.p8:810 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:812 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_splitw_gte.p8:814 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_gte.p8:815 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:816 skip17a: -p8l_skip17a - ; source: test_word_splitw_gte.p8:818 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:819 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:821 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_gte.p8:822 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:823 skip17b: -p8l_skip17b - ; source: test_word_splitw_gte.p8:825 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_splitw_gte.p8:826 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_99_afterif - ; source: test_word_splitw_gte.p8:829 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_splitw_gte.p8:830 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_splitw_gte.p8:832 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_word_splitw_gte.p8:835 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl17c - ; source: test_word_splitw_gte.p8:837 goto skip17c - bra p8l_skip17c - ; source: test_word_splitw_gte.p8:838 lbl17c: success++ -p8l_lbl17c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:839 skip17c: -p8l_skip17c - ; source: test_word_splitw_gte.p8:841 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:842 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:844 goto skip17d - bra p8l_skip17d - ; source: test_word_splitw_gte.p8:845 lbl17d: success++ -p8l_lbl17d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:846 skip17d: -p8l_skip17d - ; source: test_word_splitw_gte.p8:848 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_splitw_gte.p8:849 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_102_afterif - ; source: test_word_splitw_gte.p8:852 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_splitw_gte.p8:853 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_splitw_gte.p8:855 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_word_splitw_gte.p8:857 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:859 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_splitw_gte.p8:861 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_gte.p8:862 lbl18a: fail_word(89) -p8l_lbl18a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:863 skip18a: -p8l_skip18a - ; source: test_word_splitw_gte.p8:865 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:866 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:868 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_gte.p8:869 lbl18b: fail_word(90) -p8l_lbl18b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:870 skip18b: -p8l_skip18b - ; source: test_word_splitw_gte.p8:872 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_splitw_gte.p8:873 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_105_afterif - ; source: test_word_splitw_gte.p8:876 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_splitw_gte.p8:877 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_splitw_gte.p8:879 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_106_afterif - ; source: test_word_splitw_gte.p8:882 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl18c - ; source: test_word_splitw_gte.p8:884 goto skip18c - bra p8l_skip18c - ; source: test_word_splitw_gte.p8:885 lbl18c: fail_word(93) -p8l_lbl18c - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:886 skip18c: -p8l_skip18c - ; source: test_word_splitw_gte.p8:888 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:889 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:891 goto skip18d - bra p8l_skip18d - ; source: test_word_splitw_gte.p8:892 lbl18d: fail_word(94) -p8l_lbl18d - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:893 skip18d: -p8l_skip18d - ; source: test_word_splitw_gte.p8:895 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_splitw_gte.p8:896 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_108_afterif - ; source: test_word_splitw_gte.p8:899 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_splitw_gte.p8:900 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_splitw_gte.p8:902 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_109_afterif - ; source: test_word_splitw_gte.p8:904 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:906 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_splitw_gte.p8:908 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_gte.p8:909 lbl19a: fail_word(97) -p8l_lbl19a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:910 skip19a: -p8l_skip19a - ; source: test_word_splitw_gte.p8:912 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:913 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:915 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_gte.p8:916 lbl19b: fail_word(98) -p8l_lbl19b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:917 skip19b: -p8l_skip19b - ; source: test_word_splitw_gte.p8:919 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_111_afterif - ; source: test_word_splitw_gte.p8:920 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_111_afterif - ; source: test_word_splitw_gte.p8:923 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_113_else - ; source: test_word_splitw_gte.p8:924 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_splitw_gte.p8:926 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_112_afterif - ; source: test_word_splitw_gte.p8:929 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl19c - ; source: test_word_splitw_gte.p8:931 goto skip19c - bra p8l_skip19c - ; source: test_word_splitw_gte.p8:932 lbl19c: fail_word(101) -p8l_lbl19c - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:933 skip19c: -p8l_skip19c - ; source: test_word_splitw_gte.p8:935 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:936 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:938 goto skip19d - bra p8l_skip19d - ; source: test_word_splitw_gte.p8:939 lbl19d: fail_word(102) -p8l_lbl19d - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:940 skip19d: -p8l_skip19d - ; source: test_word_splitw_gte.p8:942 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_114_afterif - ; source: test_word_splitw_gte.p8:943 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_114_afterif - ; source: test_word_splitw_gte.p8:946 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_116_else - ; source: test_word_splitw_gte.p8:947 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_splitw_gte.p8:949 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_115_afterif - ; source: test_word_splitw_gte.p8:951 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:953 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_splitw_gte.p8:955 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_gte.p8:956 lbl20a: fail_word(105) -p8l_lbl20a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:957 skip20a: -p8l_skip20a - ; source: test_word_splitw_gte.p8:959 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:960 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:962 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_gte.p8:963 lbl20b: fail_word(106) -p8l_lbl20b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:964 skip20b: -p8l_skip20b - ; source: test_word_splitw_gte.p8:966 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_117_afterif - ; source: test_word_splitw_gte.p8:967 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_117_afterif - ; source: test_word_splitw_gte.p8:970 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_119_else - ; source: test_word_splitw_gte.p8:971 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_splitw_gte.p8:973 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_118_afterif - ; source: test_word_splitw_gte.p8:976 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl20c - ; source: test_word_splitw_gte.p8:978 goto skip20c - bra p8l_skip20c - ; source: test_word_splitw_gte.p8:979 lbl20c: fail_word(109) -p8l_lbl20c - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:980 skip20c: -p8l_skip20c - ; source: test_word_splitw_gte.p8:982 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:983 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:985 goto skip20d - bra p8l_skip20d - ; source: test_word_splitw_gte.p8:986 lbl20d: fail_word(110) -p8l_lbl20d - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:987 skip20d: -p8l_skip20d - ; source: test_word_splitw_gte.p8:989 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_splitw_gte.p8:990 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_120_afterif - ; source: test_word_splitw_gte.p8:993 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_splitw_gte.p8:994 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_splitw_gte.p8:996 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_121_afterif - ; source: test_word_splitw_gte.p8:998 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1000 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_splitw_gte.p8:1002 goto skip21a - bra p8l_skip21a - ; source: test_word_splitw_gte.p8:1003 lbl21a: fail_word(113) -p8l_lbl21a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1004 skip21a: -p8l_skip21a - ; source: test_word_splitw_gte.p8:1006 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1007 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1009 goto skip21b - bra p8l_skip21b - ; source: test_word_splitw_gte.p8:1010 lbl21b: fail_word(114) -p8l_lbl21b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1011 skip21b: -p8l_skip21b - ; source: test_word_splitw_gte.p8:1013 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_splitw_gte.p8:1014 fail_word(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_123_afterif - ; source: test_word_splitw_gte.p8:1017 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_splitw_gte.p8:1018 fail_word(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_splitw_gte.p8:1020 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_124_afterif - ; source: test_word_splitw_gte.p8:1023 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl21c - ; source: test_word_splitw_gte.p8:1025 goto skip21c - bra p8l_skip21c - ; source: test_word_splitw_gte.p8:1026 lbl21c: fail_word(117) -p8l_lbl21c - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1027 skip21c: -p8l_skip21c - ; source: test_word_splitw_gte.p8:1029 cx16.r3 = &lbl21d - lda #p8l_lbl21d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1030 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1032 goto skip21d - bra p8l_skip21d - ; source: test_word_splitw_gte.p8:1033 lbl21d: fail_word(118) -p8l_lbl21d - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1034 skip21d: -p8l_skip21d - ; source: test_word_splitw_gte.p8:1036 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_splitw_gte.p8:1037 fail_word(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_126_afterif - ; source: test_word_splitw_gte.p8:1040 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_splitw_gte.p8:1041 fail_word(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_splitw_gte.p8:1043 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_127_afterif - ; source: test_word_splitw_gte.p8:1045 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gte.p8:1046 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:1047 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1049 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_splitw_gte.p8:1051 goto skip22a - bra p8l_skip22a - ; source: test_word_splitw_gte.p8:1052 lbl22a: success++ -p8l_lbl22a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1053 skip22a: -p8l_skip22a - ; source: test_word_splitw_gte.p8:1055 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1056 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1058 goto skip22b - bra p8l_skip22b - ; source: test_word_splitw_gte.p8:1059 lbl22b: success++ -p8l_lbl22b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1060 skip22b: -p8l_skip22b - ; source: test_word_splitw_gte.p8:1062 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_splitw_gte.p8:1063 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_129_afterif - ; source: test_word_splitw_gte.p8:1066 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_splitw_gte.p8:1067 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_splitw_gte.p8:1069 cx16.r0L++ - inc cx16.r0L -label_asm_130_afterif - ; source: test_word_splitw_gte.p8:1072 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl22c - ; source: test_word_splitw_gte.p8:1074 goto skip22c - bra p8l_skip22c - ; source: test_word_splitw_gte.p8:1075 lbl22c: success++ -p8l_lbl22c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1076 skip22c: -p8l_skip22c - ; source: test_word_splitw_gte.p8:1078 cx16.r3 = &lbl22d - lda #p8l_lbl22d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1079 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1081 goto skip22d - bra p8l_skip22d - ; source: test_word_splitw_gte.p8:1082 lbl22d: success++ -p8l_lbl22d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1083 skip22d: -p8l_skip22d - ; source: test_word_splitw_gte.p8:1085 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_132_afterif - ; source: test_word_splitw_gte.p8:1086 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_132_afterif - ; source: test_word_splitw_gte.p8:1089 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_134_else - ; source: test_word_splitw_gte.p8:1090 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_splitw_gte.p8:1092 cx16.r0L++ - inc cx16.r0L -label_asm_133_afterif - ; source: test_word_splitw_gte.p8:1094 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1096 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_splitw_gte.p8:1098 goto skip23a - bra p8l_skip23a - ; source: test_word_splitw_gte.p8:1099 lbl23a: success++ -p8l_lbl23a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1100 skip23a: -p8l_skip23a - ; source: test_word_splitw_gte.p8:1102 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1103 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1105 goto skip23b - bra p8l_skip23b - ; source: test_word_splitw_gte.p8:1106 lbl23b: success++ -p8l_lbl23b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1107 skip23b: -p8l_skip23b - ; source: test_word_splitw_gte.p8:1109 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_135_afterif - ; source: test_word_splitw_gte.p8:1110 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_135_afterif - ; source: test_word_splitw_gte.p8:1113 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_137_else - ; source: test_word_splitw_gte.p8:1114 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_splitw_gte.p8:1116 cx16.r0L++ - inc cx16.r0L -label_asm_136_afterif - ; source: test_word_splitw_gte.p8:1119 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl23c - ; source: test_word_splitw_gte.p8:1121 goto skip23c - bra p8l_skip23c - ; source: test_word_splitw_gte.p8:1122 lbl23c: success++ -p8l_lbl23c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1123 skip23c: -p8l_skip23c - ; source: test_word_splitw_gte.p8:1125 cx16.r3 = &lbl23d - lda #p8l_lbl23d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1126 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1128 goto skip23d - bra p8l_skip23d - ; source: test_word_splitw_gte.p8:1129 lbl23d: success++ -p8l_lbl23d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1130 skip23d: -p8l_skip23d - ; source: test_word_splitw_gte.p8:1132 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_138_afterif - ; source: test_word_splitw_gte.p8:1133 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_138_afterif - ; source: test_word_splitw_gte.p8:1136 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_140_else - ; source: test_word_splitw_gte.p8:1137 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_splitw_gte.p8:1139 cx16.r0L++ - inc cx16.r0L -label_asm_139_afterif - ; source: test_word_splitw_gte.p8:1141 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1143 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_splitw_gte.p8:1145 goto skip24a - bra p8l_skip24a - ; source: test_word_splitw_gte.p8:1146 lbl24a: success++ -p8l_lbl24a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1147 skip24a: -p8l_skip24a - ; source: test_word_splitw_gte.p8:1149 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1150 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1152 goto skip24b - bra p8l_skip24b - ; source: test_word_splitw_gte.p8:1153 lbl24b: success++ -p8l_lbl24b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1154 skip24b: -p8l_skip24b - ; source: test_word_splitw_gte.p8:1156 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_splitw_gte.p8:1157 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_141_afterif - ; source: test_word_splitw_gte.p8:1160 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_splitw_gte.p8:1161 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_splitw_gte.p8:1163 cx16.r0L++ - inc cx16.r0L -label_asm_142_afterif - ; source: test_word_splitw_gte.p8:1166 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl24c - ; source: test_word_splitw_gte.p8:1168 goto skip24c - bra p8l_skip24c - ; source: test_word_splitw_gte.p8:1169 lbl24c: success++ -p8l_lbl24c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1170 skip24c: -p8l_skip24c - ; source: test_word_splitw_gte.p8:1172 cx16.r3 = &lbl24d - lda #p8l_lbl24d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1173 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1175 goto skip24d - bra p8l_skip24d - ; source: test_word_splitw_gte.p8:1176 lbl24d: success++ -p8l_lbl24d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1177 skip24d: -p8l_skip24d - ; source: test_word_splitw_gte.p8:1179 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_splitw_gte.p8:1180 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_144_afterif - ; source: test_word_splitw_gte.p8:1183 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_splitw_gte.p8:1184 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_splitw_gte.p8:1186 cx16.r0L++ - inc cx16.r0L -label_asm_145_afterif - ; source: test_word_splitw_gte.p8:1188 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1190 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_splitw_gte.p8:1192 goto skip25a - bra p8l_skip25a - ; source: test_word_splitw_gte.p8:1193 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1194 skip25a: -p8l_skip25a - ; source: test_word_splitw_gte.p8:1196 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1197 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1199 goto skip25b - bra p8l_skip25b - ; source: test_word_splitw_gte.p8:1200 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1201 skip25b: -p8l_skip25b - ; source: test_word_splitw_gte.p8:1203 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_splitw_gte.p8:1204 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_147_afterif - ; source: test_word_splitw_gte.p8:1207 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_splitw_gte.p8:1208 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_splitw_gte.p8:1210 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_word_splitw_gte.p8:1213 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl25c - ; source: test_word_splitw_gte.p8:1215 goto skip25c - bra p8l_skip25c - ; source: test_word_splitw_gte.p8:1216 lbl25c: success++ -p8l_lbl25c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1217 skip25c: -p8l_skip25c - ; source: test_word_splitw_gte.p8:1219 cx16.r3 = &lbl25d - lda #p8l_lbl25d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1220 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1222 goto skip25d - bra p8l_skip25d - ; source: test_word_splitw_gte.p8:1223 lbl25d: success++ -p8l_lbl25d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1224 skip25d: -p8l_skip25d - ; source: test_word_splitw_gte.p8:1226 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_150_afterif - ; source: test_word_splitw_gte.p8:1227 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_150_afterif - ; source: test_word_splitw_gte.p8:1230 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_152_else - ; source: test_word_splitw_gte.p8:1231 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_splitw_gte.p8:1233 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_word_splitw_gte.p8:1235 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1237 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_splitw_gte.p8:1239 goto skip26a - bra p8l_skip26a - ; source: test_word_splitw_gte.p8:1240 lbl26a: fail_word(121) -p8l_lbl26a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1241 skip26a: -p8l_skip26a - ; source: test_word_splitw_gte.p8:1243 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1244 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1246 goto skip26b - bra p8l_skip26b - ; source: test_word_splitw_gte.p8:1247 lbl26b: fail_word(122) -p8l_lbl26b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1248 skip26b: -p8l_skip26b - ; source: test_word_splitw_gte.p8:1250 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_153_afterif - ; source: test_word_splitw_gte.p8:1251 fail_word(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_153_afterif - ; source: test_word_splitw_gte.p8:1254 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_155_else - ; source: test_word_splitw_gte.p8:1255 fail_word(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_splitw_gte.p8:1257 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_154_afterif - ; source: test_word_splitw_gte.p8:1260 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl26c - ; source: test_word_splitw_gte.p8:1262 goto skip26c - bra p8l_skip26c - ; source: test_word_splitw_gte.p8:1263 lbl26c: fail_word(125) -p8l_lbl26c - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1264 skip26c: -p8l_skip26c - ; source: test_word_splitw_gte.p8:1266 cx16.r3 = &lbl26d - lda #p8l_lbl26d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1267 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1269 goto skip26d - bra p8l_skip26d - ; source: test_word_splitw_gte.p8:1270 lbl26d: fail_word(126) -p8l_lbl26d - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1271 skip26d: -p8l_skip26d - ; source: test_word_splitw_gte.p8:1273 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_156_afterif - ; source: test_word_splitw_gte.p8:1274 fail_word(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_156_afterif - ; source: test_word_splitw_gte.p8:1277 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_158_else - ; source: test_word_splitw_gte.p8:1278 fail_word(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_splitw_gte.p8:1280 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_157_afterif - ; source: test_word_splitw_gte.p8:1282 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1284 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_splitw_gte.p8:1286 goto skip27a - bra p8l_skip27a - ; source: test_word_splitw_gte.p8:1287 lbl27a: fail_word(129) -p8l_lbl27a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1288 skip27a: -p8l_skip27a - ; source: test_word_splitw_gte.p8:1290 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1291 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1293 goto skip27b - bra p8l_skip27b - ; source: test_word_splitw_gte.p8:1294 lbl27b: fail_word(130) -p8l_lbl27b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1295 skip27b: -p8l_skip27b - ; source: test_word_splitw_gte.p8:1297 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_159_afterif - ; source: test_word_splitw_gte.p8:1298 fail_word(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_159_afterif - ; source: test_word_splitw_gte.p8:1301 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_161_else - ; source: test_word_splitw_gte.p8:1302 fail_word(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_splitw_gte.p8:1304 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_160_afterif - ; source: test_word_splitw_gte.p8:1307 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl27c - ; source: test_word_splitw_gte.p8:1309 goto skip27c - bra p8l_skip27c - ; source: test_word_splitw_gte.p8:1310 lbl27c: fail_word(133) -p8l_lbl27c - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1311 skip27c: -p8l_skip27c - ; source: test_word_splitw_gte.p8:1313 cx16.r3 = &lbl27d - lda #p8l_lbl27d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1314 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1316 goto skip27d - bra p8l_skip27d - ; source: test_word_splitw_gte.p8:1317 lbl27d: fail_word(134) -p8l_lbl27d - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1318 skip27d: -p8l_skip27d - ; source: test_word_splitw_gte.p8:1320 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_162_afterif - ; source: test_word_splitw_gte.p8:1321 fail_word(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_162_afterif - ; source: test_word_splitw_gte.p8:1324 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_164_else - ; source: test_word_splitw_gte.p8:1325 fail_word(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_splitw_gte.p8:1327 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_163_afterif - ; source: test_word_splitw_gte.p8:1329 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1331 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_splitw_gte.p8:1333 goto skip28a - bra p8l_skip28a - ; source: test_word_splitw_gte.p8:1334 lbl28a: fail_word(137) -p8l_lbl28a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1335 skip28a: -p8l_skip28a - ; source: test_word_splitw_gte.p8:1337 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1338 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1340 goto skip28b - bra p8l_skip28b - ; source: test_word_splitw_gte.p8:1341 lbl28b: fail_word(138) -p8l_lbl28b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1342 skip28b: -p8l_skip28b - ; source: test_word_splitw_gte.p8:1344 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_165_afterif - ; source: test_word_splitw_gte.p8:1345 fail_word(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_165_afterif - ; source: test_word_splitw_gte.p8:1348 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_167_else - ; source: test_word_splitw_gte.p8:1349 fail_word(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_splitw_gte.p8:1351 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_166_afterif - ; source: test_word_splitw_gte.p8:1354 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl28c - ; source: test_word_splitw_gte.p8:1356 goto skip28c - bra p8l_skip28c - ; source: test_word_splitw_gte.p8:1357 lbl28c: fail_word(141) -p8l_lbl28c - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1358 skip28c: -p8l_skip28c - ; source: test_word_splitw_gte.p8:1360 cx16.r3 = &lbl28d - lda #p8l_lbl28d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1361 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1363 goto skip28d - bra p8l_skip28d - ; source: test_word_splitw_gte.p8:1364 lbl28d: fail_word(142) -p8l_lbl28d - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1365 skip28d: -p8l_skip28d - ; source: test_word_splitw_gte.p8:1367 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_168_afterif - ; source: test_word_splitw_gte.p8:1368 fail_word(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_168_afterif - ; source: test_word_splitw_gte.p8:1371 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_170_else - ; source: test_word_splitw_gte.p8:1372 fail_word(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_splitw_gte.p8:1374 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_169_afterif - ; source: test_word_splitw_gte.p8:1376 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gte.p8:1377 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:1378 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1380 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_splitw_gte.p8:1382 goto skip29a - bra p8l_skip29a - ; source: test_word_splitw_gte.p8:1383 lbl29a: success++ -p8l_lbl29a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1384 skip29a: -p8l_skip29a - ; source: test_word_splitw_gte.p8:1386 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1387 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1389 goto skip29b - bra p8l_skip29b - ; source: test_word_splitw_gte.p8:1390 lbl29b: success++ -p8l_lbl29b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1391 skip29b: -p8l_skip29b - ; source: test_word_splitw_gte.p8:1393 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_171_afterif - ; source: test_word_splitw_gte.p8:1394 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_171_afterif - ; source: test_word_splitw_gte.p8:1397 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_173_else - ; source: test_word_splitw_gte.p8:1398 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_splitw_gte.p8:1400 cx16.r0L++ - inc cx16.r0L -label_asm_172_afterif - ; source: test_word_splitw_gte.p8:1403 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl29c - ; source: test_word_splitw_gte.p8:1405 goto skip29c - bra p8l_skip29c - ; source: test_word_splitw_gte.p8:1406 lbl29c: success++ -p8l_lbl29c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1407 skip29c: -p8l_skip29c - ; source: test_word_splitw_gte.p8:1409 cx16.r3 = &lbl29d - lda #p8l_lbl29d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1410 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1412 goto skip29d - bra p8l_skip29d - ; source: test_word_splitw_gte.p8:1413 lbl29d: success++ -p8l_lbl29d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1414 skip29d: -p8l_skip29d - ; source: test_word_splitw_gte.p8:1416 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_174_afterif - ; source: test_word_splitw_gte.p8:1417 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_174_afterif - ; source: test_word_splitw_gte.p8:1420 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_176_else - ; source: test_word_splitw_gte.p8:1421 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_splitw_gte.p8:1423 cx16.r0L++ - inc cx16.r0L -label_asm_175_afterif - ; source: test_word_splitw_gte.p8:1425 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1427 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_splitw_gte.p8:1429 goto skip30a - bra p8l_skip30a - ; source: test_word_splitw_gte.p8:1430 lbl30a: success++ -p8l_lbl30a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1431 skip30a: -p8l_skip30a - ; source: test_word_splitw_gte.p8:1433 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1434 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1436 goto skip30b - bra p8l_skip30b - ; source: test_word_splitw_gte.p8:1437 lbl30b: success++ -p8l_lbl30b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1438 skip30b: -p8l_skip30b - ; source: test_word_splitw_gte.p8:1440 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_177_afterif - ; source: test_word_splitw_gte.p8:1441 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_177_afterif - ; source: test_word_splitw_gte.p8:1444 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_179_else - ; source: test_word_splitw_gte.p8:1445 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_splitw_gte.p8:1447 cx16.r0L++ - inc cx16.r0L -label_asm_178_afterif - ; source: test_word_splitw_gte.p8:1450 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl30c - ; source: test_word_splitw_gte.p8:1452 goto skip30c - bra p8l_skip30c - ; source: test_word_splitw_gte.p8:1453 lbl30c: success++ -p8l_lbl30c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1454 skip30c: -p8l_skip30c - ; source: test_word_splitw_gte.p8:1456 cx16.r3 = &lbl30d - lda #p8l_lbl30d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1457 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1459 goto skip30d - bra p8l_skip30d - ; source: test_word_splitw_gte.p8:1460 lbl30d: success++ -p8l_lbl30d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1461 skip30d: -p8l_skip30d - ; source: test_word_splitw_gte.p8:1463 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_180_afterif - ; source: test_word_splitw_gte.p8:1464 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_180_afterif - ; source: test_word_splitw_gte.p8:1467 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_182_else - ; source: test_word_splitw_gte.p8:1468 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_splitw_gte.p8:1470 cx16.r0L++ - inc cx16.r0L -label_asm_181_afterif - ; source: test_word_splitw_gte.p8:1472 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1474 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_splitw_gte.p8:1476 goto skip31a - bra p8l_skip31a - ; source: test_word_splitw_gte.p8:1477 lbl31a: success++ -p8l_lbl31a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1478 skip31a: -p8l_skip31a - ; source: test_word_splitw_gte.p8:1480 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1481 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1483 goto skip31b - bra p8l_skip31b - ; source: test_word_splitw_gte.p8:1484 lbl31b: success++ -p8l_lbl31b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1485 skip31b: -p8l_skip31b - ; source: test_word_splitw_gte.p8:1487 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_183_afterif - ; source: test_word_splitw_gte.p8:1488 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_183_afterif - ; source: test_word_splitw_gte.p8:1491 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_185_else - ; source: test_word_splitw_gte.p8:1492 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_splitw_gte.p8:1494 cx16.r0L++ - inc cx16.r0L -label_asm_184_afterif - ; source: test_word_splitw_gte.p8:1497 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl31c - ; source: test_word_splitw_gte.p8:1499 goto skip31c - bra p8l_skip31c - ; source: test_word_splitw_gte.p8:1500 lbl31c: success++ -p8l_lbl31c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1501 skip31c: -p8l_skip31c - ; source: test_word_splitw_gte.p8:1503 cx16.r3 = &lbl31d - lda #p8l_lbl31d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1504 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1506 goto skip31d - bra p8l_skip31d - ; source: test_word_splitw_gte.p8:1507 lbl31d: success++ -p8l_lbl31d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1508 skip31d: -p8l_skip31d - ; source: test_word_splitw_gte.p8:1510 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_186_afterif - ; source: test_word_splitw_gte.p8:1511 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_186_afterif - ; source: test_word_splitw_gte.p8:1514 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_188_else - ; source: test_word_splitw_gte.p8:1515 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_splitw_gte.p8:1517 cx16.r0L++ - inc cx16.r0L -label_asm_187_afterif - ; source: test_word_splitw_gte.p8:1519 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1521 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_splitw_gte.p8:1523 goto skip32a - bra p8l_skip32a - ; source: test_word_splitw_gte.p8:1524 lbl32a: success++ -p8l_lbl32a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1525 skip32a: -p8l_skip32a - ; source: test_word_splitw_gte.p8:1527 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1528 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1530 goto skip32b - bra p8l_skip32b - ; source: test_word_splitw_gte.p8:1531 lbl32b: success++ -p8l_lbl32b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1532 skip32b: -p8l_skip32b - ; source: test_word_splitw_gte.p8:1534 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_189_afterif - ; source: test_word_splitw_gte.p8:1535 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_189_afterif - ; source: test_word_splitw_gte.p8:1538 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_191_else - ; source: test_word_splitw_gte.p8:1539 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_splitw_gte.p8:1541 cx16.r0L++ - inc cx16.r0L -label_asm_190_afterif - ; source: test_word_splitw_gte.p8:1544 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl32c - ; source: test_word_splitw_gte.p8:1546 goto skip32c - bra p8l_skip32c - ; source: test_word_splitw_gte.p8:1547 lbl32c: success++ -p8l_lbl32c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1548 skip32c: -p8l_skip32c - ; source: test_word_splitw_gte.p8:1550 cx16.r3 = &lbl32d - lda #p8l_lbl32d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1551 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1553 goto skip32d - bra p8l_skip32d - ; source: test_word_splitw_gte.p8:1554 lbl32d: success++ -p8l_lbl32d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1555 skip32d: -p8l_skip32d - ; source: test_word_splitw_gte.p8:1557 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_192_afterif - ; source: test_word_splitw_gte.p8:1558 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_192_afterif - ; source: test_word_splitw_gte.p8:1561 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_194_else - ; source: test_word_splitw_gte.p8:1562 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_splitw_gte.p8:1564 cx16.r0L++ - inc cx16.r0L -label_asm_193_afterif - ; source: test_word_splitw_gte.p8:1566 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1568 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_splitw_gte.p8:1570 goto skip33a - bra p8l_skip33a - ; source: test_word_splitw_gte.p8:1571 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1572 skip33a: -p8l_skip33a - ; source: test_word_splitw_gte.p8:1574 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1575 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1577 goto skip33b - bra p8l_skip33b - ; source: test_word_splitw_gte.p8:1578 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1579 skip33b: -p8l_skip33b - ; source: test_word_splitw_gte.p8:1581 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_195_afterif - ; source: test_word_splitw_gte.p8:1582 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_195_afterif - ; source: test_word_splitw_gte.p8:1585 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_197_else - ; source: test_word_splitw_gte.p8:1586 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_splitw_gte.p8:1588 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_word_splitw_gte.p8:1591 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl33c - ; source: test_word_splitw_gte.p8:1593 goto skip33c - bra p8l_skip33c - ; source: test_word_splitw_gte.p8:1594 lbl33c: success++ -p8l_lbl33c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1595 skip33c: -p8l_skip33c - ; source: test_word_splitw_gte.p8:1597 cx16.r3 = &lbl33d - lda #p8l_lbl33d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1598 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1600 goto skip33d - bra p8l_skip33d - ; source: test_word_splitw_gte.p8:1601 lbl33d: success++ -p8l_lbl33d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1602 skip33d: -p8l_skip33d - ; source: test_word_splitw_gte.p8:1604 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_198_afterif - ; source: test_word_splitw_gte.p8:1605 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_198_afterif - ; source: test_word_splitw_gte.p8:1608 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_200_else - ; source: test_word_splitw_gte.p8:1609 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_splitw_gte.p8:1611 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_word_splitw_gte.p8:1613 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1615 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_splitw_gte.p8:1617 goto skip34a - bra p8l_skip34a - ; source: test_word_splitw_gte.p8:1618 lbl34a: fail_word(145) -p8l_lbl34a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1619 skip34a: -p8l_skip34a - ; source: test_word_splitw_gte.p8:1621 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1622 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1624 goto skip34b - bra p8l_skip34b - ; source: test_word_splitw_gte.p8:1625 lbl34b: fail_word(146) -p8l_lbl34b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1626 skip34b: -p8l_skip34b - ; source: test_word_splitw_gte.p8:1628 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_201_afterif - ; source: test_word_splitw_gte.p8:1629 fail_word(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_201_afterif - ; source: test_word_splitw_gte.p8:1632 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_203_else - ; source: test_word_splitw_gte.p8:1633 fail_word(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_splitw_gte.p8:1635 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_202_afterif - ; source: test_word_splitw_gte.p8:1638 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl34c - ; source: test_word_splitw_gte.p8:1640 goto skip34c - bra p8l_skip34c - ; source: test_word_splitw_gte.p8:1641 lbl34c: fail_word(149) -p8l_lbl34c - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1642 skip34c: -p8l_skip34c - ; source: test_word_splitw_gte.p8:1644 cx16.r3 = &lbl34d - lda #p8l_lbl34d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1645 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1647 goto skip34d - bra p8l_skip34d - ; source: test_word_splitw_gte.p8:1648 lbl34d: fail_word(150) -p8l_lbl34d - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1649 skip34d: -p8l_skip34d - ; source: test_word_splitw_gte.p8:1651 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_204_afterif - ; source: test_word_splitw_gte.p8:1652 fail_word(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_204_afterif - ; source: test_word_splitw_gte.p8:1655 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_206_else - ; source: test_word_splitw_gte.p8:1656 fail_word(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_splitw_gte.p8:1658 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_205_afterif - ; source: test_word_splitw_gte.p8:1660 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1662 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_splitw_gte.p8:1664 goto skip35a - bra p8l_skip35a - ; source: test_word_splitw_gte.p8:1665 lbl35a: fail_word(153) -p8l_lbl35a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1666 skip35a: -p8l_skip35a - ; source: test_word_splitw_gte.p8:1668 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1669 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1671 goto skip35b - bra p8l_skip35b - ; source: test_word_splitw_gte.p8:1672 lbl35b: fail_word(154) -p8l_lbl35b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1673 skip35b: -p8l_skip35b - ; source: test_word_splitw_gte.p8:1675 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_207_afterif - ; source: test_word_splitw_gte.p8:1676 fail_word(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_207_afterif - ; source: test_word_splitw_gte.p8:1679 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_209_else - ; source: test_word_splitw_gte.p8:1680 fail_word(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_splitw_gte.p8:1682 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_208_afterif - ; source: test_word_splitw_gte.p8:1685 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl35c - ; source: test_word_splitw_gte.p8:1687 goto skip35c - bra p8l_skip35c - ; source: test_word_splitw_gte.p8:1688 lbl35c: fail_word(157) -p8l_lbl35c - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1689 skip35c: -p8l_skip35c - ; source: test_word_splitw_gte.p8:1691 cx16.r3 = &lbl35d - lda #p8l_lbl35d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1692 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1694 goto skip35d - bra p8l_skip35d - ; source: test_word_splitw_gte.p8:1695 lbl35d: fail_word(158) -p8l_lbl35d - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1696 skip35d: -p8l_skip35d - ; source: test_word_splitw_gte.p8:1698 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_210_afterif - ; source: test_word_splitw_gte.p8:1699 fail_word(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_210_afterif - ; source: test_word_splitw_gte.p8:1702 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_212_else - ; source: test_word_splitw_gte.p8:1703 fail_word(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_splitw_gte.p8:1705 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_211_afterif - ; source: test_word_splitw_gte.p8:1707 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gte.p8:1708 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:1709 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1711 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_splitw_gte.p8:1713 goto skip36a - bra p8l_skip36a - ; source: test_word_splitw_gte.p8:1714 lbl36a: success++ -p8l_lbl36a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1715 skip36a: -p8l_skip36a - ; source: test_word_splitw_gte.p8:1717 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1718 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1720 goto skip36b - bra p8l_skip36b - ; source: test_word_splitw_gte.p8:1721 lbl36b: success++ -p8l_lbl36b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1722 skip36b: -p8l_skip36b - ; source: test_word_splitw_gte.p8:1724 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_213_afterif - ; source: test_word_splitw_gte.p8:1725 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_213_afterif - ; source: test_word_splitw_gte.p8:1728 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_215_else - ; source: test_word_splitw_gte.p8:1729 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_splitw_gte.p8:1731 cx16.r0L++ - inc cx16.r0L -label_asm_214_afterif - ; source: test_word_splitw_gte.p8:1734 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl36c - ; source: test_word_splitw_gte.p8:1736 goto skip36c - bra p8l_skip36c - ; source: test_word_splitw_gte.p8:1737 lbl36c: success++ -p8l_lbl36c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1738 skip36c: -p8l_skip36c - ; source: test_word_splitw_gte.p8:1740 cx16.r3 = &lbl36d - lda #p8l_lbl36d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1741 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1743 goto skip36d - bra p8l_skip36d - ; source: test_word_splitw_gte.p8:1744 lbl36d: success++ -p8l_lbl36d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1745 skip36d: -p8l_skip36d - ; source: test_word_splitw_gte.p8:1747 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_216_afterif - ; source: test_word_splitw_gte.p8:1748 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_216_afterif - ; source: test_word_splitw_gte.p8:1751 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_218_else - ; source: test_word_splitw_gte.p8:1752 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_splitw_gte.p8:1754 cx16.r0L++ - inc cx16.r0L -label_asm_217_afterif - ; source: test_word_splitw_gte.p8:1756 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1758 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_splitw_gte.p8:1760 goto skip37a - bra p8l_skip37a - ; source: test_word_splitw_gte.p8:1761 lbl37a: success++ -p8l_lbl37a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1762 skip37a: -p8l_skip37a - ; source: test_word_splitw_gte.p8:1764 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1765 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1767 goto skip37b - bra p8l_skip37b - ; source: test_word_splitw_gte.p8:1768 lbl37b: success++ -p8l_lbl37b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1769 skip37b: -p8l_skip37b - ; source: test_word_splitw_gte.p8:1771 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_219_afterif - ; source: test_word_splitw_gte.p8:1772 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_219_afterif - ; source: test_word_splitw_gte.p8:1775 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_221_else - ; source: test_word_splitw_gte.p8:1776 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_splitw_gte.p8:1778 cx16.r0L++ - inc cx16.r0L -label_asm_220_afterif - ; source: test_word_splitw_gte.p8:1781 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl37c - ; source: test_word_splitw_gte.p8:1783 goto skip37c - bra p8l_skip37c - ; source: test_word_splitw_gte.p8:1784 lbl37c: success++ -p8l_lbl37c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1785 skip37c: -p8l_skip37c - ; source: test_word_splitw_gte.p8:1787 cx16.r3 = &lbl37d - lda #p8l_lbl37d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1788 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1790 goto skip37d - bra p8l_skip37d - ; source: test_word_splitw_gte.p8:1791 lbl37d: success++ -p8l_lbl37d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1792 skip37d: -p8l_skip37d - ; source: test_word_splitw_gte.p8:1794 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_222_afterif - ; source: test_word_splitw_gte.p8:1795 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_222_afterif - ; source: test_word_splitw_gte.p8:1798 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_224_else - ; source: test_word_splitw_gte.p8:1799 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_splitw_gte.p8:1801 cx16.r0L++ - inc cx16.r0L -label_asm_223_afterif - ; source: test_word_splitw_gte.p8:1803 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1805 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_splitw_gte.p8:1807 goto skip38a - bra p8l_skip38a - ; source: test_word_splitw_gte.p8:1808 lbl38a: success++ -p8l_lbl38a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1809 skip38a: -p8l_skip38a - ; source: test_word_splitw_gte.p8:1811 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1812 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1814 goto skip38b - bra p8l_skip38b - ; source: test_word_splitw_gte.p8:1815 lbl38b: success++ -p8l_lbl38b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1816 skip38b: -p8l_skip38b - ; source: test_word_splitw_gte.p8:1818 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_225_afterif - ; source: test_word_splitw_gte.p8:1819 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_225_afterif - ; source: test_word_splitw_gte.p8:1822 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_227_else - ; source: test_word_splitw_gte.p8:1823 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_splitw_gte.p8:1825 cx16.r0L++ - inc cx16.r0L -label_asm_226_afterif - ; source: test_word_splitw_gte.p8:1828 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl38c - ; source: test_word_splitw_gte.p8:1830 goto skip38c - bra p8l_skip38c - ; source: test_word_splitw_gte.p8:1831 lbl38c: success++ -p8l_lbl38c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1832 skip38c: -p8l_skip38c - ; source: test_word_splitw_gte.p8:1834 cx16.r3 = &lbl38d - lda #p8l_lbl38d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1835 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1837 goto skip38d - bra p8l_skip38d - ; source: test_word_splitw_gte.p8:1838 lbl38d: success++ -p8l_lbl38d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1839 skip38d: -p8l_skip38d - ; source: test_word_splitw_gte.p8:1841 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_228_afterif - ; source: test_word_splitw_gte.p8:1842 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_228_afterif - ; source: test_word_splitw_gte.p8:1845 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_230_else - ; source: test_word_splitw_gte.p8:1846 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_splitw_gte.p8:1848 cx16.r0L++ - inc cx16.r0L -label_asm_229_afterif - ; source: test_word_splitw_gte.p8:1850 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1852 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_splitw_gte.p8:1854 goto skip39a - bra p8l_skip39a - ; source: test_word_splitw_gte.p8:1855 lbl39a: success++ -p8l_lbl39a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1856 skip39a: -p8l_skip39a - ; source: test_word_splitw_gte.p8:1858 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1859 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1861 goto skip39b - bra p8l_skip39b - ; source: test_word_splitw_gte.p8:1862 lbl39b: success++ -p8l_lbl39b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1863 skip39b: -p8l_skip39b - ; source: test_word_splitw_gte.p8:1865 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_231_afterif - ; source: test_word_splitw_gte.p8:1866 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_231_afterif - ; source: test_word_splitw_gte.p8:1869 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_233_else - ; source: test_word_splitw_gte.p8:1870 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_splitw_gte.p8:1872 cx16.r0L++ - inc cx16.r0L -label_asm_232_afterif - ; source: test_word_splitw_gte.p8:1875 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl39c - ; source: test_word_splitw_gte.p8:1877 goto skip39c - bra p8l_skip39c - ; source: test_word_splitw_gte.p8:1878 lbl39c: success++ -p8l_lbl39c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1879 skip39c: -p8l_skip39c - ; source: test_word_splitw_gte.p8:1881 cx16.r3 = &lbl39d - lda #p8l_lbl39d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1882 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1884 goto skip39d - bra p8l_skip39d - ; source: test_word_splitw_gte.p8:1885 lbl39d: success++ -p8l_lbl39d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1886 skip39d: -p8l_skip39d - ; source: test_word_splitw_gte.p8:1888 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_234_afterif - ; source: test_word_splitw_gte.p8:1889 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_234_afterif - ; source: test_word_splitw_gte.p8:1892 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_236_else - ; source: test_word_splitw_gte.p8:1893 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_splitw_gte.p8:1895 cx16.r0L++ - inc cx16.r0L -label_asm_235_afterif - ; source: test_word_splitw_gte.p8:1897 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1899 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_splitw_gte.p8:1901 goto skip40a - bra p8l_skip40a - ; source: test_word_splitw_gte.p8:1902 lbl40a: success++ -p8l_lbl40a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1903 skip40a: -p8l_skip40a - ; source: test_word_splitw_gte.p8:1905 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1906 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1908 goto skip40b - bra p8l_skip40b - ; source: test_word_splitw_gte.p8:1909 lbl40b: success++ -p8l_lbl40b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1910 skip40b: -p8l_skip40b - ; source: test_word_splitw_gte.p8:1912 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_237_afterif - ; source: test_word_splitw_gte.p8:1913 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_237_afterif - ; source: test_word_splitw_gte.p8:1916 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_239_else - ; source: test_word_splitw_gte.p8:1917 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_splitw_gte.p8:1919 cx16.r0L++ - inc cx16.r0L -label_asm_238_afterif - ; source: test_word_splitw_gte.p8:1922 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl40c - ; source: test_word_splitw_gte.p8:1924 goto skip40c - bra p8l_skip40c - ; source: test_word_splitw_gte.p8:1925 lbl40c: success++ -p8l_lbl40c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1926 skip40c: -p8l_skip40c - ; source: test_word_splitw_gte.p8:1928 cx16.r3 = &lbl40d - lda #p8l_lbl40d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1929 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1931 goto skip40d - bra p8l_skip40d - ; source: test_word_splitw_gte.p8:1932 lbl40d: success++ -p8l_lbl40d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1933 skip40d: -p8l_skip40d - ; source: test_word_splitw_gte.p8:1935 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_240_afterif - ; source: test_word_splitw_gte.p8:1936 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_240_afterif - ; source: test_word_splitw_gte.p8:1939 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_242_else - ; source: test_word_splitw_gte.p8:1940 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_splitw_gte.p8:1942 cx16.r0L++ - inc cx16.r0L -label_asm_241_afterif - ; source: test_word_splitw_gte.p8:1944 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1946 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_splitw_gte.p8:1948 goto skip41a - bra p8l_skip41a - ; source: test_word_splitw_gte.p8:1949 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1950 skip41a: -p8l_skip41a - ; source: test_word_splitw_gte.p8:1952 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1953 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1955 goto skip41b - bra p8l_skip41b - ; source: test_word_splitw_gte.p8:1956 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1957 skip41b: -p8l_skip41b - ; source: test_word_splitw_gte.p8:1959 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_243_afterif - ; source: test_word_splitw_gte.p8:1960 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_243_afterif - ; source: test_word_splitw_gte.p8:1963 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_245_else - ; source: test_word_splitw_gte.p8:1964 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_splitw_gte.p8:1966 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_word_splitw_gte.p8:1969 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl41c - ; source: test_word_splitw_gte.p8:1971 goto skip41c - bra p8l_skip41c - ; source: test_word_splitw_gte.p8:1972 lbl41c: success++ -p8l_lbl41c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1973 skip41c: -p8l_skip41c - ; source: test_word_splitw_gte.p8:1975 cx16.r3 = &lbl41d - lda #p8l_lbl41d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:1976 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:1978 goto skip41d - bra p8l_skip41d - ; source: test_word_splitw_gte.p8:1979 lbl41d: success++ -p8l_lbl41d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:1980 skip41d: -p8l_skip41d - ; source: test_word_splitw_gte.p8:1982 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_246_afterif - ; source: test_word_splitw_gte.p8:1983 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_246_afterif - ; source: test_word_splitw_gte.p8:1986 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_248_else - ; source: test_word_splitw_gte.p8:1987 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_splitw_gte.p8:1989 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_word_splitw_gte.p8:1991 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:1993 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_splitw_gte.p8:1995 goto skip42a - bra p8l_skip42a - ; source: test_word_splitw_gte.p8:1996 lbl42a: fail_word(161) -p8l_lbl42a - ldy #>$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:1997 skip42a: -p8l_skip42a - ; source: test_word_splitw_gte.p8:1999 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2000 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2002 goto skip42b - bra p8l_skip42b - ; source: test_word_splitw_gte.p8:2003 lbl42b: fail_word(162) -p8l_lbl42b - ldy #>$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:2004 skip42b: -p8l_skip42b - ; source: test_word_splitw_gte.p8:2006 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_249_afterif - ; source: test_word_splitw_gte.p8:2007 fail_word(163) - ldy #>$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_249_afterif - ; source: test_word_splitw_gte.p8:2010 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_251_else - ; source: test_word_splitw_gte.p8:2011 fail_word(164) - ldy #>$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_splitw_gte.p8:2013 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_250_afterif - ; source: test_word_splitw_gte.p8:2016 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl42c - ; source: test_word_splitw_gte.p8:2018 goto skip42c - bra p8l_skip42c - ; source: test_word_splitw_gte.p8:2019 lbl42c: fail_word(165) -p8l_lbl42c - ldy #>$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:2020 skip42c: -p8l_skip42c - ; source: test_word_splitw_gte.p8:2022 cx16.r3 = &lbl42d - lda #p8l_lbl42d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2023 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2025 goto skip42d - bra p8l_skip42d - ; source: test_word_splitw_gte.p8:2026 lbl42d: fail_word(166) -p8l_lbl42d - ldy #>$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_gte.p8:2027 skip42d: -p8l_skip42d - ; source: test_word_splitw_gte.p8:2029 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_252_afterif - ; source: test_word_splitw_gte.p8:2030 fail_word(167) - ldy #>$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_252_afterif - ; source: test_word_splitw_gte.p8:2033 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_254_else - ; source: test_word_splitw_gte.p8:2034 fail_word(168) - ldy #>$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_splitw_gte.p8:2036 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_253_afterif - ; source: test_word_splitw_gte.p8:2038 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_gte.p8:2039 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_gte.p8:2040 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2042 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_splitw_gte.p8:2044 goto skip43a - bra p8l_skip43a - ; source: test_word_splitw_gte.p8:2045 lbl43a: success++ -p8l_lbl43a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2046 skip43a: -p8l_skip43a - ; source: test_word_splitw_gte.p8:2048 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2049 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2051 goto skip43b - bra p8l_skip43b - ; source: test_word_splitw_gte.p8:2052 lbl43b: success++ -p8l_lbl43b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2053 skip43b: -p8l_skip43b - ; source: test_word_splitw_gte.p8:2055 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_255_afterif - ; source: test_word_splitw_gte.p8:2056 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_255_afterif - ; source: test_word_splitw_gte.p8:2059 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_257_else - ; source: test_word_splitw_gte.p8:2060 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_splitw_gte.p8:2062 cx16.r0L++ - inc cx16.r0L -label_asm_256_afterif - ; source: test_word_splitw_gte.p8:2065 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl43c - ; source: test_word_splitw_gte.p8:2067 goto skip43c - bra p8l_skip43c - ; source: test_word_splitw_gte.p8:2068 lbl43c: success++ -p8l_lbl43c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2069 skip43c: -p8l_skip43c - ; source: test_word_splitw_gte.p8:2071 cx16.r3 = &lbl43d - lda #p8l_lbl43d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2072 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2074 goto skip43d - bra p8l_skip43d - ; source: test_word_splitw_gte.p8:2075 lbl43d: success++ -p8l_lbl43d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2076 skip43d: -p8l_skip43d - ; source: test_word_splitw_gte.p8:2078 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_258_afterif - ; source: test_word_splitw_gte.p8:2079 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_258_afterif - ; source: test_word_splitw_gte.p8:2082 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_260_else - ; source: test_word_splitw_gte.p8:2083 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_splitw_gte.p8:2085 cx16.r0L++ - inc cx16.r0L -label_asm_259_afterif - ; source: test_word_splitw_gte.p8:2087 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2089 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_splitw_gte.p8:2091 goto skip44a - bra p8l_skip44a - ; source: test_word_splitw_gte.p8:2092 lbl44a: success++ -p8l_lbl44a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2093 skip44a: -p8l_skip44a - ; source: test_word_splitw_gte.p8:2095 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2096 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2098 goto skip44b - bra p8l_skip44b - ; source: test_word_splitw_gte.p8:2099 lbl44b: success++ -p8l_lbl44b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2100 skip44b: -p8l_skip44b - ; source: test_word_splitw_gte.p8:2102 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_261_afterif - ; source: test_word_splitw_gte.p8:2103 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_261_afterif - ; source: test_word_splitw_gte.p8:2106 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_263_else - ; source: test_word_splitw_gte.p8:2107 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_splitw_gte.p8:2109 cx16.r0L++ - inc cx16.r0L -label_asm_262_afterif - ; source: test_word_splitw_gte.p8:2112 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl44c - ; source: test_word_splitw_gte.p8:2114 goto skip44c - bra p8l_skip44c - ; source: test_word_splitw_gte.p8:2115 lbl44c: success++ -p8l_lbl44c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2116 skip44c: -p8l_skip44c - ; source: test_word_splitw_gte.p8:2118 cx16.r3 = &lbl44d - lda #p8l_lbl44d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2119 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2121 goto skip44d - bra p8l_skip44d - ; source: test_word_splitw_gte.p8:2122 lbl44d: success++ -p8l_lbl44d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2123 skip44d: -p8l_skip44d - ; source: test_word_splitw_gte.p8:2125 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_264_afterif - ; source: test_word_splitw_gte.p8:2126 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_264_afterif - ; source: test_word_splitw_gte.p8:2129 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_266_else - ; source: test_word_splitw_gte.p8:2130 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_splitw_gte.p8:2132 cx16.r0L++ - inc cx16.r0L -label_asm_265_afterif - ; source: test_word_splitw_gte.p8:2134 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2136 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_splitw_gte.p8:2138 goto skip45a - bra p8l_skip45a - ; source: test_word_splitw_gte.p8:2139 lbl45a: success++ -p8l_lbl45a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2140 skip45a: -p8l_skip45a - ; source: test_word_splitw_gte.p8:2142 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2143 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2145 goto skip45b - bra p8l_skip45b - ; source: test_word_splitw_gte.p8:2146 lbl45b: success++ -p8l_lbl45b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2147 skip45b: -p8l_skip45b - ; source: test_word_splitw_gte.p8:2149 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_267_afterif - ; source: test_word_splitw_gte.p8:2150 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_267_afterif - ; source: test_word_splitw_gte.p8:2153 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_269_else - ; source: test_word_splitw_gte.p8:2154 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_splitw_gte.p8:2156 cx16.r0L++ - inc cx16.r0L -label_asm_268_afterif - ; source: test_word_splitw_gte.p8:2159 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl45c - ; source: test_word_splitw_gte.p8:2161 goto skip45c - bra p8l_skip45c - ; source: test_word_splitw_gte.p8:2162 lbl45c: success++ -p8l_lbl45c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2163 skip45c: -p8l_skip45c - ; source: test_word_splitw_gte.p8:2165 cx16.r3 = &lbl45d - lda #p8l_lbl45d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2166 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2168 goto skip45d - bra p8l_skip45d - ; source: test_word_splitw_gte.p8:2169 lbl45d: success++ -p8l_lbl45d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2170 skip45d: -p8l_skip45d - ; source: test_word_splitw_gte.p8:2172 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_270_afterif - ; source: test_word_splitw_gte.p8:2173 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_270_afterif - ; source: test_word_splitw_gte.p8:2176 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_272_else - ; source: test_word_splitw_gte.p8:2177 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_splitw_gte.p8:2179 cx16.r0L++ - inc cx16.r0L -label_asm_271_afterif - ; source: test_word_splitw_gte.p8:2181 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2183 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_splitw_gte.p8:2185 goto skip46a - bra p8l_skip46a - ; source: test_word_splitw_gte.p8:2186 lbl46a: success++ -p8l_lbl46a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2187 skip46a: -p8l_skip46a - ; source: test_word_splitw_gte.p8:2189 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2190 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2192 goto skip46b - bra p8l_skip46b - ; source: test_word_splitw_gte.p8:2193 lbl46b: success++ -p8l_lbl46b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2194 skip46b: -p8l_skip46b - ; source: test_word_splitw_gte.p8:2196 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_273_afterif - ; source: test_word_splitw_gte.p8:2197 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_273_afterif - ; source: test_word_splitw_gte.p8:2200 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_275_else - ; source: test_word_splitw_gte.p8:2201 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_splitw_gte.p8:2203 cx16.r0L++ - inc cx16.r0L -label_asm_274_afterif - ; source: test_word_splitw_gte.p8:2206 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl46c - ; source: test_word_splitw_gte.p8:2208 goto skip46c - bra p8l_skip46c - ; source: test_word_splitw_gte.p8:2209 lbl46c: success++ -p8l_lbl46c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2210 skip46c: -p8l_skip46c - ; source: test_word_splitw_gte.p8:2212 cx16.r3 = &lbl46d - lda #p8l_lbl46d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2213 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2215 goto skip46d - bra p8l_skip46d - ; source: test_word_splitw_gte.p8:2216 lbl46d: success++ -p8l_lbl46d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2217 skip46d: -p8l_skip46d - ; source: test_word_splitw_gte.p8:2219 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_276_afterif - ; source: test_word_splitw_gte.p8:2220 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_276_afterif - ; source: test_word_splitw_gte.p8:2223 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_278_else - ; source: test_word_splitw_gte.p8:2224 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_splitw_gte.p8:2226 cx16.r0L++ - inc cx16.r0L -label_asm_277_afterif - ; source: test_word_splitw_gte.p8:2228 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2230 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_splitw_gte.p8:2232 goto skip47a - bra p8l_skip47a - ; source: test_word_splitw_gte.p8:2233 lbl47a: success++ -p8l_lbl47a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2234 skip47a: -p8l_skip47a - ; source: test_word_splitw_gte.p8:2236 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2237 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2239 goto skip47b - bra p8l_skip47b - ; source: test_word_splitw_gte.p8:2240 lbl47b: success++ -p8l_lbl47b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2241 skip47b: -p8l_skip47b - ; source: test_word_splitw_gte.p8:2243 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_279_afterif - ; source: test_word_splitw_gte.p8:2244 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_279_afterif - ; source: test_word_splitw_gte.p8:2247 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_281_else - ; source: test_word_splitw_gte.p8:2248 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_splitw_gte.p8:2250 cx16.r0L++ - inc cx16.r0L -label_asm_280_afterif - ; source: test_word_splitw_gte.p8:2253 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl47c - ; source: test_word_splitw_gte.p8:2255 goto skip47c - bra p8l_skip47c - ; source: test_word_splitw_gte.p8:2256 lbl47c: success++ -p8l_lbl47c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2257 skip47c: -p8l_skip47c - ; source: test_word_splitw_gte.p8:2259 cx16.r3 = &lbl47d - lda #p8l_lbl47d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2260 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2262 goto skip47d - bra p8l_skip47d - ; source: test_word_splitw_gte.p8:2263 lbl47d: success++ -p8l_lbl47d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2264 skip47d: -p8l_skip47d - ; source: test_word_splitw_gte.p8:2266 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_282_afterif - ; source: test_word_splitw_gte.p8:2267 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_282_afterif - ; source: test_word_splitw_gte.p8:2270 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_284_else - ; source: test_word_splitw_gte.p8:2271 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_splitw_gte.p8:2273 cx16.r0L++ - inc cx16.r0L -label_asm_283_afterif - ; source: test_word_splitw_gte.p8:2275 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2277 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_splitw_gte.p8:2279 goto skip48a - bra p8l_skip48a - ; source: test_word_splitw_gte.p8:2280 lbl48a: success++ -p8l_lbl48a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2281 skip48a: -p8l_skip48a - ; source: test_word_splitw_gte.p8:2283 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2284 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2286 goto skip48b - bra p8l_skip48b - ; source: test_word_splitw_gte.p8:2287 lbl48b: success++ -p8l_lbl48b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2288 skip48b: -p8l_skip48b - ; source: test_word_splitw_gte.p8:2290 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_285_afterif - ; source: test_word_splitw_gte.p8:2291 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_285_afterif - ; source: test_word_splitw_gte.p8:2294 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_287_else - ; source: test_word_splitw_gte.p8:2295 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_splitw_gte.p8:2297 cx16.r0L++ - inc cx16.r0L -label_asm_286_afterif - ; source: test_word_splitw_gte.p8:2300 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl48c - ; source: test_word_splitw_gte.p8:2302 goto skip48c - bra p8l_skip48c - ; source: test_word_splitw_gte.p8:2303 lbl48c: success++ -p8l_lbl48c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2304 skip48c: -p8l_skip48c - ; source: test_word_splitw_gte.p8:2306 cx16.r3 = &lbl48d - lda #p8l_lbl48d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2307 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2309 goto skip48d - bra p8l_skip48d - ; source: test_word_splitw_gte.p8:2310 lbl48d: success++ -p8l_lbl48d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2311 skip48d: -p8l_skip48d - ; source: test_word_splitw_gte.p8:2313 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_288_afterif - ; source: test_word_splitw_gte.p8:2314 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_288_afterif - ; source: test_word_splitw_gte.p8:2317 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_290_else - ; source: test_word_splitw_gte.p8:2318 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_splitw_gte.p8:2320 cx16.r0L++ - inc cx16.r0L -label_asm_289_afterif - ; source: test_word_splitw_gte.p8:2322 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_gte.p8:2324 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_splitw_gte.p8:2326 goto skip49a - bra p8l_skip49a - ; source: test_word_splitw_gte.p8:2327 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2328 skip49a: -p8l_skip49a - ; source: test_word_splitw_gte.p8:2330 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2331 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2333 goto skip49b - bra p8l_skip49b - ; source: test_word_splitw_gte.p8:2334 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2335 skip49b: -p8l_skip49b - ; source: test_word_splitw_gte.p8:2337 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_291_afterif - ; source: test_word_splitw_gte.p8:2338 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_291_afterif - ; source: test_word_splitw_gte.p8:2341 if x>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy p8v_x+1 - lda p8v_x - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_293_else - ; source: test_word_splitw_gte.p8:2342 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_splitw_gte.p8:2344 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_word_splitw_gte.p8:2347 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl49c - ; source: test_word_splitw_gte.p8:2349 goto skip49c - bra p8l_skip49c - ; source: test_word_splitw_gte.p8:2350 lbl49c: success++ -p8l_lbl49c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2351 skip49c: -p8l_skip49c - ; source: test_word_splitw_gte.p8:2353 cx16.r3 = &lbl49d - lda #p8l_lbl49d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_gte.p8:2354 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_gte.p8:2356 goto skip49d - bra p8l_skip49d - ; source: test_word_splitw_gte.p8:2357 lbl49d: success++ -p8l_lbl49d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_gte.p8:2358 skip49d: -p8l_skip49d - ; source: test_word_splitw_gte.p8:2360 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_294_afterif - ; source: test_word_splitw_gte.p8:2361 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_294_afterif - ; source: test_word_splitw_gte.p8:2364 if sources[1]>=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_296_else - ; source: test_word_splitw_gte.p8:2365 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_splitw_gte.p8:2367 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_word_splitw_gte.p8:2369 verify_success(266) - ldy #>$010a - lda #<$010a - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_gte.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\ngreater-equal split words array tests for: " - .byte $0d, $47, $52, $45, $41, $54, $45, $52, $2d, $45, $51, $55, $41, $4c, $20, $53 - .byte $50, $4c, $49, $54, $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59 - .byte $20, $54, $45, $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n>=array[]: " - .byte $0d, $3e, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_4 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_5 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_6 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_7 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 - - ; source: test_word_splitw_gte.p8:14 txt.print("\ngreater-equal split words array tests for: ") - ; source: test_word_splitw_gte.p8:18 txt.print("\n>=array[]: ") - ; source: test_word_splitw_gte.p8:27 txt.print(" **failed** ") - ; source: test_word_splitw_gte.p8:29 txt.print(" success, expected ") - ; source: test_word_splitw_gte.p8:35 txt.print(" **fail#") - ; source: test_word_splitw_gte.p8:37 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_splitw_gte.p8 b/compiler/test/comparisons/test_word_splitw_gte.p8 deleted file mode 100644 index 3bd931fbb..000000000 --- a/compiler/test/comparisons/test_word_splitw_gte.p8 +++ /dev/null @@ -1,2373 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\ngreater-equal split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n>=array[]: ") - test_cmp_array() - test_stack.test() - } - - sub verify_success(uword expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_uw(success) - txt.print(" success, expected ") - txt.print_uw(expected) - } - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_array() { - word @shared x - word[] @split values = [0, 0] - word[] @split sources = [0, 0] - success = 0 - x=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x>=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]>=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl2a - goto skip2a -lbl2a: fail_word(1) -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x>=values[1] - goto cx16.r3 - goto skip2b -lbl2b: fail_word(2) -skip2b: - ; no else - if x>=values[1] - fail_word(3) - - ; with else - if x>=values[1] - fail_word(4) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl2c - goto skip2c -lbl2c: fail_word(5) -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]>=values[1] - goto cx16.r3 - goto skip2d -lbl2d: fail_word(6) -skip2d: - ; no else - if sources[1]>=values[1] - fail_word(7) - - ; with else - if sources[1]>=values[1] - fail_word(8) - else - success++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl3a - goto skip3a -lbl3a: fail_word(9) -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x>=values[1] - goto cx16.r3 - goto skip3b -lbl3b: fail_word(10) -skip3b: - ; no else - if x>=values[1] - fail_word(11) - - ; with else - if x>=values[1] - fail_word(12) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl3c - goto skip3c -lbl3c: fail_word(13) -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]>=values[1] - goto cx16.r3 - goto skip3d -lbl3d: fail_word(14) -skip3d: - ; no else - if sources[1]>=values[1] - fail_word(15) - - ; with else - if sources[1]>=values[1] - fail_word(16) - else - success++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl4a - goto skip4a -lbl4a: fail_word(17) -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x>=values[1] - goto cx16.r3 - goto skip4b -lbl4b: fail_word(18) -skip4b: - ; no else - if x>=values[1] - fail_word(19) - - ; with else - if x>=values[1] - fail_word(20) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl4c - goto skip4c -lbl4c: fail_word(21) -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]>=values[1] - goto cx16.r3 - goto skip4d -lbl4d: fail_word(22) -skip4d: - ; no else - if sources[1]>=values[1] - fail_word(23) - - ; with else - if sources[1]>=values[1] - fail_word(24) - else - success++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl5a - goto skip5a -lbl5a: fail_word(25) -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x>=values[1] - goto cx16.r3 - goto skip5b -lbl5b: fail_word(26) -skip5b: - ; no else - if x>=values[1] - fail_word(27) - - ; with else - if x>=values[1] - fail_word(28) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl5c - goto skip5c -lbl5c: fail_word(29) -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]>=values[1] - goto cx16.r3 - goto skip5d -lbl5d: fail_word(30) -skip5d: - ; no else - if sources[1]>=values[1] - fail_word(31) - - ; with else - if sources[1]>=values[1] - fail_word(32) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl6a - goto skip6a -lbl6a: fail_word(33) -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x>=values[1] - goto cx16.r3 - goto skip6b -lbl6b: fail_word(34) -skip6b: - ; no else - if x>=values[1] - fail_word(35) - - ; with else - if x>=values[1] - fail_word(36) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl6c - goto skip6c -lbl6c: fail_word(37) -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]>=values[1] - goto cx16.r3 - goto skip6d -lbl6d: fail_word(38) -skip6d: - ; no else - if sources[1]>=values[1] - fail_word(39) - - ; with else - if sources[1]>=values[1] - fail_word(40) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl7a - goto skip7a -lbl7a: fail_word(41) -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x>=values[1] - goto cx16.r3 - goto skip7b -lbl7b: fail_word(42) -skip7b: - ; no else - if x>=values[1] - fail_word(43) - - ; with else - if x>=values[1] - fail_word(44) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl7c - goto skip7c -lbl7c: fail_word(45) -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]>=values[1] - goto cx16.r3 - goto skip7d -lbl7d: fail_word(46) -skip7d: - ; no else - if sources[1]>=values[1] - fail_word(47) - - ; with else - if sources[1]>=values[1] - fail_word(48) - else - success++ - - x=-1 - sources[1]=-1 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl8a - goto skip8a -lbl8a: success++ -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x>=values[1] - goto cx16.r3 - goto skip8b -lbl8b: success++ -skip8b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl8c - goto skip8c -lbl8c: success++ -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]>=values[1] - goto cx16.r3 - goto skip8d -lbl8d: success++ -skip8d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x>=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]>=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl10a - goto skip10a -lbl10a: fail_word(49) -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x>=values[1] - goto cx16.r3 - goto skip10b -lbl10b: fail_word(50) -skip10b: - ; no else - if x>=values[1] - fail_word(51) - - ; with else - if x>=values[1] - fail_word(52) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl10c - goto skip10c -lbl10c: fail_word(53) -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]>=values[1] - goto cx16.r3 - goto skip10d -lbl10d: fail_word(54) -skip10d: - ; no else - if sources[1]>=values[1] - fail_word(55) - - ; with else - if sources[1]>=values[1] - fail_word(56) - else - success++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl11a - goto skip11a -lbl11a: fail_word(57) -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x>=values[1] - goto cx16.r3 - goto skip11b -lbl11b: fail_word(58) -skip11b: - ; no else - if x>=values[1] - fail_word(59) - - ; with else - if x>=values[1] - fail_word(60) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl11c - goto skip11c -lbl11c: fail_word(61) -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]>=values[1] - goto cx16.r3 - goto skip11d -lbl11d: fail_word(62) -skip11d: - ; no else - if sources[1]>=values[1] - fail_word(63) - - ; with else - if sources[1]>=values[1] - fail_word(64) - else - success++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl12a - goto skip12a -lbl12a: fail_word(65) -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x>=values[1] - goto cx16.r3 - goto skip12b -lbl12b: fail_word(66) -skip12b: - ; no else - if x>=values[1] - fail_word(67) - - ; with else - if x>=values[1] - fail_word(68) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl12c - goto skip12c -lbl12c: fail_word(69) -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]>=values[1] - goto cx16.r3 - goto skip12d -lbl12d: fail_word(70) -skip12d: - ; no else - if sources[1]>=values[1] - fail_word(71) - - ; with else - if sources[1]>=values[1] - fail_word(72) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl13a - goto skip13a -lbl13a: fail_word(73) -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x>=values[1] - goto cx16.r3 - goto skip13b -lbl13b: fail_word(74) -skip13b: - ; no else - if x>=values[1] - fail_word(75) - - ; with else - if x>=values[1] - fail_word(76) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl13c - goto skip13c -lbl13c: fail_word(77) -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]>=values[1] - goto cx16.r3 - goto skip13d -lbl13d: fail_word(78) -skip13d: - ; no else - if sources[1]>=values[1] - fail_word(79) - - ; with else - if sources[1]>=values[1] - fail_word(80) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl14a - goto skip14a -lbl14a: fail_word(81) -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x>=values[1] - goto cx16.r3 - goto skip14b -lbl14b: fail_word(82) -skip14b: - ; no else - if x>=values[1] - fail_word(83) - - ; with else - if x>=values[1] - fail_word(84) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl14c - goto skip14c -lbl14c: fail_word(85) -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]>=values[1] - goto cx16.r3 - goto skip14d -lbl14d: fail_word(86) -skip14d: - ; no else - if sources[1]>=values[1] - fail_word(87) - - ; with else - if sources[1]>=values[1] - fail_word(88) - else - success++ - - x=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl15a - goto skip15a -lbl15a: success++ -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x>=values[1] - goto cx16.r3 - goto skip15b -lbl15b: success++ -skip15b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl15c - goto skip15c -lbl15c: success++ -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]>=values[1] - goto cx16.r3 - goto skip15d -lbl15d: success++ -skip15d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl16a - goto skip16a -lbl16a: success++ -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x>=values[1] - goto cx16.r3 - goto skip16b -lbl16b: success++ -skip16b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl16c - goto skip16c -lbl16c: success++ -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]>=values[1] - goto cx16.r3 - goto skip16d -lbl16d: success++ -skip16d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x>=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl17c - goto skip17c -lbl17c: success++ -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]>=values[1] - goto cx16.r3 - goto skip17d -lbl17d: success++ -skip17d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl18a - goto skip18a -lbl18a: fail_word(89) -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x>=values[1] - goto cx16.r3 - goto skip18b -lbl18b: fail_word(90) -skip18b: - ; no else - if x>=values[1] - fail_word(91) - - ; with else - if x>=values[1] - fail_word(92) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl18c - goto skip18c -lbl18c: fail_word(93) -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]>=values[1] - goto cx16.r3 - goto skip18d -lbl18d: fail_word(94) -skip18d: - ; no else - if sources[1]>=values[1] - fail_word(95) - - ; with else - if sources[1]>=values[1] - fail_word(96) - else - success++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl19a - goto skip19a -lbl19a: fail_word(97) -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x>=values[1] - goto cx16.r3 - goto skip19b -lbl19b: fail_word(98) -skip19b: - ; no else - if x>=values[1] - fail_word(99) - - ; with else - if x>=values[1] - fail_word(100) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl19c - goto skip19c -lbl19c: fail_word(101) -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]>=values[1] - goto cx16.r3 - goto skip19d -lbl19d: fail_word(102) -skip19d: - ; no else - if sources[1]>=values[1] - fail_word(103) - - ; with else - if sources[1]>=values[1] - fail_word(104) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl20a - goto skip20a -lbl20a: fail_word(105) -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x>=values[1] - goto cx16.r3 - goto skip20b -lbl20b: fail_word(106) -skip20b: - ; no else - if x>=values[1] - fail_word(107) - - ; with else - if x>=values[1] - fail_word(108) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl20c - goto skip20c -lbl20c: fail_word(109) -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]>=values[1] - goto cx16.r3 - goto skip20d -lbl20d: fail_word(110) -skip20d: - ; no else - if sources[1]>=values[1] - fail_word(111) - - ; with else - if sources[1]>=values[1] - fail_word(112) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl21a - goto skip21a -lbl21a: fail_word(113) -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x>=values[1] - goto cx16.r3 - goto skip21b -lbl21b: fail_word(114) -skip21b: - ; no else - if x>=values[1] - fail_word(115) - - ; with else - if x>=values[1] - fail_word(116) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl21c - goto skip21c -lbl21c: fail_word(117) -skip21c: - ; indirect jump - cx16.r3 = &lbl21d - if sources[1]>=values[1] - goto cx16.r3 - goto skip21d -lbl21d: fail_word(118) -skip21d: - ; no else - if sources[1]>=values[1] - fail_word(119) - - ; with else - if sources[1]>=values[1] - fail_word(120) - else - success++ - - x=1 - sources[1]=1 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl22a - goto skip22a -lbl22a: success++ -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x>=values[1] - goto cx16.r3 - goto skip22b -lbl22b: success++ -skip22b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl22c - goto skip22c -lbl22c: success++ -skip22c: - ; indirect jump - cx16.r3 = &lbl22d - if sources[1]>=values[1] - goto cx16.r3 - goto skip22d -lbl22d: success++ -skip22d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl23a - goto skip23a -lbl23a: success++ -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x>=values[1] - goto cx16.r3 - goto skip23b -lbl23b: success++ -skip23b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl23c - goto skip23c -lbl23c: success++ -skip23c: - ; indirect jump - cx16.r3 = &lbl23d - if sources[1]>=values[1] - goto cx16.r3 - goto skip23d -lbl23d: success++ -skip23d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl24a - goto skip24a -lbl24a: success++ -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x>=values[1] - goto cx16.r3 - goto skip24b -lbl24b: success++ -skip24b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl24c - goto skip24c -lbl24c: success++ -skip24c: - ; indirect jump - cx16.r3 = &lbl24d - if sources[1]>=values[1] - goto cx16.r3 - goto skip24d -lbl24d: success++ -skip24d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x>=values[1] - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl25c - goto skip25c -lbl25c: success++ -skip25c: - ; indirect jump - cx16.r3 = &lbl25d - if sources[1]>=values[1] - goto cx16.r3 - goto skip25d -lbl25d: success++ -skip25d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl26a - goto skip26a -lbl26a: fail_word(121) -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x>=values[1] - goto cx16.r3 - goto skip26b -lbl26b: fail_word(122) -skip26b: - ; no else - if x>=values[1] - fail_word(123) - - ; with else - if x>=values[1] - fail_word(124) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl26c - goto skip26c -lbl26c: fail_word(125) -skip26c: - ; indirect jump - cx16.r3 = &lbl26d - if sources[1]>=values[1] - goto cx16.r3 - goto skip26d -lbl26d: fail_word(126) -skip26d: - ; no else - if sources[1]>=values[1] - fail_word(127) - - ; with else - if sources[1]>=values[1] - fail_word(128) - else - success++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl27a - goto skip27a -lbl27a: fail_word(129) -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x>=values[1] - goto cx16.r3 - goto skip27b -lbl27b: fail_word(130) -skip27b: - ; no else - if x>=values[1] - fail_word(131) - - ; with else - if x>=values[1] - fail_word(132) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl27c - goto skip27c -lbl27c: fail_word(133) -skip27c: - ; indirect jump - cx16.r3 = &lbl27d - if sources[1]>=values[1] - goto cx16.r3 - goto skip27d -lbl27d: fail_word(134) -skip27d: - ; no else - if sources[1]>=values[1] - fail_word(135) - - ; with else - if sources[1]>=values[1] - fail_word(136) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl28a - goto skip28a -lbl28a: fail_word(137) -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x>=values[1] - goto cx16.r3 - goto skip28b -lbl28b: fail_word(138) -skip28b: - ; no else - if x>=values[1] - fail_word(139) - - ; with else - if x>=values[1] - fail_word(140) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl28c - goto skip28c -lbl28c: fail_word(141) -skip28c: - ; indirect jump - cx16.r3 = &lbl28d - if sources[1]>=values[1] - goto cx16.r3 - goto skip28d -lbl28d: fail_word(142) -skip28d: - ; no else - if sources[1]>=values[1] - fail_word(143) - - ; with else - if sources[1]>=values[1] - fail_word(144) - else - success++ - - x=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl29a - goto skip29a -lbl29a: success++ -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x>=values[1] - goto cx16.r3 - goto skip29b -lbl29b: success++ -skip29b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl29c - goto skip29c -lbl29c: success++ -skip29c: - ; indirect jump - cx16.r3 = &lbl29d - if sources[1]>=values[1] - goto cx16.r3 - goto skip29d -lbl29d: success++ -skip29d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl30a - goto skip30a -lbl30a: success++ -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x>=values[1] - goto cx16.r3 - goto skip30b -lbl30b: success++ -skip30b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl30c - goto skip30c -lbl30c: success++ -skip30c: - ; indirect jump - cx16.r3 = &lbl30d - if sources[1]>=values[1] - goto cx16.r3 - goto skip30d -lbl30d: success++ -skip30d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl31a - goto skip31a -lbl31a: success++ -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x>=values[1] - goto cx16.r3 - goto skip31b -lbl31b: success++ -skip31b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl31c - goto skip31c -lbl31c: success++ -skip31c: - ; indirect jump - cx16.r3 = &lbl31d - if sources[1]>=values[1] - goto cx16.r3 - goto skip31d -lbl31d: success++ -skip31d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl32a - goto skip32a -lbl32a: success++ -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x>=values[1] - goto cx16.r3 - goto skip32b -lbl32b: success++ -skip32b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl32c - goto skip32c -lbl32c: success++ -skip32c: - ; indirect jump - cx16.r3 = &lbl32d - if sources[1]>=values[1] - goto cx16.r3 - goto skip32d -lbl32d: success++ -skip32d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x>=values[1] - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl33c - goto skip33c -lbl33c: success++ -skip33c: - ; indirect jump - cx16.r3 = &lbl33d - if sources[1]>=values[1] - goto cx16.r3 - goto skip33d -lbl33d: success++ -skip33d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl34a - goto skip34a -lbl34a: fail_word(145) -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x>=values[1] - goto cx16.r3 - goto skip34b -lbl34b: fail_word(146) -skip34b: - ; no else - if x>=values[1] - fail_word(147) - - ; with else - if x>=values[1] - fail_word(148) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl34c - goto skip34c -lbl34c: fail_word(149) -skip34c: - ; indirect jump - cx16.r3 = &lbl34d - if sources[1]>=values[1] - goto cx16.r3 - goto skip34d -lbl34d: fail_word(150) -skip34d: - ; no else - if sources[1]>=values[1] - fail_word(151) - - ; with else - if sources[1]>=values[1] - fail_word(152) - else - success++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl35a - goto skip35a -lbl35a: fail_word(153) -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x>=values[1] - goto cx16.r3 - goto skip35b -lbl35b: fail_word(154) -skip35b: - ; no else - if x>=values[1] - fail_word(155) - - ; with else - if x>=values[1] - fail_word(156) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl35c - goto skip35c -lbl35c: fail_word(157) -skip35c: - ; indirect jump - cx16.r3 = &lbl35d - if sources[1]>=values[1] - goto cx16.r3 - goto skip35d -lbl35d: fail_word(158) -skip35d: - ; no else - if sources[1]>=values[1] - fail_word(159) - - ; with else - if sources[1]>=values[1] - fail_word(160) - else - success++ - - x=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl36a - goto skip36a -lbl36a: success++ -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x>=values[1] - goto cx16.r3 - goto skip36b -lbl36b: success++ -skip36b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl36c - goto skip36c -lbl36c: success++ -skip36c: - ; indirect jump - cx16.r3 = &lbl36d - if sources[1]>=values[1] - goto cx16.r3 - goto skip36d -lbl36d: success++ -skip36d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl37a - goto skip37a -lbl37a: success++ -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x>=values[1] - goto cx16.r3 - goto skip37b -lbl37b: success++ -skip37b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl37c - goto skip37c -lbl37c: success++ -skip37c: - ; indirect jump - cx16.r3 = &lbl37d - if sources[1]>=values[1] - goto cx16.r3 - goto skip37d -lbl37d: success++ -skip37d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl38a - goto skip38a -lbl38a: success++ -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x>=values[1] - goto cx16.r3 - goto skip38b -lbl38b: success++ -skip38b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl38c - goto skip38c -lbl38c: success++ -skip38c: - ; indirect jump - cx16.r3 = &lbl38d - if sources[1]>=values[1] - goto cx16.r3 - goto skip38d -lbl38d: success++ -skip38d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl39a - goto skip39a -lbl39a: success++ -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x>=values[1] - goto cx16.r3 - goto skip39b -lbl39b: success++ -skip39b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl39c - goto skip39c -lbl39c: success++ -skip39c: - ; indirect jump - cx16.r3 = &lbl39d - if sources[1]>=values[1] - goto cx16.r3 - goto skip39d -lbl39d: success++ -skip39d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl40a - goto skip40a -lbl40a: success++ -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x>=values[1] - goto cx16.r3 - goto skip40b -lbl40b: success++ -skip40b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl40c - goto skip40c -lbl40c: success++ -skip40c: - ; indirect jump - cx16.r3 = &lbl40d - if sources[1]>=values[1] - goto cx16.r3 - goto skip40d -lbl40d: success++ -skip40d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x>=values[1] - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl41c - goto skip41c -lbl41c: success++ -skip41c: - ; indirect jump - cx16.r3 = &lbl41d - if sources[1]>=values[1] - goto cx16.r3 - goto skip41d -lbl41d: success++ -skip41d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl42a - goto skip42a -lbl42a: fail_word(161) -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x>=values[1] - goto cx16.r3 - goto skip42b -lbl42b: fail_word(162) -skip42b: - ; no else - if x>=values[1] - fail_word(163) - - ; with else - if x>=values[1] - fail_word(164) - else - success++ - - ; direct jump - if sources[1]>=values[1] - goto lbl42c - goto skip42c -lbl42c: fail_word(165) -skip42c: - ; indirect jump - cx16.r3 = &lbl42d - if sources[1]>=values[1] - goto cx16.r3 - goto skip42d -lbl42d: fail_word(166) -skip42d: - ; no else - if sources[1]>=values[1] - fail_word(167) - - ; with else - if sources[1]>=values[1] - fail_word(168) - else - success++ - - x=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if x>=values[1] - goto lbl43a - goto skip43a -lbl43a: success++ -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x>=values[1] - goto cx16.r3 - goto skip43b -lbl43b: success++ -skip43b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl43c - goto skip43c -lbl43c: success++ -skip43c: - ; indirect jump - cx16.r3 = &lbl43d - if sources[1]>=values[1] - goto cx16.r3 - goto skip43d -lbl43d: success++ -skip43d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x>=values[1] - goto lbl44a - goto skip44a -lbl44a: success++ -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x>=values[1] - goto cx16.r3 - goto skip44b -lbl44b: success++ -skip44b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl44c - goto skip44c -lbl44c: success++ -skip44c: - ; indirect jump - cx16.r3 = &lbl44d - if sources[1]>=values[1] - goto cx16.r3 - goto skip44d -lbl44d: success++ -skip44d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x>=values[1] - goto lbl45a - goto skip45a -lbl45a: success++ -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x>=values[1] - goto cx16.r3 - goto skip45b -lbl45b: success++ -skip45b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl45c - goto skip45c -lbl45c: success++ -skip45c: - ; indirect jump - cx16.r3 = &lbl45d - if sources[1]>=values[1] - goto cx16.r3 - goto skip45d -lbl45d: success++ -skip45d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x>=values[1] - goto lbl46a - goto skip46a -lbl46a: success++ -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x>=values[1] - goto cx16.r3 - goto skip46b -lbl46b: success++ -skip46b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl46c - goto skip46c -lbl46c: success++ -skip46c: - ; indirect jump - cx16.r3 = &lbl46d - if sources[1]>=values[1] - goto cx16.r3 - goto skip46d -lbl46d: success++ -skip46d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x>=values[1] - goto lbl47a - goto skip47a -lbl47a: success++ -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x>=values[1] - goto cx16.r3 - goto skip47b -lbl47b: success++ -skip47b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl47c - goto skip47c -lbl47c: success++ -skip47c: - ; indirect jump - cx16.r3 = &lbl47d - if sources[1]>=values[1] - goto cx16.r3 - goto skip47d -lbl47d: success++ -skip47d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x>=values[1] - goto lbl48a - goto skip48a -lbl48a: success++ -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x>=values[1] - goto cx16.r3 - goto skip48b -lbl48b: success++ -skip48b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl48c - goto skip48c -lbl48c: success++ -skip48c: - ; indirect jump - cx16.r3 = &lbl48d - if sources[1]>=values[1] - goto cx16.r3 - goto skip48d -lbl48d: success++ -skip48d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x>=values[1] - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x>=values[1] - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x>=values[1] - success++ - - ; with else - if x>=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]>=values[1] - goto lbl49c - goto skip49c -lbl49c: success++ -skip49c: - ; indirect jump - cx16.r3 = &lbl49d - if sources[1]>=values[1] - goto cx16.r3 - goto skip49d -lbl49d: success++ -skip49d: - ; no else - if sources[1]>=values[1] - success++ - - ; with else - if sources[1]>=values[1] - success++ - else - cx16.r0L++ - - verify_success(266) -} - -} - diff --git a/compiler/test/comparisons/test_word_splitw_lt.asm b/compiler/test/comparisons/test_word_splitw_lt.asm deleted file mode 100644 index cebfcb68e..000000000 --- a/compiler/test/comparisons/test_word_splitw_lt.asm +++ /dev/null @@ -1,16668 +0,0 @@ -; w65c02 assembly code for 'test_word_splitw_lt' -; generated by prog8.codegen.cpu6502.ProgramAndVarsGen on 2024-03-13T21:14:53 -; assembler syntax is for the 64tasm cross-assembler -; output options: output=PRG launcher=BASIC zp=DONTUSE - -.cpu 'w65c02' -.enc 'none' -P8ZP_SCRATCH_B1 = 122 -P8ZP_SCRATCH_REG = 123 -P8ZP_SCRATCH_W1 = 124 ; word -P8ZP_SCRATCH_W2 = 126 ; word -.weak -.endweak -; ---- basic program with sys call ---- -* = $0801 - .word (+), 2024 - .null $9e, format(' %d ', prog8_entrypoint), $3a, $8f, ' prog8' -+ .word 0 -prog8_entrypoint ; assembly code starts here - jsr sys.init_system_phase2 - lda #4 - sta $01 - jsr p8b_main.p8s_start - jmp sys.cleanup_at_exit - -; ---- block: 'p8b_main' ---- -p8b_main .proc - ; source: test_word_splitw_lt.p8:8 main { - -; non-zeropage variables without initialization value - .section BSS -p8v_comparison .word ? -p8v_success .word ? - .send BSS -; non-zeropage variables -p8v_datatype ; PETSCII:"word" - .byte $57, $4f, $52, $44, $00 - - ; source: test_word_splitw_lt.p8:9 uword success = 0 - ; source: test_word_splitw_lt.p8:10 str datatype = "word" - ; source: test_word_splitw_lt.p8:11 uword @shared comparison - ; source: test_word_splitw_lt.p8:13 sub start() { - -p8s_start .proc -; program startup initialization - cld - tsx - stx prog8_lib.orig_stackpointer ; required for sys.exit() - .if prog8_bss_section_size>0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_splitw_lt.p8:14 txt.print("\nless-than split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lt.p8:53 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_lt.p8:54 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:56 if x1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:60 skip1a: -p8l_skip1a - ; source: test_word_splitw_lt.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:63 if x2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:67 skip1b: -p8l_skip1b - ; source: test_word_splitw_lt.p8:69 if x3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_3_afterif - ; source: test_word_splitw_lt.p8:73 if x4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_splitw_lt.p8:76 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_4_afterif - ; source: test_word_splitw_lt.p8:79 if sources[1]5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:83 skip1c: -p8l_skip1c - ; source: test_word_splitw_lt.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:86 if sources[1]6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:90 skip1d: -p8l_skip1d - ; source: test_word_splitw_lt.p8:92 if sources[1]7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_6_afterif - ; source: test_word_splitw_lt.p8:96 if sources[1]8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_splitw_lt.p8:99 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_7_afterif - ; source: test_word_splitw_lt.p8:101 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:103 if xp8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:110 if xp8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:133 if sources[1]p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:157 if xp8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:180 if sources[1]1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:197 if xp8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:204 if xp8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:227 if sources[1]$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:244 if xp8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:251 if xp8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:274 if sources[1]$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:291 if xp8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:298 if xp8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:321 if sources[1]$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:338 if xp8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:345 if xp8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:368 if sources[1]-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lt.p8:384 sources[1]=-1 - ldy #1 - lda #<-1 - sta p8v_sources_lsb,y - lda #>-1 - sta p8v_sources_msb,y - ; source: test_word_splitw_lt.p8:385 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:387 if x9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:391 skip8a: -p8l_skip8a - ; source: test_word_splitw_lt.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:394 if x10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:398 skip8b: -p8l_skip8b - ; source: test_word_splitw_lt.p8:400 if x11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_45_afterif - ; source: test_word_splitw_lt.p8:404 if x12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_splitw_lt.p8:407 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_46_afterif - ; source: test_word_splitw_lt.p8:410 if sources[1]13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:414 skip8c: -p8l_skip8c - ; source: test_word_splitw_lt.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:417 if sources[1]14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:421 skip8d: -p8l_skip8d - ; source: test_word_splitw_lt.p8:423 if sources[1]15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_48_afterif - ; source: test_word_splitw_lt.p8:427 if sources[1]$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_splitw_lt.p8:430 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_49_afterif - ; source: test_word_splitw_lt.p8:432 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:434 if x$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:438 skip9a: -p8l_skip9a - ; source: test_word_splitw_lt.p8:440 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:441 if x$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:445 skip9b: -p8l_skip9b - ; source: test_word_splitw_lt.p8:447 if x$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_51_afterif - ; source: test_word_splitw_lt.p8:451 if x$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_splitw_lt.p8:454 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_52_afterif - ; source: test_word_splitw_lt.p8:457 if sources[1]$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:461 skip9c: -p8l_skip9c - ; source: test_word_splitw_lt.p8:463 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:464 if sources[1]$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:468 skip9d: -p8l_skip9d - ; source: test_word_splitw_lt.p8:470 if sources[1]$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_54_afterif - ; source: test_word_splitw_lt.p8:474 if sources[1]$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_splitw_lt.p8:477 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_55_afterif - ; source: test_word_splitw_lt.p8:479 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:481 if xp8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:488 if xp8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:511 if sources[1]1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:528 if xp8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:535 if xp8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:558 if sources[1]$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:575 if xp8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:582 if xp8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:605 if sources[1]$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:622 if xp8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:629 if xp8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:652 if sources[1]$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:669 if xp8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:676 if xp8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:699 if sources[1]-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:718 if x$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:722 skip15a: -p8l_skip15a - ; source: test_word_splitw_lt.p8:724 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:725 if x$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:729 skip15b: -p8l_skip15b - ; source: test_word_splitw_lt.p8:731 if x$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_87_afterif - ; source: test_word_splitw_lt.p8:735 if x$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_splitw_lt.p8:738 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_88_afterif - ; source: test_word_splitw_lt.p8:741 if sources[1]$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:745 skip15c: -p8l_skip15c - ; source: test_word_splitw_lt.p8:747 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:748 if sources[1]$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:752 skip15d: -p8l_skip15d - ; source: test_word_splitw_lt.p8:754 if sources[1]$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_90_afterif - ; source: test_word_splitw_lt.p8:758 if sources[1]$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_splitw_lt.p8:761 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_91_afterif - ; source: test_word_splitw_lt.p8:763 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:765 if x$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:769 skip16a: -p8l_skip16a - ; source: test_word_splitw_lt.p8:771 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:772 if x$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:776 skip16b: -p8l_skip16b - ; source: test_word_splitw_lt.p8:778 if x$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_93_afterif - ; source: test_word_splitw_lt.p8:782 if x$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_splitw_lt.p8:785 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_94_afterif - ; source: test_word_splitw_lt.p8:788 if sources[1]$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:792 skip16c: -p8l_skip16c - ; source: test_word_splitw_lt.p8:794 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:795 if sources[1]$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:799 skip16d: -p8l_skip16d - ; source: test_word_splitw_lt.p8:801 if sources[1]$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_96_afterif - ; source: test_word_splitw_lt.p8:805 if sources[1]$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_splitw_lt.p8:808 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_97_afterif - ; source: test_word_splitw_lt.p8:810 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:812 if x$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:816 skip17a: -p8l_skip17a - ; source: test_word_splitw_lt.p8:818 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:819 if x$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:823 skip17b: -p8l_skip17b - ; source: test_word_splitw_lt.p8:825 if x$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_99_afterif - ; source: test_word_splitw_lt.p8:829 if x$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_splitw_lt.p8:832 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_100_afterif - ; source: test_word_splitw_lt.p8:835 if sources[1]$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:839 skip17c: -p8l_skip17c - ; source: test_word_splitw_lt.p8:841 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:842 if sources[1]$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:846 skip17d: -p8l_skip17d - ; source: test_word_splitw_lt.p8:848 if sources[1]$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_102_afterif - ; source: test_word_splitw_lt.p8:852 if sources[1]$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_splitw_lt.p8:855 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_103_afterif - ; source: test_word_splitw_lt.p8:857 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:859 if xp8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:866 if xp8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:889 if sources[1]$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:906 if xp8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:913 if xp8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:936 if sources[1]$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:953 if xp8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:960 if xp8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:983 if sources[1]$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1000 if xp8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1007 if xp8l_lbl21d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1030 if sources[1]1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lt.p8:1046 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_word_splitw_lt.p8:1047 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1049 if x$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1053 skip22a: -p8l_skip22a - ; source: test_word_splitw_lt.p8:1055 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1056 if x$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1060 skip22b: -p8l_skip22b - ; source: test_word_splitw_lt.p8:1062 if x$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_129_afterif - ; source: test_word_splitw_lt.p8:1066 if x$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_splitw_lt.p8:1069 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_130_afterif - ; source: test_word_splitw_lt.p8:1072 if sources[1]$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1076 skip22c: -p8l_skip22c - ; source: test_word_splitw_lt.p8:1078 cx16.r3 = &lbl22d - lda #p8l_lbl22d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1079 if sources[1]$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1083 skip22d: -p8l_skip22d - ; source: test_word_splitw_lt.p8:1085 if sources[1]$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_132_afterif - ; source: test_word_splitw_lt.p8:1089 if sources[1]$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_splitw_lt.p8:1092 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_133_afterif - ; source: test_word_splitw_lt.p8:1094 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1096 if x$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1100 skip23a: -p8l_skip23a - ; source: test_word_splitw_lt.p8:1102 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1103 if x$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1107 skip23b: -p8l_skip23b - ; source: test_word_splitw_lt.p8:1109 if x$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_135_afterif - ; source: test_word_splitw_lt.p8:1113 if x$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_splitw_lt.p8:1116 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_136_afterif - ; source: test_word_splitw_lt.p8:1119 if sources[1]$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1123 skip23c: -p8l_skip23c - ; source: test_word_splitw_lt.p8:1125 cx16.r3 = &lbl23d - lda #p8l_lbl23d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1126 if sources[1]$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1130 skip23d: -p8l_skip23d - ; source: test_word_splitw_lt.p8:1132 if sources[1]$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_138_afterif - ; source: test_word_splitw_lt.p8:1136 if sources[1]$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_splitw_lt.p8:1139 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_139_afterif - ; source: test_word_splitw_lt.p8:1141 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1143 if x$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1147 skip24a: -p8l_skip24a - ; source: test_word_splitw_lt.p8:1149 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1150 if x$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1154 skip24b: -p8l_skip24b - ; source: test_word_splitw_lt.p8:1156 if x$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_141_afterif - ; source: test_word_splitw_lt.p8:1160 if x$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_splitw_lt.p8:1163 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_142_afterif - ; source: test_word_splitw_lt.p8:1166 if sources[1]$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1170 skip24c: -p8l_skip24c - ; source: test_word_splitw_lt.p8:1172 cx16.r3 = &lbl24d - lda #p8l_lbl24d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1173 if sources[1]$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1177 skip24d: -p8l_skip24d - ; source: test_word_splitw_lt.p8:1179 if sources[1]$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_144_afterif - ; source: test_word_splitw_lt.p8:1183 if sources[1]$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_splitw_lt.p8:1186 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_145_afterif - ; source: test_word_splitw_lt.p8:1188 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1190 if x$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1194 skip25a: -p8l_skip25a - ; source: test_word_splitw_lt.p8:1196 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1197 if x$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1201 skip25b: -p8l_skip25b - ; source: test_word_splitw_lt.p8:1203 if x$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_147_afterif - ; source: test_word_splitw_lt.p8:1207 if x$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_splitw_lt.p8:1210 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_148_afterif - ; source: test_word_splitw_lt.p8:1213 if sources[1]$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1217 skip25c: -p8l_skip25c - ; source: test_word_splitw_lt.p8:1219 cx16.r3 = &lbl25d - lda #p8l_lbl25d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1220 if sources[1]$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1224 skip25d: -p8l_skip25d - ; source: test_word_splitw_lt.p8:1226 if sources[1]$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_150_afterif - ; source: test_word_splitw_lt.p8:1230 if sources[1]$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_splitw_lt.p8:1233 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_151_afterif - ; source: test_word_splitw_lt.p8:1235 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1237 if xp8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1244 if xp8l_lbl26d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1267 if sources[1]$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1284 if xp8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1291 if xp8l_lbl27d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1314 if sources[1]$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1331 if xp8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1338 if xp8l_lbl28d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1361 if sources[1]$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lt.p8:1377 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_lt.p8:1378 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1380 if x$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1384 skip29a: -p8l_skip29a - ; source: test_word_splitw_lt.p8:1386 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1387 if x$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1391 skip29b: -p8l_skip29b - ; source: test_word_splitw_lt.p8:1393 if x$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_171_afterif - ; source: test_word_splitw_lt.p8:1397 if x$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_splitw_lt.p8:1400 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_172_afterif - ; source: test_word_splitw_lt.p8:1403 if sources[1]$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1407 skip29c: -p8l_skip29c - ; source: test_word_splitw_lt.p8:1409 cx16.r3 = &lbl29d - lda #p8l_lbl29d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1410 if sources[1]$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1414 skip29d: -p8l_skip29d - ; source: test_word_splitw_lt.p8:1416 if sources[1]$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_174_afterif - ; source: test_word_splitw_lt.p8:1420 if sources[1]$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_splitw_lt.p8:1423 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_175_afterif - ; source: test_word_splitw_lt.p8:1425 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1427 if x$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1431 skip30a: -p8l_skip30a - ; source: test_word_splitw_lt.p8:1433 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1434 if x$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1438 skip30b: -p8l_skip30b - ; source: test_word_splitw_lt.p8:1440 if x$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_177_afterif - ; source: test_word_splitw_lt.p8:1444 if x$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_splitw_lt.p8:1447 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_178_afterif - ; source: test_word_splitw_lt.p8:1450 if sources[1]$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1454 skip30c: -p8l_skip30c - ; source: test_word_splitw_lt.p8:1456 cx16.r3 = &lbl30d - lda #p8l_lbl30d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1457 if sources[1]$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1461 skip30d: -p8l_skip30d - ; source: test_word_splitw_lt.p8:1463 if sources[1]$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_180_afterif - ; source: test_word_splitw_lt.p8:1467 if sources[1]$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_splitw_lt.p8:1470 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_181_afterif - ; source: test_word_splitw_lt.p8:1472 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1474 if x$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1478 skip31a: -p8l_skip31a - ; source: test_word_splitw_lt.p8:1480 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1481 if x$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1485 skip31b: -p8l_skip31b - ; source: test_word_splitw_lt.p8:1487 if x$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_183_afterif - ; source: test_word_splitw_lt.p8:1491 if x$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_splitw_lt.p8:1494 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_184_afterif - ; source: test_word_splitw_lt.p8:1497 if sources[1]$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1501 skip31c: -p8l_skip31c - ; source: test_word_splitw_lt.p8:1503 cx16.r3 = &lbl31d - lda #p8l_lbl31d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1504 if sources[1]$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1508 skip31d: -p8l_skip31d - ; source: test_word_splitw_lt.p8:1510 if sources[1]$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_186_afterif - ; source: test_word_splitw_lt.p8:1514 if sources[1]$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_splitw_lt.p8:1517 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_187_afterif - ; source: test_word_splitw_lt.p8:1519 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1521 if x$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1525 skip32a: -p8l_skip32a - ; source: test_word_splitw_lt.p8:1527 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1528 if x$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1532 skip32b: -p8l_skip32b - ; source: test_word_splitw_lt.p8:1534 if x$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_189_afterif - ; source: test_word_splitw_lt.p8:1538 if x$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_splitw_lt.p8:1541 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_190_afterif - ; source: test_word_splitw_lt.p8:1544 if sources[1]$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1548 skip32c: -p8l_skip32c - ; source: test_word_splitw_lt.p8:1550 cx16.r3 = &lbl32d - lda #p8l_lbl32d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1551 if sources[1]$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1555 skip32d: -p8l_skip32d - ; source: test_word_splitw_lt.p8:1557 if sources[1]$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_192_afterif - ; source: test_word_splitw_lt.p8:1561 if sources[1]$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_splitw_lt.p8:1564 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_193_afterif - ; source: test_word_splitw_lt.p8:1566 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1568 if x$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1572 skip33a: -p8l_skip33a - ; source: test_word_splitw_lt.p8:1574 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1575 if x$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1579 skip33b: -p8l_skip33b - ; source: test_word_splitw_lt.p8:1581 if x$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_195_afterif - ; source: test_word_splitw_lt.p8:1585 if x$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_splitw_lt.p8:1588 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_196_afterif - ; source: test_word_splitw_lt.p8:1591 if sources[1]$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1595 skip33c: -p8l_skip33c - ; source: test_word_splitw_lt.p8:1597 cx16.r3 = &lbl33d - lda #p8l_lbl33d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1598 if sources[1]$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1602 skip33d: -p8l_skip33d - ; source: test_word_splitw_lt.p8:1604 if sources[1]$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_198_afterif - ; source: test_word_splitw_lt.p8:1608 if sources[1]$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_splitw_lt.p8:1611 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_199_afterif - ; source: test_word_splitw_lt.p8:1613 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1615 if xp8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1622 if xp8l_lbl34d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1645 if sources[1]$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1662 if xp8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1669 if xp8l_lbl35d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1692 if sources[1]$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lt.p8:1708 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_lt.p8:1709 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1711 if x$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1715 skip36a: -p8l_skip36a - ; source: test_word_splitw_lt.p8:1717 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1718 if x$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1722 skip36b: -p8l_skip36b - ; source: test_word_splitw_lt.p8:1724 if x$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_213_afterif - ; source: test_word_splitw_lt.p8:1728 if x$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_splitw_lt.p8:1731 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_214_afterif - ; source: test_word_splitw_lt.p8:1734 if sources[1]$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1738 skip36c: -p8l_skip36c - ; source: test_word_splitw_lt.p8:1740 cx16.r3 = &lbl36d - lda #p8l_lbl36d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1741 if sources[1]$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1745 skip36d: -p8l_skip36d - ; source: test_word_splitw_lt.p8:1747 if sources[1]$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_216_afterif - ; source: test_word_splitw_lt.p8:1751 if sources[1]$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_splitw_lt.p8:1754 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_217_afterif - ; source: test_word_splitw_lt.p8:1756 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1758 if x$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1762 skip37a: -p8l_skip37a - ; source: test_word_splitw_lt.p8:1764 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1765 if x$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1769 skip37b: -p8l_skip37b - ; source: test_word_splitw_lt.p8:1771 if x$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_219_afterif - ; source: test_word_splitw_lt.p8:1775 if x$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_splitw_lt.p8:1778 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_220_afterif - ; source: test_word_splitw_lt.p8:1781 if sources[1]$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1785 skip37c: -p8l_skip37c - ; source: test_word_splitw_lt.p8:1787 cx16.r3 = &lbl37d - lda #p8l_lbl37d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1788 if sources[1]$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1792 skip37d: -p8l_skip37d - ; source: test_word_splitw_lt.p8:1794 if sources[1]$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_222_afterif - ; source: test_word_splitw_lt.p8:1798 if sources[1]$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_splitw_lt.p8:1801 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_223_afterif - ; source: test_word_splitw_lt.p8:1803 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1805 if x$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1809 skip38a: -p8l_skip38a - ; source: test_word_splitw_lt.p8:1811 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1812 if x$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1816 skip38b: -p8l_skip38b - ; source: test_word_splitw_lt.p8:1818 if x$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_225_afterif - ; source: test_word_splitw_lt.p8:1822 if x$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_splitw_lt.p8:1825 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_226_afterif - ; source: test_word_splitw_lt.p8:1828 if sources[1]$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1832 skip38c: -p8l_skip38c - ; source: test_word_splitw_lt.p8:1834 cx16.r3 = &lbl38d - lda #p8l_lbl38d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1835 if sources[1]$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1839 skip38d: -p8l_skip38d - ; source: test_word_splitw_lt.p8:1841 if sources[1]$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_228_afterif - ; source: test_word_splitw_lt.p8:1845 if sources[1]$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_splitw_lt.p8:1848 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_229_afterif - ; source: test_word_splitw_lt.p8:1850 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1852 if x$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1856 skip39a: -p8l_skip39a - ; source: test_word_splitw_lt.p8:1858 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1859 if x$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1863 skip39b: -p8l_skip39b - ; source: test_word_splitw_lt.p8:1865 if x$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_231_afterif - ; source: test_word_splitw_lt.p8:1869 if x$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_splitw_lt.p8:1872 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_232_afterif - ; source: test_word_splitw_lt.p8:1875 if sources[1]$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1879 skip39c: -p8l_skip39c - ; source: test_word_splitw_lt.p8:1881 cx16.r3 = &lbl39d - lda #p8l_lbl39d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1882 if sources[1]$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1886 skip39d: -p8l_skip39d - ; source: test_word_splitw_lt.p8:1888 if sources[1]$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_234_afterif - ; source: test_word_splitw_lt.p8:1892 if sources[1]$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_splitw_lt.p8:1895 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_235_afterif - ; source: test_word_splitw_lt.p8:1897 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1899 if x$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1903 skip40a: -p8l_skip40a - ; source: test_word_splitw_lt.p8:1905 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1906 if x$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1910 skip40b: -p8l_skip40b - ; source: test_word_splitw_lt.p8:1912 if x$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_237_afterif - ; source: test_word_splitw_lt.p8:1916 if x$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_splitw_lt.p8:1919 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_238_afterif - ; source: test_word_splitw_lt.p8:1922 if sources[1]$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1926 skip40c: -p8l_skip40c - ; source: test_word_splitw_lt.p8:1928 cx16.r3 = &lbl40d - lda #p8l_lbl40d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1929 if sources[1]$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1933 skip40d: -p8l_skip40d - ; source: test_word_splitw_lt.p8:1935 if sources[1]$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_240_afterif - ; source: test_word_splitw_lt.p8:1939 if sources[1]$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_splitw_lt.p8:1942 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_241_afterif - ; source: test_word_splitw_lt.p8:1944 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1946 if x$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1950 skip41a: -p8l_skip41a - ; source: test_word_splitw_lt.p8:1952 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1953 if x$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1957 skip41b: -p8l_skip41b - ; source: test_word_splitw_lt.p8:1959 if x$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_243_afterif - ; source: test_word_splitw_lt.p8:1963 if x$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_splitw_lt.p8:1966 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_244_afterif - ; source: test_word_splitw_lt.p8:1969 if sources[1]$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1973 skip41c: -p8l_skip41c - ; source: test_word_splitw_lt.p8:1975 cx16.r3 = &lbl41d - lda #p8l_lbl41d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:1976 if sources[1]$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:1980 skip41d: -p8l_skip41d - ; source: test_word_splitw_lt.p8:1982 if sources[1]$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_246_afterif - ; source: test_word_splitw_lt.p8:1986 if sources[1]$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_splitw_lt.p8:1989 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_247_afterif - ; source: test_word_splitw_lt.p8:1991 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:1993 if xp8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2000 if xp8l_lbl42d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2023 if sources[1]$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lt.p8:2039 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_lt.p8:2040 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2042 if x$a9 - lda #<$a9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2046 skip43a: -p8l_skip43a - ; source: test_word_splitw_lt.p8:2048 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2049 if x$aa - lda #<$aa - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2053 skip43b: -p8l_skip43b - ; source: test_word_splitw_lt.p8:2055 if x$ab - lda #<$ab - jsr p8b_main.p8s_fail_word -label_asm_255_afterif - ; source: test_word_splitw_lt.p8:2059 if x$ac - lda #<$ac - jsr p8b_main.p8s_fail_word - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_splitw_lt.p8:2062 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_256_afterif - ; source: test_word_splitw_lt.p8:2065 if sources[1]$ad - lda #<$ad - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2069 skip43c: -p8l_skip43c - ; source: test_word_splitw_lt.p8:2071 cx16.r3 = &lbl43d - lda #p8l_lbl43d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2072 if sources[1]$ae - lda #<$ae - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2076 skip43d: -p8l_skip43d - ; source: test_word_splitw_lt.p8:2078 if sources[1]$af - lda #<$af - jsr p8b_main.p8s_fail_word -label_asm_258_afterif - ; source: test_word_splitw_lt.p8:2082 if sources[1]$b0 - lda #<$b0 - jsr p8b_main.p8s_fail_word - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_splitw_lt.p8:2085 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_259_afterif - ; source: test_word_splitw_lt.p8:2087 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2089 if x$b1 - lda #<$b1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2093 skip44a: -p8l_skip44a - ; source: test_word_splitw_lt.p8:2095 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2096 if x$b2 - lda #<$b2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2100 skip44b: -p8l_skip44b - ; source: test_word_splitw_lt.p8:2102 if x$b3 - lda #<$b3 - jsr p8b_main.p8s_fail_word -label_asm_261_afterif - ; source: test_word_splitw_lt.p8:2106 if x$b4 - lda #<$b4 - jsr p8b_main.p8s_fail_word - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_splitw_lt.p8:2109 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_262_afterif - ; source: test_word_splitw_lt.p8:2112 if sources[1]$b5 - lda #<$b5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2116 skip44c: -p8l_skip44c - ; source: test_word_splitw_lt.p8:2118 cx16.r3 = &lbl44d - lda #p8l_lbl44d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2119 if sources[1]$b6 - lda #<$b6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2123 skip44d: -p8l_skip44d - ; source: test_word_splitw_lt.p8:2125 if sources[1]$b7 - lda #<$b7 - jsr p8b_main.p8s_fail_word -label_asm_264_afterif - ; source: test_word_splitw_lt.p8:2129 if sources[1]$b8 - lda #<$b8 - jsr p8b_main.p8s_fail_word - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_splitw_lt.p8:2132 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_265_afterif - ; source: test_word_splitw_lt.p8:2134 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2136 if x$b9 - lda #<$b9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2140 skip45a: -p8l_skip45a - ; source: test_word_splitw_lt.p8:2142 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2143 if x$ba - lda #<$ba - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2147 skip45b: -p8l_skip45b - ; source: test_word_splitw_lt.p8:2149 if x$bb - lda #<$bb - jsr p8b_main.p8s_fail_word -label_asm_267_afterif - ; source: test_word_splitw_lt.p8:2153 if x$bc - lda #<$bc - jsr p8b_main.p8s_fail_word - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_splitw_lt.p8:2156 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_268_afterif - ; source: test_word_splitw_lt.p8:2159 if sources[1]$bd - lda #<$bd - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2163 skip45c: -p8l_skip45c - ; source: test_word_splitw_lt.p8:2165 cx16.r3 = &lbl45d - lda #p8l_lbl45d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2166 if sources[1]$be - lda #<$be - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2170 skip45d: -p8l_skip45d - ; source: test_word_splitw_lt.p8:2172 if sources[1]$bf - lda #<$bf - jsr p8b_main.p8s_fail_word -label_asm_270_afterif - ; source: test_word_splitw_lt.p8:2176 if sources[1]$c0 - lda #<$c0 - jsr p8b_main.p8s_fail_word - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_splitw_lt.p8:2179 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_271_afterif - ; source: test_word_splitw_lt.p8:2181 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2183 if x$c1 - lda #<$c1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2187 skip46a: -p8l_skip46a - ; source: test_word_splitw_lt.p8:2189 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2190 if x$c2 - lda #<$c2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2194 skip46b: -p8l_skip46b - ; source: test_word_splitw_lt.p8:2196 if x$c3 - lda #<$c3 - jsr p8b_main.p8s_fail_word -label_asm_273_afterif - ; source: test_word_splitw_lt.p8:2200 if x$c4 - lda #<$c4 - jsr p8b_main.p8s_fail_word - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_splitw_lt.p8:2203 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_274_afterif - ; source: test_word_splitw_lt.p8:2206 if sources[1]$c5 - lda #<$c5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2210 skip46c: -p8l_skip46c - ; source: test_word_splitw_lt.p8:2212 cx16.r3 = &lbl46d - lda #p8l_lbl46d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2213 if sources[1]$c6 - lda #<$c6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2217 skip46d: -p8l_skip46d - ; source: test_word_splitw_lt.p8:2219 if sources[1]$c7 - lda #<$c7 - jsr p8b_main.p8s_fail_word -label_asm_276_afterif - ; source: test_word_splitw_lt.p8:2223 if sources[1]$c8 - lda #<$c8 - jsr p8b_main.p8s_fail_word - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_splitw_lt.p8:2226 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_277_afterif - ; source: test_word_splitw_lt.p8:2228 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2230 if x$c9 - lda #<$c9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2234 skip47a: -p8l_skip47a - ; source: test_word_splitw_lt.p8:2236 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2237 if x$ca - lda #<$ca - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2241 skip47b: -p8l_skip47b - ; source: test_word_splitw_lt.p8:2243 if x$cb - lda #<$cb - jsr p8b_main.p8s_fail_word -label_asm_279_afterif - ; source: test_word_splitw_lt.p8:2247 if x$cc - lda #<$cc - jsr p8b_main.p8s_fail_word - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_splitw_lt.p8:2250 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_280_afterif - ; source: test_word_splitw_lt.p8:2253 if sources[1]$cd - lda #<$cd - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2257 skip47c: -p8l_skip47c - ; source: test_word_splitw_lt.p8:2259 cx16.r3 = &lbl47d - lda #p8l_lbl47d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2260 if sources[1]$ce - lda #<$ce - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2264 skip47d: -p8l_skip47d - ; source: test_word_splitw_lt.p8:2266 if sources[1]$cf - lda #<$cf - jsr p8b_main.p8s_fail_word -label_asm_282_afterif - ; source: test_word_splitw_lt.p8:2270 if sources[1]$d0 - lda #<$d0 - jsr p8b_main.p8s_fail_word - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_splitw_lt.p8:2273 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_283_afterif - ; source: test_word_splitw_lt.p8:2275 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2277 if x$d1 - lda #<$d1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2281 skip48a: -p8l_skip48a - ; source: test_word_splitw_lt.p8:2283 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2284 if x$d2 - lda #<$d2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2288 skip48b: -p8l_skip48b - ; source: test_word_splitw_lt.p8:2290 if x$d3 - lda #<$d3 - jsr p8b_main.p8s_fail_word -label_asm_285_afterif - ; source: test_word_splitw_lt.p8:2294 if x$d4 - lda #<$d4 - jsr p8b_main.p8s_fail_word - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_splitw_lt.p8:2297 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_286_afterif - ; source: test_word_splitw_lt.p8:2300 if sources[1]$d5 - lda #<$d5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2304 skip48c: -p8l_skip48c - ; source: test_word_splitw_lt.p8:2306 cx16.r3 = &lbl48d - lda #p8l_lbl48d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2307 if sources[1]$d6 - lda #<$d6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2311 skip48d: -p8l_skip48d - ; source: test_word_splitw_lt.p8:2313 if sources[1]$d7 - lda #<$d7 - jsr p8b_main.p8s_fail_word -label_asm_288_afterif - ; source: test_word_splitw_lt.p8:2317 if sources[1]$d8 - lda #<$d8 - jsr p8b_main.p8s_fail_word - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_splitw_lt.p8:2320 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_289_afterif - ; source: test_word_splitw_lt.p8:2322 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lt.p8:2324 if x$d9 - lda #<$d9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2328 skip49a: -p8l_skip49a - ; source: test_word_splitw_lt.p8:2330 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2331 if x$da - lda #<$da - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2335 skip49b: -p8l_skip49b - ; source: test_word_splitw_lt.p8:2337 if x$db - lda #<$db - jsr p8b_main.p8s_fail_word -label_asm_291_afterif - ; source: test_word_splitw_lt.p8:2341 if x$dc - lda #<$dc - jsr p8b_main.p8s_fail_word - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_splitw_lt.p8:2344 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_292_afterif - ; source: test_word_splitw_lt.p8:2347 if sources[1]$dd - lda #<$dd - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2351 skip49c: -p8l_skip49c - ; source: test_word_splitw_lt.p8:2353 cx16.r3 = &lbl49d - lda #p8l_lbl49d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lt.p8:2354 if sources[1]$de - lda #<$de - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lt.p8:2358 skip49d: -p8l_skip49d - ; source: test_word_splitw_lt.p8:2360 if sources[1]$df - lda #<$df - jsr p8b_main.p8s_fail_word -label_asm_294_afterif - ; source: test_word_splitw_lt.p8:2364 if sources[1]$e0 - lda #<$e0 - jsr p8b_main.p8s_fail_word - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_splitw_lt.p8:2367 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_295_afterif - ; source: test_word_splitw_lt.p8:2369 verify_success(224) - ldy #>$e0 - lda #<$e0 - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_lt.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-than split words array tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $54, $48, $41, $4e, $20, $53, $50, $4c, $49, $54 - .byte $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59, $20, $54, $45, $53 - .byte $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_splitw_lt.p8 b/compiler/test/comparisons/test_word_splitw_lt.p8 deleted file mode 100644 index 8e317f108..000000000 --- a/compiler/test/comparisons/test_word_splitw_lt.p8 +++ /dev/null @@ -1,2373 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\nless-than split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n0 - ; reset all variables in BSS section to zero - lda #prog8_bss_section_start - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldx #prog8_bss_section_size - lda #0 - jsr prog8_lib.memset - .endif - jsr p8b_main.prog8_init_vars -+ - clv - clc -; statements - ; source: test_word_splitw_lte.p8:14 txt.print("\nless-equal split words array tests for: ") - ldy #>prog8_interned_strings.string_1 - lda #p8b_main.p8v_datatype - lda #prog8_interned_strings.string_2 - lda #prog8_interned_strings.string_4 - lda #prog8_interned_strings.string_5 - lda #prog8_interned_strings.string_6 - lda #prog8_interned_strings.string_7 - lda #-$5545 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lte.p8:53 sources[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_sources_lsb,y - lda #>-$5545 - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:54 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:56 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl1a - ; source: test_word_splitw_lte.p8:58 goto skip1a - bra p8l_skip1a - ; source: test_word_splitw_lte.p8:59 lbl1a: success++ -p8l_lbl1a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:60 skip1a: -p8l_skip1a - ; source: test_word_splitw_lte.p8:62 cx16.r3 = &lbl1b - lda #p8l_lbl1b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:63 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:65 goto skip1b - bra p8l_skip1b - ; source: test_word_splitw_lte.p8:66 lbl1b: success++ -p8l_lbl1b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:67 skip1b: -p8l_skip1b - ; source: test_word_splitw_lte.p8:69 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_3_afterif - ; source: test_word_splitw_lte.p8:70 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_3_afterif - ; source: test_word_splitw_lte.p8:73 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_5_else - ; source: test_word_splitw_lte.p8:74 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_4_afterif -label_asm_5_else - ; source: test_word_splitw_lte.p8:76 cx16.r0L++ - inc cx16.r0L -label_asm_4_afterif - ; source: test_word_splitw_lte.p8:79 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl1c - ; source: test_word_splitw_lte.p8:81 goto skip1c - bra p8l_skip1c - ; source: test_word_splitw_lte.p8:82 lbl1c: success++ -p8l_lbl1c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:83 skip1c: -p8l_skip1c - ; source: test_word_splitw_lte.p8:85 cx16.r3 = &lbl1d - lda #p8l_lbl1d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:86 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:88 goto skip1d - bra p8l_skip1d - ; source: test_word_splitw_lte.p8:89 lbl1d: success++ -p8l_lbl1d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:90 skip1d: -p8l_skip1d - ; source: test_word_splitw_lte.p8:92 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_6_afterif - ; source: test_word_splitw_lte.p8:93 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_6_afterif - ; source: test_word_splitw_lte.p8:96 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_8_else - ; source: test_word_splitw_lte.p8:97 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_7_afterif -label_asm_8_else - ; source: test_word_splitw_lte.p8:99 cx16.r0L++ - inc cx16.r0L -label_asm_7_afterif - ; source: test_word_splitw_lte.p8:101 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:103 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl2a - ; source: test_word_splitw_lte.p8:105 goto skip2a - bra p8l_skip2a - ; source: test_word_splitw_lte.p8:106 lbl2a: success++ -p8l_lbl2a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:107 skip2a: -p8l_skip2a - ; source: test_word_splitw_lte.p8:109 cx16.r3 = &lbl2b - lda #p8l_lbl2b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:110 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:112 goto skip2b - bra p8l_skip2b - ; source: test_word_splitw_lte.p8:113 lbl2b: success++ -p8l_lbl2b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:114 skip2b: -p8l_skip2b - ; source: test_word_splitw_lte.p8:116 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_9_afterif - ; source: test_word_splitw_lte.p8:117 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_9_afterif - ; source: test_word_splitw_lte.p8:120 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_11_else - ; source: test_word_splitw_lte.p8:121 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_10_afterif -label_asm_11_else - ; source: test_word_splitw_lte.p8:123 cx16.r0L++ - inc cx16.r0L -label_asm_10_afterif - ; source: test_word_splitw_lte.p8:126 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl2c - ; source: test_word_splitw_lte.p8:128 goto skip2c - bra p8l_skip2c - ; source: test_word_splitw_lte.p8:129 lbl2c: success++ -p8l_lbl2c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:130 skip2c: -p8l_skip2c - ; source: test_word_splitw_lte.p8:132 cx16.r3 = &lbl2d - lda #p8l_lbl2d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:133 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:135 goto skip2d - bra p8l_skip2d - ; source: test_word_splitw_lte.p8:136 lbl2d: success++ -p8l_lbl2d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:137 skip2d: -p8l_skip2d - ; source: test_word_splitw_lte.p8:139 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_12_afterif - ; source: test_word_splitw_lte.p8:140 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_12_afterif - ; source: test_word_splitw_lte.p8:143 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_14_else - ; source: test_word_splitw_lte.p8:144 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_13_afterif -label_asm_14_else - ; source: test_word_splitw_lte.p8:146 cx16.r0L++ - inc cx16.r0L -label_asm_13_afterif - ; source: test_word_splitw_lte.p8:148 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:150 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl3a - ; source: test_word_splitw_lte.p8:152 goto skip3a - bra p8l_skip3a - ; source: test_word_splitw_lte.p8:153 lbl3a: success++ -p8l_lbl3a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:154 skip3a: -p8l_skip3a - ; source: test_word_splitw_lte.p8:156 cx16.r3 = &lbl3b - lda #p8l_lbl3b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:157 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:159 goto skip3b - bra p8l_skip3b - ; source: test_word_splitw_lte.p8:160 lbl3b: success++ -p8l_lbl3b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:161 skip3b: -p8l_skip3b - ; source: test_word_splitw_lte.p8:163 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_15_afterif - ; source: test_word_splitw_lte.p8:164 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_15_afterif - ; source: test_word_splitw_lte.p8:167 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_17_else - ; source: test_word_splitw_lte.p8:168 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_16_afterif -label_asm_17_else - ; source: test_word_splitw_lte.p8:170 cx16.r0L++ - inc cx16.r0L -label_asm_16_afterif - ; source: test_word_splitw_lte.p8:173 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl3c - ; source: test_word_splitw_lte.p8:175 goto skip3c - bra p8l_skip3c - ; source: test_word_splitw_lte.p8:176 lbl3c: success++ -p8l_lbl3c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:177 skip3c: -p8l_skip3c - ; source: test_word_splitw_lte.p8:179 cx16.r3 = &lbl3d - lda #p8l_lbl3d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:180 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:182 goto skip3d - bra p8l_skip3d - ; source: test_word_splitw_lte.p8:183 lbl3d: success++ -p8l_lbl3d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:184 skip3d: -p8l_skip3d - ; source: test_word_splitw_lte.p8:186 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_18_afterif - ; source: test_word_splitw_lte.p8:187 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_18_afterif - ; source: test_word_splitw_lte.p8:190 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_20_else - ; source: test_word_splitw_lte.p8:191 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_19_afterif -label_asm_20_else - ; source: test_word_splitw_lte.p8:193 cx16.r0L++ - inc cx16.r0L -label_asm_19_afterif - ; source: test_word_splitw_lte.p8:195 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:197 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl4a - ; source: test_word_splitw_lte.p8:199 goto skip4a - bra p8l_skip4a - ; source: test_word_splitw_lte.p8:200 lbl4a: success++ -p8l_lbl4a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:201 skip4a: -p8l_skip4a - ; source: test_word_splitw_lte.p8:203 cx16.r3 = &lbl4b - lda #p8l_lbl4b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:204 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:206 goto skip4b - bra p8l_skip4b - ; source: test_word_splitw_lte.p8:207 lbl4b: success++ -p8l_lbl4b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:208 skip4b: -p8l_skip4b - ; source: test_word_splitw_lte.p8:210 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_21_afterif - ; source: test_word_splitw_lte.p8:211 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_21_afterif - ; source: test_word_splitw_lte.p8:214 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_23_else - ; source: test_word_splitw_lte.p8:215 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_22_afterif -label_asm_23_else - ; source: test_word_splitw_lte.p8:217 cx16.r0L++ - inc cx16.r0L -label_asm_22_afterif - ; source: test_word_splitw_lte.p8:220 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl4c - ; source: test_word_splitw_lte.p8:222 goto skip4c - bra p8l_skip4c - ; source: test_word_splitw_lte.p8:223 lbl4c: success++ -p8l_lbl4c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:224 skip4c: -p8l_skip4c - ; source: test_word_splitw_lte.p8:226 cx16.r3 = &lbl4d - lda #p8l_lbl4d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:227 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:229 goto skip4d - bra p8l_skip4d - ; source: test_word_splitw_lte.p8:230 lbl4d: success++ -p8l_lbl4d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:231 skip4d: -p8l_skip4d - ; source: test_word_splitw_lte.p8:233 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_24_afterif - ; source: test_word_splitw_lte.p8:234 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_24_afterif - ; source: test_word_splitw_lte.p8:237 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_26_else - ; source: test_word_splitw_lte.p8:238 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_25_afterif -label_asm_26_else - ; source: test_word_splitw_lte.p8:240 cx16.r0L++ - inc cx16.r0L -label_asm_25_afterif - ; source: test_word_splitw_lte.p8:242 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:244 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl5a - ; source: test_word_splitw_lte.p8:246 goto skip5a - bra p8l_skip5a - ; source: test_word_splitw_lte.p8:247 lbl5a: success++ -p8l_lbl5a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:248 skip5a: -p8l_skip5a - ; source: test_word_splitw_lte.p8:250 cx16.r3 = &lbl5b - lda #p8l_lbl5b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:251 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:253 goto skip5b - bra p8l_skip5b - ; source: test_word_splitw_lte.p8:254 lbl5b: success++ -p8l_lbl5b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:255 skip5b: -p8l_skip5b - ; source: test_word_splitw_lte.p8:257 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_27_afterif - ; source: test_word_splitw_lte.p8:258 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_27_afterif - ; source: test_word_splitw_lte.p8:261 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_29_else - ; source: test_word_splitw_lte.p8:262 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_28_afterif -label_asm_29_else - ; source: test_word_splitw_lte.p8:264 cx16.r0L++ - inc cx16.r0L -label_asm_28_afterif - ; source: test_word_splitw_lte.p8:267 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl5c - ; source: test_word_splitw_lte.p8:269 goto skip5c - bra p8l_skip5c - ; source: test_word_splitw_lte.p8:270 lbl5c: success++ -p8l_lbl5c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:271 skip5c: -p8l_skip5c - ; source: test_word_splitw_lte.p8:273 cx16.r3 = &lbl5d - lda #p8l_lbl5d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:274 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:276 goto skip5d - bra p8l_skip5d - ; source: test_word_splitw_lte.p8:277 lbl5d: success++ -p8l_lbl5d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:278 skip5d: -p8l_skip5d - ; source: test_word_splitw_lte.p8:280 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_30_afterif - ; source: test_word_splitw_lte.p8:281 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_30_afterif - ; source: test_word_splitw_lte.p8:284 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_32_else - ; source: test_word_splitw_lte.p8:285 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_31_afterif -label_asm_32_else - ; source: test_word_splitw_lte.p8:287 cx16.r0L++ - inc cx16.r0L -label_asm_31_afterif - ; source: test_word_splitw_lte.p8:289 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:291 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl6a - ; source: test_word_splitw_lte.p8:293 goto skip6a - bra p8l_skip6a - ; source: test_word_splitw_lte.p8:294 lbl6a: success++ -p8l_lbl6a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:295 skip6a: -p8l_skip6a - ; source: test_word_splitw_lte.p8:297 cx16.r3 = &lbl6b - lda #p8l_lbl6b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:298 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:300 goto skip6b - bra p8l_skip6b - ; source: test_word_splitw_lte.p8:301 lbl6b: success++ -p8l_lbl6b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:302 skip6b: -p8l_skip6b - ; source: test_word_splitw_lte.p8:304 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_33_afterif - ; source: test_word_splitw_lte.p8:305 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_33_afterif - ; source: test_word_splitw_lte.p8:308 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_35_else - ; source: test_word_splitw_lte.p8:309 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_34_afterif -label_asm_35_else - ; source: test_word_splitw_lte.p8:311 cx16.r0L++ - inc cx16.r0L -label_asm_34_afterif - ; source: test_word_splitw_lte.p8:314 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl6c - ; source: test_word_splitw_lte.p8:316 goto skip6c - bra p8l_skip6c - ; source: test_word_splitw_lte.p8:317 lbl6c: success++ -p8l_lbl6c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:318 skip6c: -p8l_skip6c - ; source: test_word_splitw_lte.p8:320 cx16.r3 = &lbl6d - lda #p8l_lbl6d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:321 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:323 goto skip6d - bra p8l_skip6d - ; source: test_word_splitw_lte.p8:324 lbl6d: success++ -p8l_lbl6d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:325 skip6d: -p8l_skip6d - ; source: test_word_splitw_lte.p8:327 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_36_afterif - ; source: test_word_splitw_lte.p8:328 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_36_afterif - ; source: test_word_splitw_lte.p8:331 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_38_else - ; source: test_word_splitw_lte.p8:332 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_37_afterif -label_asm_38_else - ; source: test_word_splitw_lte.p8:334 cx16.r0L++ - inc cx16.r0L -label_asm_37_afterif - ; source: test_word_splitw_lte.p8:336 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:338 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl7a - ; source: test_word_splitw_lte.p8:340 goto skip7a - bra p8l_skip7a - ; source: test_word_splitw_lte.p8:341 lbl7a: success++ -p8l_lbl7a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:342 skip7a: -p8l_skip7a - ; source: test_word_splitw_lte.p8:344 cx16.r3 = &lbl7b - lda #p8l_lbl7b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:345 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:347 goto skip7b - bra p8l_skip7b - ; source: test_word_splitw_lte.p8:348 lbl7b: success++ -p8l_lbl7b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:349 skip7b: -p8l_skip7b - ; source: test_word_splitw_lte.p8:351 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_39_afterif - ; source: test_word_splitw_lte.p8:352 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_39_afterif - ; source: test_word_splitw_lte.p8:355 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_41_else - ; source: test_word_splitw_lte.p8:356 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_40_afterif -label_asm_41_else - ; source: test_word_splitw_lte.p8:358 cx16.r0L++ - inc cx16.r0L -label_asm_40_afterif - ; source: test_word_splitw_lte.p8:361 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl7c - ; source: test_word_splitw_lte.p8:363 goto skip7c - bra p8l_skip7c - ; source: test_word_splitw_lte.p8:364 lbl7c: success++ -p8l_lbl7c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:365 skip7c: -p8l_skip7c - ; source: test_word_splitw_lte.p8:367 cx16.r3 = &lbl7d - lda #p8l_lbl7d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:368 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:370 goto skip7d - bra p8l_skip7d - ; source: test_word_splitw_lte.p8:371 lbl7d: success++ -p8l_lbl7d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:372 skip7d: -p8l_skip7d - ; source: test_word_splitw_lte.p8:374 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_42_afterif - ; source: test_word_splitw_lte.p8:375 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_42_afterif - ; source: test_word_splitw_lte.p8:378 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_44_else - ; source: test_word_splitw_lte.p8:379 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_43_afterif -label_asm_44_else - ; source: test_word_splitw_lte.p8:381 cx16.r0L++ - inc cx16.r0L -label_asm_43_afterif - ; source: test_word_splitw_lte.p8:383 x=-1 - lda #<-1 - ldy #>-1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lte.p8:384 sources[1]=-1 - ldy #1 - lda #<-1 - sta p8v_sources_lsb,y - lda #>-1 - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:385 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:387 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl8a - ; source: test_word_splitw_lte.p8:389 goto skip8a - bra p8l_skip8a - ; source: test_word_splitw_lte.p8:390 lbl8a: fail_word(1) -p8l_lbl8a - ldy #>1 - lda #<1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:391 skip8a: -p8l_skip8a - ; source: test_word_splitw_lte.p8:393 cx16.r3 = &lbl8b - lda #p8l_lbl8b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:394 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:396 goto skip8b - bra p8l_skip8b - ; source: test_word_splitw_lte.p8:397 lbl8b: fail_word(2) -p8l_lbl8b - ldy #>2 - lda #<2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:398 skip8b: -p8l_skip8b - ; source: test_word_splitw_lte.p8:400 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_45_afterif - ; source: test_word_splitw_lte.p8:401 fail_word(3) - ldy #>3 - lda #<3 - jsr p8b_main.p8s_fail_word -label_asm_45_afterif - ; source: test_word_splitw_lte.p8:404 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_47_else - ; source: test_word_splitw_lte.p8:405 fail_word(4) - ldy #>4 - lda #<4 - jsr p8b_main.p8s_fail_word - bra label_asm_46_afterif -label_asm_47_else - ; source: test_word_splitw_lte.p8:407 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_46_afterif - ; source: test_word_splitw_lte.p8:410 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl8c - ; source: test_word_splitw_lte.p8:412 goto skip8c - bra p8l_skip8c - ; source: test_word_splitw_lte.p8:413 lbl8c: fail_word(5) -p8l_lbl8c - ldy #>5 - lda #<5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:414 skip8c: -p8l_skip8c - ; source: test_word_splitw_lte.p8:416 cx16.r3 = &lbl8d - lda #p8l_lbl8d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:417 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:419 goto skip8d - bra p8l_skip8d - ; source: test_word_splitw_lte.p8:420 lbl8d: fail_word(6) -p8l_lbl8d - ldy #>6 - lda #<6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:421 skip8d: -p8l_skip8d - ; source: test_word_splitw_lte.p8:423 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_48_afterif - ; source: test_word_splitw_lte.p8:424 fail_word(7) - ldy #>7 - lda #<7 - jsr p8b_main.p8s_fail_word -label_asm_48_afterif - ; source: test_word_splitw_lte.p8:427 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_50_else - ; source: test_word_splitw_lte.p8:428 fail_word(8) - ldy #>8 - lda #<8 - jsr p8b_main.p8s_fail_word - bra label_asm_49_afterif -label_asm_50_else - ; source: test_word_splitw_lte.p8:430 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_49_afterif - ; source: test_word_splitw_lte.p8:432 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:434 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl9a - ; source: test_word_splitw_lte.p8:436 goto skip9a - bra p8l_skip9a - ; source: test_word_splitw_lte.p8:437 lbl9a: success++ -p8l_lbl9a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:438 skip9a: -p8l_skip9a - ; source: test_word_splitw_lte.p8:440 cx16.r3 = &lbl9b - lda #p8l_lbl9b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:441 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:443 goto skip9b - bra p8l_skip9b - ; source: test_word_splitw_lte.p8:444 lbl9b: success++ -p8l_lbl9b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:445 skip9b: -p8l_skip9b - ; source: test_word_splitw_lte.p8:447 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_51_afterif - ; source: test_word_splitw_lte.p8:448 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_51_afterif - ; source: test_word_splitw_lte.p8:451 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_53_else - ; source: test_word_splitw_lte.p8:452 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_52_afterif -label_asm_53_else - ; source: test_word_splitw_lte.p8:454 cx16.r0L++ - inc cx16.r0L -label_asm_52_afterif - ; source: test_word_splitw_lte.p8:457 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl9c - ; source: test_word_splitw_lte.p8:459 goto skip9c - bra p8l_skip9c - ; source: test_word_splitw_lte.p8:460 lbl9c: success++ -p8l_lbl9c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:461 skip9c: -p8l_skip9c - ; source: test_word_splitw_lte.p8:463 cx16.r3 = &lbl9d - lda #p8l_lbl9d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:464 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:466 goto skip9d - bra p8l_skip9d - ; source: test_word_splitw_lte.p8:467 lbl9d: success++ -p8l_lbl9d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:468 skip9d: -p8l_skip9d - ; source: test_word_splitw_lte.p8:470 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_54_afterif - ; source: test_word_splitw_lte.p8:471 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_54_afterif - ; source: test_word_splitw_lte.p8:474 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_56_else - ; source: test_word_splitw_lte.p8:475 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_55_afterif -label_asm_56_else - ; source: test_word_splitw_lte.p8:477 cx16.r0L++ - inc cx16.r0L -label_asm_55_afterif - ; source: test_word_splitw_lte.p8:479 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:481 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl10a - ; source: test_word_splitw_lte.p8:483 goto skip10a - bra p8l_skip10a - ; source: test_word_splitw_lte.p8:484 lbl10a: success++ -p8l_lbl10a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:485 skip10a: -p8l_skip10a - ; source: test_word_splitw_lte.p8:487 cx16.r3 = &lbl10b - lda #p8l_lbl10b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:488 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:490 goto skip10b - bra p8l_skip10b - ; source: test_word_splitw_lte.p8:491 lbl10b: success++ -p8l_lbl10b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:492 skip10b: -p8l_skip10b - ; source: test_word_splitw_lte.p8:494 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_57_afterif - ; source: test_word_splitw_lte.p8:495 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_57_afterif - ; source: test_word_splitw_lte.p8:498 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_59_else - ; source: test_word_splitw_lte.p8:499 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_58_afterif -label_asm_59_else - ; source: test_word_splitw_lte.p8:501 cx16.r0L++ - inc cx16.r0L -label_asm_58_afterif - ; source: test_word_splitw_lte.p8:504 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl10c - ; source: test_word_splitw_lte.p8:506 goto skip10c - bra p8l_skip10c - ; source: test_word_splitw_lte.p8:507 lbl10c: success++ -p8l_lbl10c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:508 skip10c: -p8l_skip10c - ; source: test_word_splitw_lte.p8:510 cx16.r3 = &lbl10d - lda #p8l_lbl10d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:511 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:513 goto skip10d - bra p8l_skip10d - ; source: test_word_splitw_lte.p8:514 lbl10d: success++ -p8l_lbl10d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:515 skip10d: -p8l_skip10d - ; source: test_word_splitw_lte.p8:517 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_60_afterif - ; source: test_word_splitw_lte.p8:518 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_60_afterif - ; source: test_word_splitw_lte.p8:521 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_62_else - ; source: test_word_splitw_lte.p8:522 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_61_afterif -label_asm_62_else - ; source: test_word_splitw_lte.p8:524 cx16.r0L++ - inc cx16.r0L -label_asm_61_afterif - ; source: test_word_splitw_lte.p8:526 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:528 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl11a - ; source: test_word_splitw_lte.p8:530 goto skip11a - bra p8l_skip11a - ; source: test_word_splitw_lte.p8:531 lbl11a: success++ -p8l_lbl11a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:532 skip11a: -p8l_skip11a - ; source: test_word_splitw_lte.p8:534 cx16.r3 = &lbl11b - lda #p8l_lbl11b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:535 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:537 goto skip11b - bra p8l_skip11b - ; source: test_word_splitw_lte.p8:538 lbl11b: success++ -p8l_lbl11b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:539 skip11b: -p8l_skip11b - ; source: test_word_splitw_lte.p8:541 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_63_afterif - ; source: test_word_splitw_lte.p8:542 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_63_afterif - ; source: test_word_splitw_lte.p8:545 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_65_else - ; source: test_word_splitw_lte.p8:546 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_64_afterif -label_asm_65_else - ; source: test_word_splitw_lte.p8:548 cx16.r0L++ - inc cx16.r0L -label_asm_64_afterif - ; source: test_word_splitw_lte.p8:551 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl11c - ; source: test_word_splitw_lte.p8:553 goto skip11c - bra p8l_skip11c - ; source: test_word_splitw_lte.p8:554 lbl11c: success++ -p8l_lbl11c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:555 skip11c: -p8l_skip11c - ; source: test_word_splitw_lte.p8:557 cx16.r3 = &lbl11d - lda #p8l_lbl11d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:558 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:560 goto skip11d - bra p8l_skip11d - ; source: test_word_splitw_lte.p8:561 lbl11d: success++ -p8l_lbl11d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:562 skip11d: -p8l_skip11d - ; source: test_word_splitw_lte.p8:564 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_66_afterif - ; source: test_word_splitw_lte.p8:565 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_66_afterif - ; source: test_word_splitw_lte.p8:568 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_68_else - ; source: test_word_splitw_lte.p8:569 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_67_afterif -label_asm_68_else - ; source: test_word_splitw_lte.p8:571 cx16.r0L++ - inc cx16.r0L -label_asm_67_afterif - ; source: test_word_splitw_lte.p8:573 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:575 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl12a - ; source: test_word_splitw_lte.p8:577 goto skip12a - bra p8l_skip12a - ; source: test_word_splitw_lte.p8:578 lbl12a: success++ -p8l_lbl12a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:579 skip12a: -p8l_skip12a - ; source: test_word_splitw_lte.p8:581 cx16.r3 = &lbl12b - lda #p8l_lbl12b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:582 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:584 goto skip12b - bra p8l_skip12b - ; source: test_word_splitw_lte.p8:585 lbl12b: success++ -p8l_lbl12b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:586 skip12b: -p8l_skip12b - ; source: test_word_splitw_lte.p8:588 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_69_afterif - ; source: test_word_splitw_lte.p8:589 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_69_afterif - ; source: test_word_splitw_lte.p8:592 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_71_else - ; source: test_word_splitw_lte.p8:593 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_70_afterif -label_asm_71_else - ; source: test_word_splitw_lte.p8:595 cx16.r0L++ - inc cx16.r0L -label_asm_70_afterif - ; source: test_word_splitw_lte.p8:598 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl12c - ; source: test_word_splitw_lte.p8:600 goto skip12c - bra p8l_skip12c - ; source: test_word_splitw_lte.p8:601 lbl12c: success++ -p8l_lbl12c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:602 skip12c: -p8l_skip12c - ; source: test_word_splitw_lte.p8:604 cx16.r3 = &lbl12d - lda #p8l_lbl12d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:605 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:607 goto skip12d - bra p8l_skip12d - ; source: test_word_splitw_lte.p8:608 lbl12d: success++ -p8l_lbl12d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:609 skip12d: -p8l_skip12d - ; source: test_word_splitw_lte.p8:611 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_72_afterif - ; source: test_word_splitw_lte.p8:612 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_72_afterif - ; source: test_word_splitw_lte.p8:615 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_74_else - ; source: test_word_splitw_lte.p8:616 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_73_afterif -label_asm_74_else - ; source: test_word_splitw_lte.p8:618 cx16.r0L++ - inc cx16.r0L -label_asm_73_afterif - ; source: test_word_splitw_lte.p8:620 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:622 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl13a - ; source: test_word_splitw_lte.p8:624 goto skip13a - bra p8l_skip13a - ; source: test_word_splitw_lte.p8:625 lbl13a: success++ -p8l_lbl13a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:626 skip13a: -p8l_skip13a - ; source: test_word_splitw_lte.p8:628 cx16.r3 = &lbl13b - lda #p8l_lbl13b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:629 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:631 goto skip13b - bra p8l_skip13b - ; source: test_word_splitw_lte.p8:632 lbl13b: success++ -p8l_lbl13b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:633 skip13b: -p8l_skip13b - ; source: test_word_splitw_lte.p8:635 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_75_afterif - ; source: test_word_splitw_lte.p8:636 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_75_afterif - ; source: test_word_splitw_lte.p8:639 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_77_else - ; source: test_word_splitw_lte.p8:640 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_76_afterif -label_asm_77_else - ; source: test_word_splitw_lte.p8:642 cx16.r0L++ - inc cx16.r0L -label_asm_76_afterif - ; source: test_word_splitw_lte.p8:645 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl13c - ; source: test_word_splitw_lte.p8:647 goto skip13c - bra p8l_skip13c - ; source: test_word_splitw_lte.p8:648 lbl13c: success++ -p8l_lbl13c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:649 skip13c: -p8l_skip13c - ; source: test_word_splitw_lte.p8:651 cx16.r3 = &lbl13d - lda #p8l_lbl13d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:652 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:654 goto skip13d - bra p8l_skip13d - ; source: test_word_splitw_lte.p8:655 lbl13d: success++ -p8l_lbl13d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:656 skip13d: -p8l_skip13d - ; source: test_word_splitw_lte.p8:658 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_78_afterif - ; source: test_word_splitw_lte.p8:659 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_78_afterif - ; source: test_word_splitw_lte.p8:662 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_80_else - ; source: test_word_splitw_lte.p8:663 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_79_afterif -label_asm_80_else - ; source: test_word_splitw_lte.p8:665 cx16.r0L++ - inc cx16.r0L -label_asm_79_afterif - ; source: test_word_splitw_lte.p8:667 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:669 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl14a - ; source: test_word_splitw_lte.p8:671 goto skip14a - bra p8l_skip14a - ; source: test_word_splitw_lte.p8:672 lbl14a: success++ -p8l_lbl14a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:673 skip14a: -p8l_skip14a - ; source: test_word_splitw_lte.p8:675 cx16.r3 = &lbl14b - lda #p8l_lbl14b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:676 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:678 goto skip14b - bra p8l_skip14b - ; source: test_word_splitw_lte.p8:679 lbl14b: success++ -p8l_lbl14b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:680 skip14b: -p8l_skip14b - ; source: test_word_splitw_lte.p8:682 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_81_afterif - ; source: test_word_splitw_lte.p8:683 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_81_afterif - ; source: test_word_splitw_lte.p8:686 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_83_else - ; source: test_word_splitw_lte.p8:687 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_82_afterif -label_asm_83_else - ; source: test_word_splitw_lte.p8:689 cx16.r0L++ - inc cx16.r0L -label_asm_82_afterif - ; source: test_word_splitw_lte.p8:692 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl14c - ; source: test_word_splitw_lte.p8:694 goto skip14c - bra p8l_skip14c - ; source: test_word_splitw_lte.p8:695 lbl14c: success++ -p8l_lbl14c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:696 skip14c: -p8l_skip14c - ; source: test_word_splitw_lte.p8:698 cx16.r3 = &lbl14d - lda #p8l_lbl14d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:699 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:701 goto skip14d - bra p8l_skip14d - ; source: test_word_splitw_lte.p8:702 lbl14d: success++ -p8l_lbl14d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:703 skip14d: -p8l_skip14d - ; source: test_word_splitw_lte.p8:705 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_84_afterif - ; source: test_word_splitw_lte.p8:706 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_84_afterif - ; source: test_word_splitw_lte.p8:709 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_86_else - ; source: test_word_splitw_lte.p8:710 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_85_afterif -label_asm_86_else - ; source: test_word_splitw_lte.p8:712 cx16.r0L++ - inc cx16.r0L -label_asm_85_afterif - ; source: test_word_splitw_lte.p8:714 x=0 - stz p8v_x - stz p8v_x+1 - ; source: test_word_splitw_lte.p8:715 sources[1]=0 - ldy #1 - lda #0 - sta p8v_sources_lsb,y - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:716 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:718 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl15a - ; source: test_word_splitw_lte.p8:720 goto skip15a - bra p8l_skip15a - ; source: test_word_splitw_lte.p8:721 lbl15a: fail_word(9) -p8l_lbl15a - ldy #>9 - lda #<9 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:722 skip15a: -p8l_skip15a - ; source: test_word_splitw_lte.p8:724 cx16.r3 = &lbl15b - lda #p8l_lbl15b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:725 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:727 goto skip15b - bra p8l_skip15b - ; source: test_word_splitw_lte.p8:728 lbl15b: fail_word(10) -p8l_lbl15b - ldy #>10 - lda #<10 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:729 skip15b: -p8l_skip15b - ; source: test_word_splitw_lte.p8:731 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_87_afterif - ; source: test_word_splitw_lte.p8:732 fail_word(11) - ldy #>11 - lda #<11 - jsr p8b_main.p8s_fail_word -label_asm_87_afterif - ; source: test_word_splitw_lte.p8:735 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_89_else - ; source: test_word_splitw_lte.p8:736 fail_word(12) - ldy #>12 - lda #<12 - jsr p8b_main.p8s_fail_word - bra label_asm_88_afterif -label_asm_89_else - ; source: test_word_splitw_lte.p8:738 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_88_afterif - ; source: test_word_splitw_lte.p8:741 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl15c - ; source: test_word_splitw_lte.p8:743 goto skip15c - bra p8l_skip15c - ; source: test_word_splitw_lte.p8:744 lbl15c: fail_word(13) -p8l_lbl15c - ldy #>13 - lda #<13 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:745 skip15c: -p8l_skip15c - ; source: test_word_splitw_lte.p8:747 cx16.r3 = &lbl15d - lda #p8l_lbl15d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:748 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:750 goto skip15d - bra p8l_skip15d - ; source: test_word_splitw_lte.p8:751 lbl15d: fail_word(14) -p8l_lbl15d - ldy #>14 - lda #<14 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:752 skip15d: -p8l_skip15d - ; source: test_word_splitw_lte.p8:754 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_90_afterif - ; source: test_word_splitw_lte.p8:755 fail_word(15) - ldy #>15 - lda #<15 - jsr p8b_main.p8s_fail_word -label_asm_90_afterif - ; source: test_word_splitw_lte.p8:758 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_92_else - ; source: test_word_splitw_lte.p8:759 fail_word(16) - ldy #>$10 - lda #<$10 - jsr p8b_main.p8s_fail_word - bra label_asm_91_afterif -label_asm_92_else - ; source: test_word_splitw_lte.p8:761 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_91_afterif - ; source: test_word_splitw_lte.p8:763 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:765 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl16a - ; source: test_word_splitw_lte.p8:767 goto skip16a - bra p8l_skip16a - ; source: test_word_splitw_lte.p8:768 lbl16a: fail_word(17) -p8l_lbl16a - ldy #>$11 - lda #<$11 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:769 skip16a: -p8l_skip16a - ; source: test_word_splitw_lte.p8:771 cx16.r3 = &lbl16b - lda #p8l_lbl16b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:772 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:774 goto skip16b - bra p8l_skip16b - ; source: test_word_splitw_lte.p8:775 lbl16b: fail_word(18) -p8l_lbl16b - ldy #>$12 - lda #<$12 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:776 skip16b: -p8l_skip16b - ; source: test_word_splitw_lte.p8:778 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_93_afterif - ; source: test_word_splitw_lte.p8:779 fail_word(19) - ldy #>$13 - lda #<$13 - jsr p8b_main.p8s_fail_word -label_asm_93_afterif - ; source: test_word_splitw_lte.p8:782 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_95_else - ; source: test_word_splitw_lte.p8:783 fail_word(20) - ldy #>$14 - lda #<$14 - jsr p8b_main.p8s_fail_word - bra label_asm_94_afterif -label_asm_95_else - ; source: test_word_splitw_lte.p8:785 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_94_afterif - ; source: test_word_splitw_lte.p8:788 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl16c - ; source: test_word_splitw_lte.p8:790 goto skip16c - bra p8l_skip16c - ; source: test_word_splitw_lte.p8:791 lbl16c: fail_word(21) -p8l_lbl16c - ldy #>$15 - lda #<$15 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:792 skip16c: -p8l_skip16c - ; source: test_word_splitw_lte.p8:794 cx16.r3 = &lbl16d - lda #p8l_lbl16d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:795 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:797 goto skip16d - bra p8l_skip16d - ; source: test_word_splitw_lte.p8:798 lbl16d: fail_word(22) -p8l_lbl16d - ldy #>$16 - lda #<$16 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:799 skip16d: -p8l_skip16d - ; source: test_word_splitw_lte.p8:801 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_96_afterif - ; source: test_word_splitw_lte.p8:802 fail_word(23) - ldy #>$17 - lda #<$17 - jsr p8b_main.p8s_fail_word -label_asm_96_afterif - ; source: test_word_splitw_lte.p8:805 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_98_else - ; source: test_word_splitw_lte.p8:806 fail_word(24) - ldy #>$18 - lda #<$18 - jsr p8b_main.p8s_fail_word - bra label_asm_97_afterif -label_asm_98_else - ; source: test_word_splitw_lte.p8:808 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_97_afterif - ; source: test_word_splitw_lte.p8:810 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:812 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl17a - ; source: test_word_splitw_lte.p8:814 goto skip17a - bra p8l_skip17a - ; source: test_word_splitw_lte.p8:815 lbl17a: success++ -p8l_lbl17a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:816 skip17a: -p8l_skip17a - ; source: test_word_splitw_lte.p8:818 cx16.r3 = &lbl17b - lda #p8l_lbl17b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:819 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:821 goto skip17b - bra p8l_skip17b - ; source: test_word_splitw_lte.p8:822 lbl17b: success++ -p8l_lbl17b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:823 skip17b: -p8l_skip17b - ; source: test_word_splitw_lte.p8:825 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_99_afterif - ; source: test_word_splitw_lte.p8:826 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_99_afterif - ; source: test_word_splitw_lte.p8:829 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_101_else - ; source: test_word_splitw_lte.p8:830 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_100_afterif -label_asm_101_else - ; source: test_word_splitw_lte.p8:832 cx16.r0L++ - inc cx16.r0L -label_asm_100_afterif - ; source: test_word_splitw_lte.p8:835 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl17c - ; source: test_word_splitw_lte.p8:837 goto skip17c - bra p8l_skip17c - ; source: test_word_splitw_lte.p8:838 lbl17c: success++ -p8l_lbl17c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:839 skip17c: -p8l_skip17c - ; source: test_word_splitw_lte.p8:841 cx16.r3 = &lbl17d - lda #p8l_lbl17d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:842 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:844 goto skip17d - bra p8l_skip17d - ; source: test_word_splitw_lte.p8:845 lbl17d: success++ -p8l_lbl17d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:846 skip17d: -p8l_skip17d - ; source: test_word_splitw_lte.p8:848 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_102_afterif - ; source: test_word_splitw_lte.p8:849 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_102_afterif - ; source: test_word_splitw_lte.p8:852 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_104_else - ; source: test_word_splitw_lte.p8:853 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_103_afterif -label_asm_104_else - ; source: test_word_splitw_lte.p8:855 cx16.r0L++ - inc cx16.r0L -label_asm_103_afterif - ; source: test_word_splitw_lte.p8:857 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:859 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl18a - ; source: test_word_splitw_lte.p8:861 goto skip18a - bra p8l_skip18a - ; source: test_word_splitw_lte.p8:862 lbl18a: success++ -p8l_lbl18a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:863 skip18a: -p8l_skip18a - ; source: test_word_splitw_lte.p8:865 cx16.r3 = &lbl18b - lda #p8l_lbl18b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:866 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:868 goto skip18b - bra p8l_skip18b - ; source: test_word_splitw_lte.p8:869 lbl18b: success++ -p8l_lbl18b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:870 skip18b: -p8l_skip18b - ; source: test_word_splitw_lte.p8:872 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_105_afterif - ; source: test_word_splitw_lte.p8:873 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_105_afterif - ; source: test_word_splitw_lte.p8:876 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_107_else - ; source: test_word_splitw_lte.p8:877 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_106_afterif -label_asm_107_else - ; source: test_word_splitw_lte.p8:879 cx16.r0L++ - inc cx16.r0L -label_asm_106_afterif - ; source: test_word_splitw_lte.p8:882 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl18c - ; source: test_word_splitw_lte.p8:884 goto skip18c - bra p8l_skip18c - ; source: test_word_splitw_lte.p8:885 lbl18c: success++ -p8l_lbl18c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:886 skip18c: -p8l_skip18c - ; source: test_word_splitw_lte.p8:888 cx16.r3 = &lbl18d - lda #p8l_lbl18d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:889 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:891 goto skip18d - bra p8l_skip18d - ; source: test_word_splitw_lte.p8:892 lbl18d: success++ -p8l_lbl18d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:893 skip18d: -p8l_skip18d - ; source: test_word_splitw_lte.p8:895 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_108_afterif - ; source: test_word_splitw_lte.p8:896 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_108_afterif - ; source: test_word_splitw_lte.p8:899 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_110_else - ; source: test_word_splitw_lte.p8:900 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_109_afterif -label_asm_110_else - ; source: test_word_splitw_lte.p8:902 cx16.r0L++ - inc cx16.r0L -label_asm_109_afterif - ; source: test_word_splitw_lte.p8:904 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:906 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl19a - ; source: test_word_splitw_lte.p8:908 goto skip19a - bra p8l_skip19a - ; source: test_word_splitw_lte.p8:909 lbl19a: success++ -p8l_lbl19a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:910 skip19a: -p8l_skip19a - ; source: test_word_splitw_lte.p8:912 cx16.r3 = &lbl19b - lda #p8l_lbl19b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:913 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:915 goto skip19b - bra p8l_skip19b - ; source: test_word_splitw_lte.p8:916 lbl19b: success++ -p8l_lbl19b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:917 skip19b: -p8l_skip19b - ; source: test_word_splitw_lte.p8:919 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_111_afterif - ; source: test_word_splitw_lte.p8:920 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_111_afterif - ; source: test_word_splitw_lte.p8:923 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_113_else - ; source: test_word_splitw_lte.p8:924 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_112_afterif -label_asm_113_else - ; source: test_word_splitw_lte.p8:926 cx16.r0L++ - inc cx16.r0L -label_asm_112_afterif - ; source: test_word_splitw_lte.p8:929 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl19c - ; source: test_word_splitw_lte.p8:931 goto skip19c - bra p8l_skip19c - ; source: test_word_splitw_lte.p8:932 lbl19c: success++ -p8l_lbl19c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:933 skip19c: -p8l_skip19c - ; source: test_word_splitw_lte.p8:935 cx16.r3 = &lbl19d - lda #p8l_lbl19d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:936 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:938 goto skip19d - bra p8l_skip19d - ; source: test_word_splitw_lte.p8:939 lbl19d: success++ -p8l_lbl19d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:940 skip19d: -p8l_skip19d - ; source: test_word_splitw_lte.p8:942 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_114_afterif - ; source: test_word_splitw_lte.p8:943 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_114_afterif - ; source: test_word_splitw_lte.p8:946 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_116_else - ; source: test_word_splitw_lte.p8:947 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_115_afterif -label_asm_116_else - ; source: test_word_splitw_lte.p8:949 cx16.r0L++ - inc cx16.r0L -label_asm_115_afterif - ; source: test_word_splitw_lte.p8:951 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:953 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl20a - ; source: test_word_splitw_lte.p8:955 goto skip20a - bra p8l_skip20a - ; source: test_word_splitw_lte.p8:956 lbl20a: success++ -p8l_lbl20a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:957 skip20a: -p8l_skip20a - ; source: test_word_splitw_lte.p8:959 cx16.r3 = &lbl20b - lda #p8l_lbl20b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:960 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:962 goto skip20b - bra p8l_skip20b - ; source: test_word_splitw_lte.p8:963 lbl20b: success++ -p8l_lbl20b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:964 skip20b: -p8l_skip20b - ; source: test_word_splitw_lte.p8:966 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_117_afterif - ; source: test_word_splitw_lte.p8:967 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_117_afterif - ; source: test_word_splitw_lte.p8:970 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_119_else - ; source: test_word_splitw_lte.p8:971 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_118_afterif -label_asm_119_else - ; source: test_word_splitw_lte.p8:973 cx16.r0L++ - inc cx16.r0L -label_asm_118_afterif - ; source: test_word_splitw_lte.p8:976 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl20c - ; source: test_word_splitw_lte.p8:978 goto skip20c - bra p8l_skip20c - ; source: test_word_splitw_lte.p8:979 lbl20c: success++ -p8l_lbl20c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:980 skip20c: -p8l_skip20c - ; source: test_word_splitw_lte.p8:982 cx16.r3 = &lbl20d - lda #p8l_lbl20d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:983 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:985 goto skip20d - bra p8l_skip20d - ; source: test_word_splitw_lte.p8:986 lbl20d: success++ -p8l_lbl20d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:987 skip20d: -p8l_skip20d - ; source: test_word_splitw_lte.p8:989 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_120_afterif - ; source: test_word_splitw_lte.p8:990 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_120_afterif - ; source: test_word_splitw_lte.p8:993 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_122_else - ; source: test_word_splitw_lte.p8:994 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_121_afterif -label_asm_122_else - ; source: test_word_splitw_lte.p8:996 cx16.r0L++ - inc cx16.r0L -label_asm_121_afterif - ; source: test_word_splitw_lte.p8:998 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1000 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl21a - ; source: test_word_splitw_lte.p8:1002 goto skip21a - bra p8l_skip21a - ; source: test_word_splitw_lte.p8:1003 lbl21a: success++ -p8l_lbl21a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1004 skip21a: -p8l_skip21a - ; source: test_word_splitw_lte.p8:1006 cx16.r3 = &lbl21b - lda #p8l_lbl21b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1007 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1009 goto skip21b - bra p8l_skip21b - ; source: test_word_splitw_lte.p8:1010 lbl21b: success++ -p8l_lbl21b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1011 skip21b: -p8l_skip21b - ; source: test_word_splitw_lte.p8:1013 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_123_afterif - ; source: test_word_splitw_lte.p8:1014 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_123_afterif - ; source: test_word_splitw_lte.p8:1017 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_125_else - ; source: test_word_splitw_lte.p8:1018 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_124_afterif -label_asm_125_else - ; source: test_word_splitw_lte.p8:1020 cx16.r0L++ - inc cx16.r0L -label_asm_124_afterif - ; source: test_word_splitw_lte.p8:1023 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl21c - ; source: test_word_splitw_lte.p8:1025 goto skip21c - bra p8l_skip21c - ; source: test_word_splitw_lte.p8:1026 lbl21c: success++ -p8l_lbl21c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1027 skip21c: -p8l_skip21c - ; source: test_word_splitw_lte.p8:1029 cx16.r3 = &lbl21d - lda #p8l_lbl21d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1030 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1032 goto skip21d - bra p8l_skip21d - ; source: test_word_splitw_lte.p8:1033 lbl21d: success++ -p8l_lbl21d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1034 skip21d: -p8l_skip21d - ; source: test_word_splitw_lte.p8:1036 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_126_afterif - ; source: test_word_splitw_lte.p8:1037 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_126_afterif - ; source: test_word_splitw_lte.p8:1040 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_128_else - ; source: test_word_splitw_lte.p8:1041 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_127_afterif -label_asm_128_else - ; source: test_word_splitw_lte.p8:1043 cx16.r0L++ - inc cx16.r0L -label_asm_127_afterif - ; source: test_word_splitw_lte.p8:1045 x=1 - lda #<1 - ldy #>1 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lte.p8:1046 sources[1]=1 - ldy #1 - lda #<1 - sta p8v_sources_lsb,y - lda #>1 - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:1047 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1049 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl22a - ; source: test_word_splitw_lte.p8:1051 goto skip22a - bra p8l_skip22a - ; source: test_word_splitw_lte.p8:1052 lbl22a: fail_word(25) -p8l_lbl22a - ldy #>$19 - lda #<$19 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1053 skip22a: -p8l_skip22a - ; source: test_word_splitw_lte.p8:1055 cx16.r3 = &lbl22b - lda #p8l_lbl22b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1056 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1058 goto skip22b - bra p8l_skip22b - ; source: test_word_splitw_lte.p8:1059 lbl22b: fail_word(26) -p8l_lbl22b - ldy #>$1a - lda #<$1a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1060 skip22b: -p8l_skip22b - ; source: test_word_splitw_lte.p8:1062 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_129_afterif - ; source: test_word_splitw_lte.p8:1063 fail_word(27) - ldy #>$1b - lda #<$1b - jsr p8b_main.p8s_fail_word -label_asm_129_afterif - ; source: test_word_splitw_lte.p8:1066 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_131_else - ; source: test_word_splitw_lte.p8:1067 fail_word(28) - ldy #>$1c - lda #<$1c - jsr p8b_main.p8s_fail_word - bra label_asm_130_afterif -label_asm_131_else - ; source: test_word_splitw_lte.p8:1069 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_130_afterif - ; source: test_word_splitw_lte.p8:1072 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl22c - ; source: test_word_splitw_lte.p8:1074 goto skip22c - bra p8l_skip22c - ; source: test_word_splitw_lte.p8:1075 lbl22c: fail_word(29) -p8l_lbl22c - ldy #>$1d - lda #<$1d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1076 skip22c: -p8l_skip22c - ; source: test_word_splitw_lte.p8:1078 cx16.r3 = &lbl22d - lda #p8l_lbl22d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1079 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1081 goto skip22d - bra p8l_skip22d - ; source: test_word_splitw_lte.p8:1082 lbl22d: fail_word(30) -p8l_lbl22d - ldy #>$1e - lda #<$1e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1083 skip22d: -p8l_skip22d - ; source: test_word_splitw_lte.p8:1085 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_132_afterif - ; source: test_word_splitw_lte.p8:1086 fail_word(31) - ldy #>$1f - lda #<$1f - jsr p8b_main.p8s_fail_word -label_asm_132_afterif - ; source: test_word_splitw_lte.p8:1089 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_134_else - ; source: test_word_splitw_lte.p8:1090 fail_word(32) - ldy #>$20 - lda #<$20 - jsr p8b_main.p8s_fail_word - bra label_asm_133_afterif -label_asm_134_else - ; source: test_word_splitw_lte.p8:1092 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_133_afterif - ; source: test_word_splitw_lte.p8:1094 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1096 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl23a - ; source: test_word_splitw_lte.p8:1098 goto skip23a - bra p8l_skip23a - ; source: test_word_splitw_lte.p8:1099 lbl23a: fail_word(33) -p8l_lbl23a - ldy #>$21 - lda #<$21 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1100 skip23a: -p8l_skip23a - ; source: test_word_splitw_lte.p8:1102 cx16.r3 = &lbl23b - lda #p8l_lbl23b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1103 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1105 goto skip23b - bra p8l_skip23b - ; source: test_word_splitw_lte.p8:1106 lbl23b: fail_word(34) -p8l_lbl23b - ldy #>$22 - lda #<$22 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1107 skip23b: -p8l_skip23b - ; source: test_word_splitw_lte.p8:1109 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_135_afterif - ; source: test_word_splitw_lte.p8:1110 fail_word(35) - ldy #>$23 - lda #<$23 - jsr p8b_main.p8s_fail_word -label_asm_135_afterif - ; source: test_word_splitw_lte.p8:1113 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_137_else - ; source: test_word_splitw_lte.p8:1114 fail_word(36) - ldy #>$24 - lda #<$24 - jsr p8b_main.p8s_fail_word - bra label_asm_136_afterif -label_asm_137_else - ; source: test_word_splitw_lte.p8:1116 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_136_afterif - ; source: test_word_splitw_lte.p8:1119 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl23c - ; source: test_word_splitw_lte.p8:1121 goto skip23c - bra p8l_skip23c - ; source: test_word_splitw_lte.p8:1122 lbl23c: fail_word(37) -p8l_lbl23c - ldy #>$25 - lda #<$25 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1123 skip23c: -p8l_skip23c - ; source: test_word_splitw_lte.p8:1125 cx16.r3 = &lbl23d - lda #p8l_lbl23d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1126 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1128 goto skip23d - bra p8l_skip23d - ; source: test_word_splitw_lte.p8:1129 lbl23d: fail_word(38) -p8l_lbl23d - ldy #>$26 - lda #<$26 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1130 skip23d: -p8l_skip23d - ; source: test_word_splitw_lte.p8:1132 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_138_afterif - ; source: test_word_splitw_lte.p8:1133 fail_word(39) - ldy #>$27 - lda #<$27 - jsr p8b_main.p8s_fail_word -label_asm_138_afterif - ; source: test_word_splitw_lte.p8:1136 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_140_else - ; source: test_word_splitw_lte.p8:1137 fail_word(40) - ldy #>$28 - lda #<$28 - jsr p8b_main.p8s_fail_word - bra label_asm_139_afterif -label_asm_140_else - ; source: test_word_splitw_lte.p8:1139 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_139_afterif - ; source: test_word_splitw_lte.p8:1141 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1143 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl24a - ; source: test_word_splitw_lte.p8:1145 goto skip24a - bra p8l_skip24a - ; source: test_word_splitw_lte.p8:1146 lbl24a: fail_word(41) -p8l_lbl24a - ldy #>$29 - lda #<$29 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1147 skip24a: -p8l_skip24a - ; source: test_word_splitw_lte.p8:1149 cx16.r3 = &lbl24b - lda #p8l_lbl24b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1150 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1152 goto skip24b - bra p8l_skip24b - ; source: test_word_splitw_lte.p8:1153 lbl24b: fail_word(42) -p8l_lbl24b - ldy #>$2a - lda #<$2a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1154 skip24b: -p8l_skip24b - ; source: test_word_splitw_lte.p8:1156 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_141_afterif - ; source: test_word_splitw_lte.p8:1157 fail_word(43) - ldy #>$2b - lda #<$2b - jsr p8b_main.p8s_fail_word -label_asm_141_afterif - ; source: test_word_splitw_lte.p8:1160 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_143_else - ; source: test_word_splitw_lte.p8:1161 fail_word(44) - ldy #>$2c - lda #<$2c - jsr p8b_main.p8s_fail_word - bra label_asm_142_afterif -label_asm_143_else - ; source: test_word_splitw_lte.p8:1163 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_142_afterif - ; source: test_word_splitw_lte.p8:1166 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl24c - ; source: test_word_splitw_lte.p8:1168 goto skip24c - bra p8l_skip24c - ; source: test_word_splitw_lte.p8:1169 lbl24c: fail_word(45) -p8l_lbl24c - ldy #>$2d - lda #<$2d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1170 skip24c: -p8l_skip24c - ; source: test_word_splitw_lte.p8:1172 cx16.r3 = &lbl24d - lda #p8l_lbl24d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1173 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1175 goto skip24d - bra p8l_skip24d - ; source: test_word_splitw_lte.p8:1176 lbl24d: fail_word(46) -p8l_lbl24d - ldy #>$2e - lda #<$2e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1177 skip24d: -p8l_skip24d - ; source: test_word_splitw_lte.p8:1179 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_144_afterif - ; source: test_word_splitw_lte.p8:1180 fail_word(47) - ldy #>$2f - lda #<$2f - jsr p8b_main.p8s_fail_word -label_asm_144_afterif - ; source: test_word_splitw_lte.p8:1183 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_146_else - ; source: test_word_splitw_lte.p8:1184 fail_word(48) - ldy #>$30 - lda #<$30 - jsr p8b_main.p8s_fail_word - bra label_asm_145_afterif -label_asm_146_else - ; source: test_word_splitw_lte.p8:1186 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_145_afterif - ; source: test_word_splitw_lte.p8:1188 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1190 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl25a - ; source: test_word_splitw_lte.p8:1192 goto skip25a - bra p8l_skip25a - ; source: test_word_splitw_lte.p8:1193 lbl25a: success++ -p8l_lbl25a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1194 skip25a: -p8l_skip25a - ; source: test_word_splitw_lte.p8:1196 cx16.r3 = &lbl25b - lda #p8l_lbl25b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1197 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1199 goto skip25b - bra p8l_skip25b - ; source: test_word_splitw_lte.p8:1200 lbl25b: success++ -p8l_lbl25b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1201 skip25b: -p8l_skip25b - ; source: test_word_splitw_lte.p8:1203 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_147_afterif - ; source: test_word_splitw_lte.p8:1204 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_147_afterif - ; source: test_word_splitw_lte.p8:1207 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_149_else - ; source: test_word_splitw_lte.p8:1208 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_148_afterif -label_asm_149_else - ; source: test_word_splitw_lte.p8:1210 cx16.r0L++ - inc cx16.r0L -label_asm_148_afterif - ; source: test_word_splitw_lte.p8:1213 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl25c - ; source: test_word_splitw_lte.p8:1215 goto skip25c - bra p8l_skip25c - ; source: test_word_splitw_lte.p8:1216 lbl25c: success++ -p8l_lbl25c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1217 skip25c: -p8l_skip25c - ; source: test_word_splitw_lte.p8:1219 cx16.r3 = &lbl25d - lda #p8l_lbl25d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1220 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1222 goto skip25d - bra p8l_skip25d - ; source: test_word_splitw_lte.p8:1223 lbl25d: success++ -p8l_lbl25d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1224 skip25d: -p8l_skip25d - ; source: test_word_splitw_lte.p8:1226 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_150_afterif - ; source: test_word_splitw_lte.p8:1227 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_150_afterif - ; source: test_word_splitw_lte.p8:1230 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_152_else - ; source: test_word_splitw_lte.p8:1231 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_151_afterif -label_asm_152_else - ; source: test_word_splitw_lte.p8:1233 cx16.r0L++ - inc cx16.r0L -label_asm_151_afterif - ; source: test_word_splitw_lte.p8:1235 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1237 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl26a - ; source: test_word_splitw_lte.p8:1239 goto skip26a - bra p8l_skip26a - ; source: test_word_splitw_lte.p8:1240 lbl26a: success++ -p8l_lbl26a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1241 skip26a: -p8l_skip26a - ; source: test_word_splitw_lte.p8:1243 cx16.r3 = &lbl26b - lda #p8l_lbl26b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1244 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1246 goto skip26b - bra p8l_skip26b - ; source: test_word_splitw_lte.p8:1247 lbl26b: success++ -p8l_lbl26b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1248 skip26b: -p8l_skip26b - ; source: test_word_splitw_lte.p8:1250 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_153_afterif - ; source: test_word_splitw_lte.p8:1251 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_153_afterif - ; source: test_word_splitw_lte.p8:1254 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_155_else - ; source: test_word_splitw_lte.p8:1255 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_154_afterif -label_asm_155_else - ; source: test_word_splitw_lte.p8:1257 cx16.r0L++ - inc cx16.r0L -label_asm_154_afterif - ; source: test_word_splitw_lte.p8:1260 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl26c - ; source: test_word_splitw_lte.p8:1262 goto skip26c - bra p8l_skip26c - ; source: test_word_splitw_lte.p8:1263 lbl26c: success++ -p8l_lbl26c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1264 skip26c: -p8l_skip26c - ; source: test_word_splitw_lte.p8:1266 cx16.r3 = &lbl26d - lda #p8l_lbl26d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1267 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1269 goto skip26d - bra p8l_skip26d - ; source: test_word_splitw_lte.p8:1270 lbl26d: success++ -p8l_lbl26d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1271 skip26d: -p8l_skip26d - ; source: test_word_splitw_lte.p8:1273 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_156_afterif - ; source: test_word_splitw_lte.p8:1274 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_156_afterif - ; source: test_word_splitw_lte.p8:1277 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_158_else - ; source: test_word_splitw_lte.p8:1278 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_157_afterif -label_asm_158_else - ; source: test_word_splitw_lte.p8:1280 cx16.r0L++ - inc cx16.r0L -label_asm_157_afterif - ; source: test_word_splitw_lte.p8:1282 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1284 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl27a - ; source: test_word_splitw_lte.p8:1286 goto skip27a - bra p8l_skip27a - ; source: test_word_splitw_lte.p8:1287 lbl27a: success++ -p8l_lbl27a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1288 skip27a: -p8l_skip27a - ; source: test_word_splitw_lte.p8:1290 cx16.r3 = &lbl27b - lda #p8l_lbl27b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1291 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1293 goto skip27b - bra p8l_skip27b - ; source: test_word_splitw_lte.p8:1294 lbl27b: success++ -p8l_lbl27b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1295 skip27b: -p8l_skip27b - ; source: test_word_splitw_lte.p8:1297 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_159_afterif - ; source: test_word_splitw_lte.p8:1298 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_159_afterif - ; source: test_word_splitw_lte.p8:1301 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_161_else - ; source: test_word_splitw_lte.p8:1302 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_160_afterif -label_asm_161_else - ; source: test_word_splitw_lte.p8:1304 cx16.r0L++ - inc cx16.r0L -label_asm_160_afterif - ; source: test_word_splitw_lte.p8:1307 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl27c - ; source: test_word_splitw_lte.p8:1309 goto skip27c - bra p8l_skip27c - ; source: test_word_splitw_lte.p8:1310 lbl27c: success++ -p8l_lbl27c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1311 skip27c: -p8l_skip27c - ; source: test_word_splitw_lte.p8:1313 cx16.r3 = &lbl27d - lda #p8l_lbl27d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1314 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1316 goto skip27d - bra p8l_skip27d - ; source: test_word_splitw_lte.p8:1317 lbl27d: success++ -p8l_lbl27d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1318 skip27d: -p8l_skip27d - ; source: test_word_splitw_lte.p8:1320 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_162_afterif - ; source: test_word_splitw_lte.p8:1321 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_162_afterif - ; source: test_word_splitw_lte.p8:1324 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_164_else - ; source: test_word_splitw_lte.p8:1325 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_163_afterif -label_asm_164_else - ; source: test_word_splitw_lte.p8:1327 cx16.r0L++ - inc cx16.r0L -label_asm_163_afterif - ; source: test_word_splitw_lte.p8:1329 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1331 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl28a - ; source: test_word_splitw_lte.p8:1333 goto skip28a - bra p8l_skip28a - ; source: test_word_splitw_lte.p8:1334 lbl28a: success++ -p8l_lbl28a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1335 skip28a: -p8l_skip28a - ; source: test_word_splitw_lte.p8:1337 cx16.r3 = &lbl28b - lda #p8l_lbl28b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1338 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1340 goto skip28b - bra p8l_skip28b - ; source: test_word_splitw_lte.p8:1341 lbl28b: success++ -p8l_lbl28b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1342 skip28b: -p8l_skip28b - ; source: test_word_splitw_lte.p8:1344 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_165_afterif - ; source: test_word_splitw_lte.p8:1345 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_165_afterif - ; source: test_word_splitw_lte.p8:1348 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_167_else - ; source: test_word_splitw_lte.p8:1349 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_166_afterif -label_asm_167_else - ; source: test_word_splitw_lte.p8:1351 cx16.r0L++ - inc cx16.r0L -label_asm_166_afterif - ; source: test_word_splitw_lte.p8:1354 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl28c - ; source: test_word_splitw_lte.p8:1356 goto skip28c - bra p8l_skip28c - ; source: test_word_splitw_lte.p8:1357 lbl28c: success++ -p8l_lbl28c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1358 skip28c: -p8l_skip28c - ; source: test_word_splitw_lte.p8:1360 cx16.r3 = &lbl28d - lda #p8l_lbl28d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1361 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1363 goto skip28d - bra p8l_skip28d - ; source: test_word_splitw_lte.p8:1364 lbl28d: success++ -p8l_lbl28d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1365 skip28d: -p8l_skip28d - ; source: test_word_splitw_lte.p8:1367 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_168_afterif - ; source: test_word_splitw_lte.p8:1368 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_168_afterif - ; source: test_word_splitw_lte.p8:1371 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_170_else - ; source: test_word_splitw_lte.p8:1372 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_169_afterif -label_asm_170_else - ; source: test_word_splitw_lte.p8:1374 cx16.r0L++ - inc cx16.r0L -label_asm_169_afterif - ; source: test_word_splitw_lte.p8:1376 x=170 - lda #<$aa - ldy #>$aa - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lte.p8:1377 sources[1]=170 - ldy #1 - lda #<$aa - sta p8v_sources_lsb,y - lda #>$aa - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:1378 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1380 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl29a - ; source: test_word_splitw_lte.p8:1382 goto skip29a - bra p8l_skip29a - ; source: test_word_splitw_lte.p8:1383 lbl29a: fail_word(49) -p8l_lbl29a - ldy #>$31 - lda #<$31 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1384 skip29a: -p8l_skip29a - ; source: test_word_splitw_lte.p8:1386 cx16.r3 = &lbl29b - lda #p8l_lbl29b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1387 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1389 goto skip29b - bra p8l_skip29b - ; source: test_word_splitw_lte.p8:1390 lbl29b: fail_word(50) -p8l_lbl29b - ldy #>$32 - lda #<$32 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1391 skip29b: -p8l_skip29b - ; source: test_word_splitw_lte.p8:1393 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_171_afterif - ; source: test_word_splitw_lte.p8:1394 fail_word(51) - ldy #>$33 - lda #<$33 - jsr p8b_main.p8s_fail_word -label_asm_171_afterif - ; source: test_word_splitw_lte.p8:1397 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_173_else - ; source: test_word_splitw_lte.p8:1398 fail_word(52) - ldy #>$34 - lda #<$34 - jsr p8b_main.p8s_fail_word - bra label_asm_172_afterif -label_asm_173_else - ; source: test_word_splitw_lte.p8:1400 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_172_afterif - ; source: test_word_splitw_lte.p8:1403 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl29c - ; source: test_word_splitw_lte.p8:1405 goto skip29c - bra p8l_skip29c - ; source: test_word_splitw_lte.p8:1406 lbl29c: fail_word(53) -p8l_lbl29c - ldy #>$35 - lda #<$35 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1407 skip29c: -p8l_skip29c - ; source: test_word_splitw_lte.p8:1409 cx16.r3 = &lbl29d - lda #p8l_lbl29d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1410 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1412 goto skip29d - bra p8l_skip29d - ; source: test_word_splitw_lte.p8:1413 lbl29d: fail_word(54) -p8l_lbl29d - ldy #>$36 - lda #<$36 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1414 skip29d: -p8l_skip29d - ; source: test_word_splitw_lte.p8:1416 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_174_afterif - ; source: test_word_splitw_lte.p8:1417 fail_word(55) - ldy #>$37 - lda #<$37 - jsr p8b_main.p8s_fail_word -label_asm_174_afterif - ; source: test_word_splitw_lte.p8:1420 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_176_else - ; source: test_word_splitw_lte.p8:1421 fail_word(56) - ldy #>$38 - lda #<$38 - jsr p8b_main.p8s_fail_word - bra label_asm_175_afterif -label_asm_176_else - ; source: test_word_splitw_lte.p8:1423 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_175_afterif - ; source: test_word_splitw_lte.p8:1425 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1427 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl30a - ; source: test_word_splitw_lte.p8:1429 goto skip30a - bra p8l_skip30a - ; source: test_word_splitw_lte.p8:1430 lbl30a: fail_word(57) -p8l_lbl30a - ldy #>$39 - lda #<$39 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1431 skip30a: -p8l_skip30a - ; source: test_word_splitw_lte.p8:1433 cx16.r3 = &lbl30b - lda #p8l_lbl30b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1434 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1436 goto skip30b - bra p8l_skip30b - ; source: test_word_splitw_lte.p8:1437 lbl30b: fail_word(58) -p8l_lbl30b - ldy #>$3a - lda #<$3a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1438 skip30b: -p8l_skip30b - ; source: test_word_splitw_lte.p8:1440 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_177_afterif - ; source: test_word_splitw_lte.p8:1441 fail_word(59) - ldy #>$3b - lda #<$3b - jsr p8b_main.p8s_fail_word -label_asm_177_afterif - ; source: test_word_splitw_lte.p8:1444 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_179_else - ; source: test_word_splitw_lte.p8:1445 fail_word(60) - ldy #>$3c - lda #<$3c - jsr p8b_main.p8s_fail_word - bra label_asm_178_afterif -label_asm_179_else - ; source: test_word_splitw_lte.p8:1447 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_178_afterif - ; source: test_word_splitw_lte.p8:1450 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl30c - ; source: test_word_splitw_lte.p8:1452 goto skip30c - bra p8l_skip30c - ; source: test_word_splitw_lte.p8:1453 lbl30c: fail_word(61) -p8l_lbl30c - ldy #>$3d - lda #<$3d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1454 skip30c: -p8l_skip30c - ; source: test_word_splitw_lte.p8:1456 cx16.r3 = &lbl30d - lda #p8l_lbl30d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1457 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1459 goto skip30d - bra p8l_skip30d - ; source: test_word_splitw_lte.p8:1460 lbl30d: fail_word(62) -p8l_lbl30d - ldy #>$3e - lda #<$3e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1461 skip30d: -p8l_skip30d - ; source: test_word_splitw_lte.p8:1463 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_180_afterif - ; source: test_word_splitw_lte.p8:1464 fail_word(63) - ldy #>$3f - lda #<$3f - jsr p8b_main.p8s_fail_word -label_asm_180_afterif - ; source: test_word_splitw_lte.p8:1467 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_182_else - ; source: test_word_splitw_lte.p8:1468 fail_word(64) - ldy #>$40 - lda #<$40 - jsr p8b_main.p8s_fail_word - bra label_asm_181_afterif -label_asm_182_else - ; source: test_word_splitw_lte.p8:1470 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_181_afterif - ; source: test_word_splitw_lte.p8:1472 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1474 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl31a - ; source: test_word_splitw_lte.p8:1476 goto skip31a - bra p8l_skip31a - ; source: test_word_splitw_lte.p8:1477 lbl31a: fail_word(65) -p8l_lbl31a - ldy #>$41 - lda #<$41 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1478 skip31a: -p8l_skip31a - ; source: test_word_splitw_lte.p8:1480 cx16.r3 = &lbl31b - lda #p8l_lbl31b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1481 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1483 goto skip31b - bra p8l_skip31b - ; source: test_word_splitw_lte.p8:1484 lbl31b: fail_word(66) -p8l_lbl31b - ldy #>$42 - lda #<$42 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1485 skip31b: -p8l_skip31b - ; source: test_word_splitw_lte.p8:1487 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_183_afterif - ; source: test_word_splitw_lte.p8:1488 fail_word(67) - ldy #>$43 - lda #<$43 - jsr p8b_main.p8s_fail_word -label_asm_183_afterif - ; source: test_word_splitw_lte.p8:1491 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_185_else - ; source: test_word_splitw_lte.p8:1492 fail_word(68) - ldy #>$44 - lda #<$44 - jsr p8b_main.p8s_fail_word - bra label_asm_184_afterif -label_asm_185_else - ; source: test_word_splitw_lte.p8:1494 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_184_afterif - ; source: test_word_splitw_lte.p8:1497 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl31c - ; source: test_word_splitw_lte.p8:1499 goto skip31c - bra p8l_skip31c - ; source: test_word_splitw_lte.p8:1500 lbl31c: fail_word(69) -p8l_lbl31c - ldy #>$45 - lda #<$45 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1501 skip31c: -p8l_skip31c - ; source: test_word_splitw_lte.p8:1503 cx16.r3 = &lbl31d - lda #p8l_lbl31d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1504 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1506 goto skip31d - bra p8l_skip31d - ; source: test_word_splitw_lte.p8:1507 lbl31d: fail_word(70) -p8l_lbl31d - ldy #>$46 - lda #<$46 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1508 skip31d: -p8l_skip31d - ; source: test_word_splitw_lte.p8:1510 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_186_afterif - ; source: test_word_splitw_lte.p8:1511 fail_word(71) - ldy #>$47 - lda #<$47 - jsr p8b_main.p8s_fail_word -label_asm_186_afterif - ; source: test_word_splitw_lte.p8:1514 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_188_else - ; source: test_word_splitw_lte.p8:1515 fail_word(72) - ldy #>$48 - lda #<$48 - jsr p8b_main.p8s_fail_word - bra label_asm_187_afterif -label_asm_188_else - ; source: test_word_splitw_lte.p8:1517 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_187_afterif - ; source: test_word_splitw_lte.p8:1519 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1521 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl32a - ; source: test_word_splitw_lte.p8:1523 goto skip32a - bra p8l_skip32a - ; source: test_word_splitw_lte.p8:1524 lbl32a: fail_word(73) -p8l_lbl32a - ldy #>$49 - lda #<$49 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1525 skip32a: -p8l_skip32a - ; source: test_word_splitw_lte.p8:1527 cx16.r3 = &lbl32b - lda #p8l_lbl32b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1528 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1530 goto skip32b - bra p8l_skip32b - ; source: test_word_splitw_lte.p8:1531 lbl32b: fail_word(74) -p8l_lbl32b - ldy #>$4a - lda #<$4a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1532 skip32b: -p8l_skip32b - ; source: test_word_splitw_lte.p8:1534 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_189_afterif - ; source: test_word_splitw_lte.p8:1535 fail_word(75) - ldy #>$4b - lda #<$4b - jsr p8b_main.p8s_fail_word -label_asm_189_afterif - ; source: test_word_splitw_lte.p8:1538 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_191_else - ; source: test_word_splitw_lte.p8:1539 fail_word(76) - ldy #>$4c - lda #<$4c - jsr p8b_main.p8s_fail_word - bra label_asm_190_afterif -label_asm_191_else - ; source: test_word_splitw_lte.p8:1541 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_190_afterif - ; source: test_word_splitw_lte.p8:1544 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl32c - ; source: test_word_splitw_lte.p8:1546 goto skip32c - bra p8l_skip32c - ; source: test_word_splitw_lte.p8:1547 lbl32c: fail_word(77) -p8l_lbl32c - ldy #>$4d - lda #<$4d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1548 skip32c: -p8l_skip32c - ; source: test_word_splitw_lte.p8:1550 cx16.r3 = &lbl32d - lda #p8l_lbl32d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1551 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1553 goto skip32d - bra p8l_skip32d - ; source: test_word_splitw_lte.p8:1554 lbl32d: fail_word(78) -p8l_lbl32d - ldy #>$4e - lda #<$4e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1555 skip32d: -p8l_skip32d - ; source: test_word_splitw_lte.p8:1557 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_192_afterif - ; source: test_word_splitw_lte.p8:1558 fail_word(79) - ldy #>$4f - lda #<$4f - jsr p8b_main.p8s_fail_word -label_asm_192_afterif - ; source: test_word_splitw_lte.p8:1561 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_194_else - ; source: test_word_splitw_lte.p8:1562 fail_word(80) - ldy #>$50 - lda #<$50 - jsr p8b_main.p8s_fail_word - bra label_asm_193_afterif -label_asm_194_else - ; source: test_word_splitw_lte.p8:1564 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_193_afterif - ; source: test_word_splitw_lte.p8:1566 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1568 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl33a - ; source: test_word_splitw_lte.p8:1570 goto skip33a - bra p8l_skip33a - ; source: test_word_splitw_lte.p8:1571 lbl33a: success++ -p8l_lbl33a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1572 skip33a: -p8l_skip33a - ; source: test_word_splitw_lte.p8:1574 cx16.r3 = &lbl33b - lda #p8l_lbl33b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1575 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1577 goto skip33b - bra p8l_skip33b - ; source: test_word_splitw_lte.p8:1578 lbl33b: success++ -p8l_lbl33b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1579 skip33b: -p8l_skip33b - ; source: test_word_splitw_lte.p8:1581 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_195_afterif - ; source: test_word_splitw_lte.p8:1582 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_195_afterif - ; source: test_word_splitw_lte.p8:1585 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_197_else - ; source: test_word_splitw_lte.p8:1586 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_196_afterif -label_asm_197_else - ; source: test_word_splitw_lte.p8:1588 cx16.r0L++ - inc cx16.r0L -label_asm_196_afterif - ; source: test_word_splitw_lte.p8:1591 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl33c - ; source: test_word_splitw_lte.p8:1593 goto skip33c - bra p8l_skip33c - ; source: test_word_splitw_lte.p8:1594 lbl33c: success++ -p8l_lbl33c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1595 skip33c: -p8l_skip33c - ; source: test_word_splitw_lte.p8:1597 cx16.r3 = &lbl33d - lda #p8l_lbl33d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1598 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1600 goto skip33d - bra p8l_skip33d - ; source: test_word_splitw_lte.p8:1601 lbl33d: success++ -p8l_lbl33d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1602 skip33d: -p8l_skip33d - ; source: test_word_splitw_lte.p8:1604 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_198_afterif - ; source: test_word_splitw_lte.p8:1605 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_198_afterif - ; source: test_word_splitw_lte.p8:1608 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_200_else - ; source: test_word_splitw_lte.p8:1609 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_199_afterif -label_asm_200_else - ; source: test_word_splitw_lte.p8:1611 cx16.r0L++ - inc cx16.r0L -label_asm_199_afterif - ; source: test_word_splitw_lte.p8:1613 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1615 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl34a - ; source: test_word_splitw_lte.p8:1617 goto skip34a - bra p8l_skip34a - ; source: test_word_splitw_lte.p8:1618 lbl34a: success++ -p8l_lbl34a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1619 skip34a: -p8l_skip34a - ; source: test_word_splitw_lte.p8:1621 cx16.r3 = &lbl34b - lda #p8l_lbl34b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1622 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1624 goto skip34b - bra p8l_skip34b - ; source: test_word_splitw_lte.p8:1625 lbl34b: success++ -p8l_lbl34b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1626 skip34b: -p8l_skip34b - ; source: test_word_splitw_lte.p8:1628 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_201_afterif - ; source: test_word_splitw_lte.p8:1629 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_201_afterif - ; source: test_word_splitw_lte.p8:1632 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_203_else - ; source: test_word_splitw_lte.p8:1633 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_202_afterif -label_asm_203_else - ; source: test_word_splitw_lte.p8:1635 cx16.r0L++ - inc cx16.r0L -label_asm_202_afterif - ; source: test_word_splitw_lte.p8:1638 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl34c - ; source: test_word_splitw_lte.p8:1640 goto skip34c - bra p8l_skip34c - ; source: test_word_splitw_lte.p8:1641 lbl34c: success++ -p8l_lbl34c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1642 skip34c: -p8l_skip34c - ; source: test_word_splitw_lte.p8:1644 cx16.r3 = &lbl34d - lda #p8l_lbl34d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1645 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1647 goto skip34d - bra p8l_skip34d - ; source: test_word_splitw_lte.p8:1648 lbl34d: success++ -p8l_lbl34d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1649 skip34d: -p8l_skip34d - ; source: test_word_splitw_lte.p8:1651 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_204_afterif - ; source: test_word_splitw_lte.p8:1652 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_204_afterif - ; source: test_word_splitw_lte.p8:1655 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_206_else - ; source: test_word_splitw_lte.p8:1656 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_205_afterif -label_asm_206_else - ; source: test_word_splitw_lte.p8:1658 cx16.r0L++ - inc cx16.r0L -label_asm_205_afterif - ; source: test_word_splitw_lte.p8:1660 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1662 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl35a - ; source: test_word_splitw_lte.p8:1664 goto skip35a - bra p8l_skip35a - ; source: test_word_splitw_lte.p8:1665 lbl35a: success++ -p8l_lbl35a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1666 skip35a: -p8l_skip35a - ; source: test_word_splitw_lte.p8:1668 cx16.r3 = &lbl35b - lda #p8l_lbl35b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1669 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1671 goto skip35b - bra p8l_skip35b - ; source: test_word_splitw_lte.p8:1672 lbl35b: success++ -p8l_lbl35b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1673 skip35b: -p8l_skip35b - ; source: test_word_splitw_lte.p8:1675 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_207_afterif - ; source: test_word_splitw_lte.p8:1676 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_207_afterif - ; source: test_word_splitw_lte.p8:1679 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_209_else - ; source: test_word_splitw_lte.p8:1680 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_208_afterif -label_asm_209_else - ; source: test_word_splitw_lte.p8:1682 cx16.r0L++ - inc cx16.r0L -label_asm_208_afterif - ; source: test_word_splitw_lte.p8:1685 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl35c - ; source: test_word_splitw_lte.p8:1687 goto skip35c - bra p8l_skip35c - ; source: test_word_splitw_lte.p8:1688 lbl35c: success++ -p8l_lbl35c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1689 skip35c: -p8l_skip35c - ; source: test_word_splitw_lte.p8:1691 cx16.r3 = &lbl35d - lda #p8l_lbl35d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1692 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1694 goto skip35d - bra p8l_skip35d - ; source: test_word_splitw_lte.p8:1695 lbl35d: success++ -p8l_lbl35d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1696 skip35d: -p8l_skip35d - ; source: test_word_splitw_lte.p8:1698 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_210_afterif - ; source: test_word_splitw_lte.p8:1699 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_210_afterif - ; source: test_word_splitw_lte.p8:1702 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_212_else - ; source: test_word_splitw_lte.p8:1703 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_211_afterif -label_asm_212_else - ; source: test_word_splitw_lte.p8:1705 cx16.r0L++ - inc cx16.r0L -label_asm_211_afterif - ; source: test_word_splitw_lte.p8:1707 x=30464 - lda #<$7700 - ldy #>$7700 - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lte.p8:1708 sources[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_sources_lsb,y - lda #>$7700 - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:1709 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1711 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl36a - ; source: test_word_splitw_lte.p8:1713 goto skip36a - bra p8l_skip36a - ; source: test_word_splitw_lte.p8:1714 lbl36a: fail_word(81) -p8l_lbl36a - ldy #>$51 - lda #<$51 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1715 skip36a: -p8l_skip36a - ; source: test_word_splitw_lte.p8:1717 cx16.r3 = &lbl36b - lda #p8l_lbl36b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1718 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1720 goto skip36b - bra p8l_skip36b - ; source: test_word_splitw_lte.p8:1721 lbl36b: fail_word(82) -p8l_lbl36b - ldy #>$52 - lda #<$52 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1722 skip36b: -p8l_skip36b - ; source: test_word_splitw_lte.p8:1724 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_213_afterif - ; source: test_word_splitw_lte.p8:1725 fail_word(83) - ldy #>$53 - lda #<$53 - jsr p8b_main.p8s_fail_word -label_asm_213_afterif - ; source: test_word_splitw_lte.p8:1728 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_215_else - ; source: test_word_splitw_lte.p8:1729 fail_word(84) - ldy #>$54 - lda #<$54 - jsr p8b_main.p8s_fail_word - bra label_asm_214_afterif -label_asm_215_else - ; source: test_word_splitw_lte.p8:1731 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_214_afterif - ; source: test_word_splitw_lte.p8:1734 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl36c - ; source: test_word_splitw_lte.p8:1736 goto skip36c - bra p8l_skip36c - ; source: test_word_splitw_lte.p8:1737 lbl36c: fail_word(85) -p8l_lbl36c - ldy #>$55 - lda #<$55 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1738 skip36c: -p8l_skip36c - ; source: test_word_splitw_lte.p8:1740 cx16.r3 = &lbl36d - lda #p8l_lbl36d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1741 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1743 goto skip36d - bra p8l_skip36d - ; source: test_word_splitw_lte.p8:1744 lbl36d: fail_word(86) -p8l_lbl36d - ldy #>$56 - lda #<$56 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1745 skip36d: -p8l_skip36d - ; source: test_word_splitw_lte.p8:1747 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_216_afterif - ; source: test_word_splitw_lte.p8:1748 fail_word(87) - ldy #>$57 - lda #<$57 - jsr p8b_main.p8s_fail_word -label_asm_216_afterif - ; source: test_word_splitw_lte.p8:1751 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_218_else - ; source: test_word_splitw_lte.p8:1752 fail_word(88) - ldy #>$58 - lda #<$58 - jsr p8b_main.p8s_fail_word - bra label_asm_217_afterif -label_asm_218_else - ; source: test_word_splitw_lte.p8:1754 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_217_afterif - ; source: test_word_splitw_lte.p8:1756 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1758 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl37a - ; source: test_word_splitw_lte.p8:1760 goto skip37a - bra p8l_skip37a - ; source: test_word_splitw_lte.p8:1761 lbl37a: fail_word(89) -p8l_lbl37a - ldy #>$59 - lda #<$59 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1762 skip37a: -p8l_skip37a - ; source: test_word_splitw_lte.p8:1764 cx16.r3 = &lbl37b - lda #p8l_lbl37b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1765 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1767 goto skip37b - bra p8l_skip37b - ; source: test_word_splitw_lte.p8:1768 lbl37b: fail_word(90) -p8l_lbl37b - ldy #>$5a - lda #<$5a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1769 skip37b: -p8l_skip37b - ; source: test_word_splitw_lte.p8:1771 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_219_afterif - ; source: test_word_splitw_lte.p8:1772 fail_word(91) - ldy #>$5b - lda #<$5b - jsr p8b_main.p8s_fail_word -label_asm_219_afterif - ; source: test_word_splitw_lte.p8:1775 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_221_else - ; source: test_word_splitw_lte.p8:1776 fail_word(92) - ldy #>$5c - lda #<$5c - jsr p8b_main.p8s_fail_word - bra label_asm_220_afterif -label_asm_221_else - ; source: test_word_splitw_lte.p8:1778 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_220_afterif - ; source: test_word_splitw_lte.p8:1781 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl37c - ; source: test_word_splitw_lte.p8:1783 goto skip37c - bra p8l_skip37c - ; source: test_word_splitw_lte.p8:1784 lbl37c: fail_word(93) -p8l_lbl37c - ldy #>$5d - lda #<$5d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1785 skip37c: -p8l_skip37c - ; source: test_word_splitw_lte.p8:1787 cx16.r3 = &lbl37d - lda #p8l_lbl37d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1788 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1790 goto skip37d - bra p8l_skip37d - ; source: test_word_splitw_lte.p8:1791 lbl37d: fail_word(94) -p8l_lbl37d - ldy #>$5e - lda #<$5e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1792 skip37d: -p8l_skip37d - ; source: test_word_splitw_lte.p8:1794 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_222_afterif - ; source: test_word_splitw_lte.p8:1795 fail_word(95) - ldy #>$5f - lda #<$5f - jsr p8b_main.p8s_fail_word -label_asm_222_afterif - ; source: test_word_splitw_lte.p8:1798 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_224_else - ; source: test_word_splitw_lte.p8:1799 fail_word(96) - ldy #>$60 - lda #<$60 - jsr p8b_main.p8s_fail_word - bra label_asm_223_afterif -label_asm_224_else - ; source: test_word_splitw_lte.p8:1801 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_223_afterif - ; source: test_word_splitw_lte.p8:1803 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1805 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl38a - ; source: test_word_splitw_lte.p8:1807 goto skip38a - bra p8l_skip38a - ; source: test_word_splitw_lte.p8:1808 lbl38a: fail_word(97) -p8l_lbl38a - ldy #>$61 - lda #<$61 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1809 skip38a: -p8l_skip38a - ; source: test_word_splitw_lte.p8:1811 cx16.r3 = &lbl38b - lda #p8l_lbl38b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1812 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1814 goto skip38b - bra p8l_skip38b - ; source: test_word_splitw_lte.p8:1815 lbl38b: fail_word(98) -p8l_lbl38b - ldy #>$62 - lda #<$62 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1816 skip38b: -p8l_skip38b - ; source: test_word_splitw_lte.p8:1818 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_225_afterif - ; source: test_word_splitw_lte.p8:1819 fail_word(99) - ldy #>$63 - lda #<$63 - jsr p8b_main.p8s_fail_word -label_asm_225_afterif - ; source: test_word_splitw_lte.p8:1822 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_227_else - ; source: test_word_splitw_lte.p8:1823 fail_word(100) - ldy #>$64 - lda #<$64 - jsr p8b_main.p8s_fail_word - bra label_asm_226_afterif -label_asm_227_else - ; source: test_word_splitw_lte.p8:1825 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_226_afterif - ; source: test_word_splitw_lte.p8:1828 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl38c - ; source: test_word_splitw_lte.p8:1830 goto skip38c - bra p8l_skip38c - ; source: test_word_splitw_lte.p8:1831 lbl38c: fail_word(101) -p8l_lbl38c - ldy #>$65 - lda #<$65 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1832 skip38c: -p8l_skip38c - ; source: test_word_splitw_lte.p8:1834 cx16.r3 = &lbl38d - lda #p8l_lbl38d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1835 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1837 goto skip38d - bra p8l_skip38d - ; source: test_word_splitw_lte.p8:1838 lbl38d: fail_word(102) -p8l_lbl38d - ldy #>$66 - lda #<$66 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1839 skip38d: -p8l_skip38d - ; source: test_word_splitw_lte.p8:1841 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_228_afterif - ; source: test_word_splitw_lte.p8:1842 fail_word(103) - ldy #>$67 - lda #<$67 - jsr p8b_main.p8s_fail_word -label_asm_228_afterif - ; source: test_word_splitw_lte.p8:1845 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_230_else - ; source: test_word_splitw_lte.p8:1846 fail_word(104) - ldy #>$68 - lda #<$68 - jsr p8b_main.p8s_fail_word - bra label_asm_229_afterif -label_asm_230_else - ; source: test_word_splitw_lte.p8:1848 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_229_afterif - ; source: test_word_splitw_lte.p8:1850 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1852 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl39a - ; source: test_word_splitw_lte.p8:1854 goto skip39a - bra p8l_skip39a - ; source: test_word_splitw_lte.p8:1855 lbl39a: fail_word(105) -p8l_lbl39a - ldy #>$69 - lda #<$69 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1856 skip39a: -p8l_skip39a - ; source: test_word_splitw_lte.p8:1858 cx16.r3 = &lbl39b - lda #p8l_lbl39b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1859 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1861 goto skip39b - bra p8l_skip39b - ; source: test_word_splitw_lte.p8:1862 lbl39b: fail_word(106) -p8l_lbl39b - ldy #>$6a - lda #<$6a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1863 skip39b: -p8l_skip39b - ; source: test_word_splitw_lte.p8:1865 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_231_afterif - ; source: test_word_splitw_lte.p8:1866 fail_word(107) - ldy #>$6b - lda #<$6b - jsr p8b_main.p8s_fail_word -label_asm_231_afterif - ; source: test_word_splitw_lte.p8:1869 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_233_else - ; source: test_word_splitw_lte.p8:1870 fail_word(108) - ldy #>$6c - lda #<$6c - jsr p8b_main.p8s_fail_word - bra label_asm_232_afterif -label_asm_233_else - ; source: test_word_splitw_lte.p8:1872 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_232_afterif - ; source: test_word_splitw_lte.p8:1875 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl39c - ; source: test_word_splitw_lte.p8:1877 goto skip39c - bra p8l_skip39c - ; source: test_word_splitw_lte.p8:1878 lbl39c: fail_word(109) -p8l_lbl39c - ldy #>$6d - lda #<$6d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1879 skip39c: -p8l_skip39c - ; source: test_word_splitw_lte.p8:1881 cx16.r3 = &lbl39d - lda #p8l_lbl39d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1882 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1884 goto skip39d - bra p8l_skip39d - ; source: test_word_splitw_lte.p8:1885 lbl39d: fail_word(110) -p8l_lbl39d - ldy #>$6e - lda #<$6e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1886 skip39d: -p8l_skip39d - ; source: test_word_splitw_lte.p8:1888 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_234_afterif - ; source: test_word_splitw_lte.p8:1889 fail_word(111) - ldy #>$6f - lda #<$6f - jsr p8b_main.p8s_fail_word -label_asm_234_afterif - ; source: test_word_splitw_lte.p8:1892 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_236_else - ; source: test_word_splitw_lte.p8:1893 fail_word(112) - ldy #>$70 - lda #<$70 - jsr p8b_main.p8s_fail_word - bra label_asm_235_afterif -label_asm_236_else - ; source: test_word_splitw_lte.p8:1895 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_235_afterif - ; source: test_word_splitw_lte.p8:1897 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1899 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl40a - ; source: test_word_splitw_lte.p8:1901 goto skip40a - bra p8l_skip40a - ; source: test_word_splitw_lte.p8:1902 lbl40a: fail_word(113) -p8l_lbl40a - ldy #>$71 - lda #<$71 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1903 skip40a: -p8l_skip40a - ; source: test_word_splitw_lte.p8:1905 cx16.r3 = &lbl40b - lda #p8l_lbl40b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1906 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1908 goto skip40b - bra p8l_skip40b - ; source: test_word_splitw_lte.p8:1909 lbl40b: fail_word(114) -p8l_lbl40b - ldy #>$72 - lda #<$72 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1910 skip40b: -p8l_skip40b - ; source: test_word_splitw_lte.p8:1912 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_237_afterif - ; source: test_word_splitw_lte.p8:1913 fail_word(115) - ldy #>$73 - lda #<$73 - jsr p8b_main.p8s_fail_word -label_asm_237_afterif - ; source: test_word_splitw_lte.p8:1916 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_239_else - ; source: test_word_splitw_lte.p8:1917 fail_word(116) - ldy #>$74 - lda #<$74 - jsr p8b_main.p8s_fail_word - bra label_asm_238_afterif -label_asm_239_else - ; source: test_word_splitw_lte.p8:1919 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_238_afterif - ; source: test_word_splitw_lte.p8:1922 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl40c - ; source: test_word_splitw_lte.p8:1924 goto skip40c - bra p8l_skip40c - ; source: test_word_splitw_lte.p8:1925 lbl40c: fail_word(117) -p8l_lbl40c - ldy #>$75 - lda #<$75 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1926 skip40c: -p8l_skip40c - ; source: test_word_splitw_lte.p8:1928 cx16.r3 = &lbl40d - lda #p8l_lbl40d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1929 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1931 goto skip40d - bra p8l_skip40d - ; source: test_word_splitw_lte.p8:1932 lbl40d: fail_word(118) -p8l_lbl40d - ldy #>$76 - lda #<$76 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:1933 skip40d: -p8l_skip40d - ; source: test_word_splitw_lte.p8:1935 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_240_afterif - ; source: test_word_splitw_lte.p8:1936 fail_word(119) - ldy #>$77 - lda #<$77 - jsr p8b_main.p8s_fail_word -label_asm_240_afterif - ; source: test_word_splitw_lte.p8:1939 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_242_else - ; source: test_word_splitw_lte.p8:1940 fail_word(120) - ldy #>$78 - lda #<$78 - jsr p8b_main.p8s_fail_word - bra label_asm_241_afterif -label_asm_242_else - ; source: test_word_splitw_lte.p8:1942 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_241_afterif - ; source: test_word_splitw_lte.p8:1944 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1946 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl41a - ; source: test_word_splitw_lte.p8:1948 goto skip41a - bra p8l_skip41a - ; source: test_word_splitw_lte.p8:1949 lbl41a: success++ -p8l_lbl41a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1950 skip41a: -p8l_skip41a - ; source: test_word_splitw_lte.p8:1952 cx16.r3 = &lbl41b - lda #p8l_lbl41b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1953 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1955 goto skip41b - bra p8l_skip41b - ; source: test_word_splitw_lte.p8:1956 lbl41b: success++ -p8l_lbl41b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1957 skip41b: -p8l_skip41b - ; source: test_word_splitw_lte.p8:1959 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_243_afterif - ; source: test_word_splitw_lte.p8:1960 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_243_afterif - ; source: test_word_splitw_lte.p8:1963 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_245_else - ; source: test_word_splitw_lte.p8:1964 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_244_afterif -label_asm_245_else - ; source: test_word_splitw_lte.p8:1966 cx16.r0L++ - inc cx16.r0L -label_asm_244_afterif - ; source: test_word_splitw_lte.p8:1969 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl41c - ; source: test_word_splitw_lte.p8:1971 goto skip41c - bra p8l_skip41c - ; source: test_word_splitw_lte.p8:1972 lbl41c: success++ -p8l_lbl41c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1973 skip41c: -p8l_skip41c - ; source: test_word_splitw_lte.p8:1975 cx16.r3 = &lbl41d - lda #p8l_lbl41d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:1976 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:1978 goto skip41d - bra p8l_skip41d - ; source: test_word_splitw_lte.p8:1979 lbl41d: success++ -p8l_lbl41d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1980 skip41d: -p8l_skip41d - ; source: test_word_splitw_lte.p8:1982 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_246_afterif - ; source: test_word_splitw_lte.p8:1983 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_246_afterif - ; source: test_word_splitw_lte.p8:1986 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_248_else - ; source: test_word_splitw_lte.p8:1987 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_247_afterif -label_asm_248_else - ; source: test_word_splitw_lte.p8:1989 cx16.r0L++ - inc cx16.r0L -label_asm_247_afterif - ; source: test_word_splitw_lte.p8:1991 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:1993 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl42a - ; source: test_word_splitw_lte.p8:1995 goto skip42a - bra p8l_skip42a - ; source: test_word_splitw_lte.p8:1996 lbl42a: success++ -p8l_lbl42a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:1997 skip42a: -p8l_skip42a - ; source: test_word_splitw_lte.p8:1999 cx16.r3 = &lbl42b - lda #p8l_lbl42b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2000 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2002 goto skip42b - bra p8l_skip42b - ; source: test_word_splitw_lte.p8:2003 lbl42b: success++ -p8l_lbl42b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2004 skip42b: -p8l_skip42b - ; source: test_word_splitw_lte.p8:2006 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_249_afterif - ; source: test_word_splitw_lte.p8:2007 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_249_afterif - ; source: test_word_splitw_lte.p8:2010 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_251_else - ; source: test_word_splitw_lte.p8:2011 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_250_afterif -label_asm_251_else - ; source: test_word_splitw_lte.p8:2013 cx16.r0L++ - inc cx16.r0L -label_asm_250_afterif - ; source: test_word_splitw_lte.p8:2016 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl42c - ; source: test_word_splitw_lte.p8:2018 goto skip42c - bra p8l_skip42c - ; source: test_word_splitw_lte.p8:2019 lbl42c: success++ -p8l_lbl42c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2020 skip42c: -p8l_skip42c - ; source: test_word_splitw_lte.p8:2022 cx16.r3 = &lbl42d - lda #p8l_lbl42d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2023 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2025 goto skip42d - bra p8l_skip42d - ; source: test_word_splitw_lte.p8:2026 lbl42d: success++ -p8l_lbl42d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2027 skip42d: -p8l_skip42d - ; source: test_word_splitw_lte.p8:2029 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_252_afterif - ; source: test_word_splitw_lte.p8:2030 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_252_afterif - ; source: test_word_splitw_lte.p8:2033 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_254_else - ; source: test_word_splitw_lte.p8:2034 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_253_afterif -label_asm_254_else - ; source: test_word_splitw_lte.p8:2036 cx16.r0L++ - inc cx16.r0L -label_asm_253_afterif - ; source: test_word_splitw_lte.p8:2038 x=32767 - lda #<$7fff - ldy #>$7fff - sta p8v_x - sty p8v_x+1 - - ; source: test_word_splitw_lte.p8:2039 sources[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_sources_lsb,y - lda #>$7fff - sta p8v_sources_msb,y - ; source: test_word_splitw_lte.p8:2040 values[1]=-21829 - ldy #1 - lda #<-$5545 - sta p8v_values_lsb,y - lda #>-$5545 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2042 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl43a - ; source: test_word_splitw_lte.p8:2044 goto skip43a - bra p8l_skip43a - ; source: test_word_splitw_lte.p8:2045 lbl43a: fail_word(121) -p8l_lbl43a - ldy #>$79 - lda #<$79 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2046 skip43a: -p8l_skip43a - ; source: test_word_splitw_lte.p8:2048 cx16.r3 = &lbl43b - lda #p8l_lbl43b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2049 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2051 goto skip43b - bra p8l_skip43b - ; source: test_word_splitw_lte.p8:2052 lbl43b: fail_word(122) -p8l_lbl43b - ldy #>$7a - lda #<$7a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2053 skip43b: -p8l_skip43b - ; source: test_word_splitw_lte.p8:2055 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_255_afterif - ; source: test_word_splitw_lte.p8:2056 fail_word(123) - ldy #>$7b - lda #<$7b - jsr p8b_main.p8s_fail_word -label_asm_255_afterif - ; source: test_word_splitw_lte.p8:2059 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_257_else - ; source: test_word_splitw_lte.p8:2060 fail_word(124) - ldy #>$7c - lda #<$7c - jsr p8b_main.p8s_fail_word - bra label_asm_256_afterif -label_asm_257_else - ; source: test_word_splitw_lte.p8:2062 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_256_afterif - ; source: test_word_splitw_lte.p8:2065 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl43c - ; source: test_word_splitw_lte.p8:2067 goto skip43c - bra p8l_skip43c - ; source: test_word_splitw_lte.p8:2068 lbl43c: fail_word(125) -p8l_lbl43c - ldy #>$7d - lda #<$7d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2069 skip43c: -p8l_skip43c - ; source: test_word_splitw_lte.p8:2071 cx16.r3 = &lbl43d - lda #p8l_lbl43d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2072 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2074 goto skip43d - bra p8l_skip43d - ; source: test_word_splitw_lte.p8:2075 lbl43d: fail_word(126) -p8l_lbl43d - ldy #>$7e - lda #<$7e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2076 skip43d: -p8l_skip43d - ; source: test_word_splitw_lte.p8:2078 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_258_afterif - ; source: test_word_splitw_lte.p8:2079 fail_word(127) - ldy #>$7f - lda #<$7f - jsr p8b_main.p8s_fail_word -label_asm_258_afterif - ; source: test_word_splitw_lte.p8:2082 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_260_else - ; source: test_word_splitw_lte.p8:2083 fail_word(128) - ldy #>$80 - lda #<$80 - jsr p8b_main.p8s_fail_word - bra label_asm_259_afterif -label_asm_260_else - ; source: test_word_splitw_lte.p8:2085 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_259_afterif - ; source: test_word_splitw_lte.p8:2087 values[1]=-1 - ldy #1 - lda #<-1 - sta p8v_values_lsb,y - lda #>-1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2089 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl44a - ; source: test_word_splitw_lte.p8:2091 goto skip44a - bra p8l_skip44a - ; source: test_word_splitw_lte.p8:2092 lbl44a: fail_word(129) -p8l_lbl44a - ldy #>$81 - lda #<$81 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2093 skip44a: -p8l_skip44a - ; source: test_word_splitw_lte.p8:2095 cx16.r3 = &lbl44b - lda #p8l_lbl44b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2096 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2098 goto skip44b - bra p8l_skip44b - ; source: test_word_splitw_lte.p8:2099 lbl44b: fail_word(130) -p8l_lbl44b - ldy #>$82 - lda #<$82 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2100 skip44b: -p8l_skip44b - ; source: test_word_splitw_lte.p8:2102 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_261_afterif - ; source: test_word_splitw_lte.p8:2103 fail_word(131) - ldy #>$83 - lda #<$83 - jsr p8b_main.p8s_fail_word -label_asm_261_afterif - ; source: test_word_splitw_lte.p8:2106 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_263_else - ; source: test_word_splitw_lte.p8:2107 fail_word(132) - ldy #>$84 - lda #<$84 - jsr p8b_main.p8s_fail_word - bra label_asm_262_afterif -label_asm_263_else - ; source: test_word_splitw_lte.p8:2109 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_262_afterif - ; source: test_word_splitw_lte.p8:2112 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl44c - ; source: test_word_splitw_lte.p8:2114 goto skip44c - bra p8l_skip44c - ; source: test_word_splitw_lte.p8:2115 lbl44c: fail_word(133) -p8l_lbl44c - ldy #>$85 - lda #<$85 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2116 skip44c: -p8l_skip44c - ; source: test_word_splitw_lte.p8:2118 cx16.r3 = &lbl44d - lda #p8l_lbl44d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2119 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2121 goto skip44d - bra p8l_skip44d - ; source: test_word_splitw_lte.p8:2122 lbl44d: fail_word(134) -p8l_lbl44d - ldy #>$86 - lda #<$86 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2123 skip44d: -p8l_skip44d - ; source: test_word_splitw_lte.p8:2125 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_264_afterif - ; source: test_word_splitw_lte.p8:2126 fail_word(135) - ldy #>$87 - lda #<$87 - jsr p8b_main.p8s_fail_word -label_asm_264_afterif - ; source: test_word_splitw_lte.p8:2129 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_266_else - ; source: test_word_splitw_lte.p8:2130 fail_word(136) - ldy #>$88 - lda #<$88 - jsr p8b_main.p8s_fail_word - bra label_asm_265_afterif -label_asm_266_else - ; source: test_word_splitw_lte.p8:2132 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_265_afterif - ; source: test_word_splitw_lte.p8:2134 values[1]=0 - ldy #1 - lda #0 - sta p8v_values_lsb,y - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2136 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl45a - ; source: test_word_splitw_lte.p8:2138 goto skip45a - bra p8l_skip45a - ; source: test_word_splitw_lte.p8:2139 lbl45a: fail_word(137) -p8l_lbl45a - ldy #>$89 - lda #<$89 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2140 skip45a: -p8l_skip45a - ; source: test_word_splitw_lte.p8:2142 cx16.r3 = &lbl45b - lda #p8l_lbl45b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2143 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2145 goto skip45b - bra p8l_skip45b - ; source: test_word_splitw_lte.p8:2146 lbl45b: fail_word(138) -p8l_lbl45b - ldy #>$8a - lda #<$8a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2147 skip45b: -p8l_skip45b - ; source: test_word_splitw_lte.p8:2149 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_267_afterif - ; source: test_word_splitw_lte.p8:2150 fail_word(139) - ldy #>$8b - lda #<$8b - jsr p8b_main.p8s_fail_word -label_asm_267_afterif - ; source: test_word_splitw_lte.p8:2153 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_269_else - ; source: test_word_splitw_lte.p8:2154 fail_word(140) - ldy #>$8c - lda #<$8c - jsr p8b_main.p8s_fail_word - bra label_asm_268_afterif -label_asm_269_else - ; source: test_word_splitw_lte.p8:2156 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_268_afterif - ; source: test_word_splitw_lte.p8:2159 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl45c - ; source: test_word_splitw_lte.p8:2161 goto skip45c - bra p8l_skip45c - ; source: test_word_splitw_lte.p8:2162 lbl45c: fail_word(141) -p8l_lbl45c - ldy #>$8d - lda #<$8d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2163 skip45c: -p8l_skip45c - ; source: test_word_splitw_lte.p8:2165 cx16.r3 = &lbl45d - lda #p8l_lbl45d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2166 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2168 goto skip45d - bra p8l_skip45d - ; source: test_word_splitw_lte.p8:2169 lbl45d: fail_word(142) -p8l_lbl45d - ldy #>$8e - lda #<$8e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2170 skip45d: -p8l_skip45d - ; source: test_word_splitw_lte.p8:2172 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_270_afterif - ; source: test_word_splitw_lte.p8:2173 fail_word(143) - ldy #>$8f - lda #<$8f - jsr p8b_main.p8s_fail_word -label_asm_270_afterif - ; source: test_word_splitw_lte.p8:2176 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_272_else - ; source: test_word_splitw_lte.p8:2177 fail_word(144) - ldy #>$90 - lda #<$90 - jsr p8b_main.p8s_fail_word - bra label_asm_271_afterif -label_asm_272_else - ; source: test_word_splitw_lte.p8:2179 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_271_afterif - ; source: test_word_splitw_lte.p8:2181 values[1]=1 - ldy #1 - lda #<1 - sta p8v_values_lsb,y - lda #>1 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2183 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl46a - ; source: test_word_splitw_lte.p8:2185 goto skip46a - bra p8l_skip46a - ; source: test_word_splitw_lte.p8:2186 lbl46a: fail_word(145) -p8l_lbl46a - ldy #>$91 - lda #<$91 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2187 skip46a: -p8l_skip46a - ; source: test_word_splitw_lte.p8:2189 cx16.r3 = &lbl46b - lda #p8l_lbl46b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2190 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2192 goto skip46b - bra p8l_skip46b - ; source: test_word_splitw_lte.p8:2193 lbl46b: fail_word(146) -p8l_lbl46b - ldy #>$92 - lda #<$92 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2194 skip46b: -p8l_skip46b - ; source: test_word_splitw_lte.p8:2196 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_273_afterif - ; source: test_word_splitw_lte.p8:2197 fail_word(147) - ldy #>$93 - lda #<$93 - jsr p8b_main.p8s_fail_word -label_asm_273_afterif - ; source: test_word_splitw_lte.p8:2200 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_275_else - ; source: test_word_splitw_lte.p8:2201 fail_word(148) - ldy #>$94 - lda #<$94 - jsr p8b_main.p8s_fail_word - bra label_asm_274_afterif -label_asm_275_else - ; source: test_word_splitw_lte.p8:2203 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_274_afterif - ; source: test_word_splitw_lte.p8:2206 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl46c - ; source: test_word_splitw_lte.p8:2208 goto skip46c - bra p8l_skip46c - ; source: test_word_splitw_lte.p8:2209 lbl46c: fail_word(149) -p8l_lbl46c - ldy #>$95 - lda #<$95 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2210 skip46c: -p8l_skip46c - ; source: test_word_splitw_lte.p8:2212 cx16.r3 = &lbl46d - lda #p8l_lbl46d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2213 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2215 goto skip46d - bra p8l_skip46d - ; source: test_word_splitw_lte.p8:2216 lbl46d: fail_word(150) -p8l_lbl46d - ldy #>$96 - lda #<$96 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2217 skip46d: -p8l_skip46d - ; source: test_word_splitw_lte.p8:2219 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_276_afterif - ; source: test_word_splitw_lte.p8:2220 fail_word(151) - ldy #>$97 - lda #<$97 - jsr p8b_main.p8s_fail_word -label_asm_276_afterif - ; source: test_word_splitw_lte.p8:2223 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_278_else - ; source: test_word_splitw_lte.p8:2224 fail_word(152) - ldy #>$98 - lda #<$98 - jsr p8b_main.p8s_fail_word - bra label_asm_277_afterif -label_asm_278_else - ; source: test_word_splitw_lte.p8:2226 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_277_afterif - ; source: test_word_splitw_lte.p8:2228 values[1]=170 - ldy #1 - lda #<$aa - sta p8v_values_lsb,y - lda #>$aa - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2230 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl47a - ; source: test_word_splitw_lte.p8:2232 goto skip47a - bra p8l_skip47a - ; source: test_word_splitw_lte.p8:2233 lbl47a: fail_word(153) -p8l_lbl47a - ldy #>$99 - lda #<$99 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2234 skip47a: -p8l_skip47a - ; source: test_word_splitw_lte.p8:2236 cx16.r3 = &lbl47b - lda #p8l_lbl47b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2237 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2239 goto skip47b - bra p8l_skip47b - ; source: test_word_splitw_lte.p8:2240 lbl47b: fail_word(154) -p8l_lbl47b - ldy #>$9a - lda #<$9a - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2241 skip47b: -p8l_skip47b - ; source: test_word_splitw_lte.p8:2243 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_279_afterif - ; source: test_word_splitw_lte.p8:2244 fail_word(155) - ldy #>$9b - lda #<$9b - jsr p8b_main.p8s_fail_word -label_asm_279_afterif - ; source: test_word_splitw_lte.p8:2247 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_281_else - ; source: test_word_splitw_lte.p8:2248 fail_word(156) - ldy #>$9c - lda #<$9c - jsr p8b_main.p8s_fail_word - bra label_asm_280_afterif -label_asm_281_else - ; source: test_word_splitw_lte.p8:2250 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_280_afterif - ; source: test_word_splitw_lte.p8:2253 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl47c - ; source: test_word_splitw_lte.p8:2255 goto skip47c - bra p8l_skip47c - ; source: test_word_splitw_lte.p8:2256 lbl47c: fail_word(157) -p8l_lbl47c - ldy #>$9d - lda #<$9d - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2257 skip47c: -p8l_skip47c - ; source: test_word_splitw_lte.p8:2259 cx16.r3 = &lbl47d - lda #p8l_lbl47d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2260 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2262 goto skip47d - bra p8l_skip47d - ; source: test_word_splitw_lte.p8:2263 lbl47d: fail_word(158) -p8l_lbl47d - ldy #>$9e - lda #<$9e - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2264 skip47d: -p8l_skip47d - ; source: test_word_splitw_lte.p8:2266 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_282_afterif - ; source: test_word_splitw_lte.p8:2267 fail_word(159) - ldy #>$9f - lda #<$9f - jsr p8b_main.p8s_fail_word -label_asm_282_afterif - ; source: test_word_splitw_lte.p8:2270 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_284_else - ; source: test_word_splitw_lte.p8:2271 fail_word(160) - ldy #>$a0 - lda #<$a0 - jsr p8b_main.p8s_fail_word - bra label_asm_283_afterif -label_asm_284_else - ; source: test_word_splitw_lte.p8:2273 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_283_afterif - ; source: test_word_splitw_lte.p8:2275 values[1]=30464 - ldy #1 - lda #<$7700 - sta p8v_values_lsb,y - lda #>$7700 - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2277 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl48a - ; source: test_word_splitw_lte.p8:2279 goto skip48a - bra p8l_skip48a - ; source: test_word_splitw_lte.p8:2280 lbl48a: fail_word(161) -p8l_lbl48a - ldy #>$a1 - lda #<$a1 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2281 skip48a: -p8l_skip48a - ; source: test_word_splitw_lte.p8:2283 cx16.r3 = &lbl48b - lda #p8l_lbl48b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2284 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2286 goto skip48b - bra p8l_skip48b - ; source: test_word_splitw_lte.p8:2287 lbl48b: fail_word(162) -p8l_lbl48b - ldy #>$a2 - lda #<$a2 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2288 skip48b: -p8l_skip48b - ; source: test_word_splitw_lte.p8:2290 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_285_afterif - ; source: test_word_splitw_lte.p8:2291 fail_word(163) - ldy #>$a3 - lda #<$a3 - jsr p8b_main.p8s_fail_word -label_asm_285_afterif - ; source: test_word_splitw_lte.p8:2294 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_287_else - ; source: test_word_splitw_lte.p8:2295 fail_word(164) - ldy #>$a4 - lda #<$a4 - jsr p8b_main.p8s_fail_word - bra label_asm_286_afterif -label_asm_287_else - ; source: test_word_splitw_lte.p8:2297 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_286_afterif - ; source: test_word_splitw_lte.p8:2300 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl48c - ; source: test_word_splitw_lte.p8:2302 goto skip48c - bra p8l_skip48c - ; source: test_word_splitw_lte.p8:2303 lbl48c: fail_word(165) -p8l_lbl48c - ldy #>$a5 - lda #<$a5 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2304 skip48c: -p8l_skip48c - ; source: test_word_splitw_lte.p8:2306 cx16.r3 = &lbl48d - lda #p8l_lbl48d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2307 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2309 goto skip48d - bra p8l_skip48d - ; source: test_word_splitw_lte.p8:2310 lbl48d: fail_word(166) -p8l_lbl48d - ldy #>$a6 - lda #<$a6 - jsr p8b_main.p8s_fail_word - ; source: test_word_splitw_lte.p8:2311 skip48d: -p8l_skip48d - ; source: test_word_splitw_lte.p8:2313 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_288_afterif - ; source: test_word_splitw_lte.p8:2314 fail_word(167) - ldy #>$a7 - lda #<$a7 - jsr p8b_main.p8s_fail_word -label_asm_288_afterif - ; source: test_word_splitw_lte.p8:2317 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_290_else - ; source: test_word_splitw_lte.p8:2318 fail_word(168) - ldy #>$a8 - lda #<$a8 - jsr p8b_main.p8s_fail_word - bra label_asm_289_afterif -label_asm_290_else - ; source: test_word_splitw_lte.p8:2320 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_289_afterif - ; source: test_word_splitw_lte.p8:2322 values[1]=32767 - ldy #1 - lda #<$7fff - sta p8v_values_lsb,y - lda #>$7fff - sta p8v_values_msb,y - ; source: test_word_splitw_lte.p8:2324 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bmi p8l_lbl49a - ; source: test_word_splitw_lte.p8:2326 goto skip49a - bra p8l_skip49a - ; source: test_word_splitw_lte.p8:2327 lbl49a: success++ -p8l_lbl49a - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2328 skip49a: -p8l_skip49a - ; source: test_word_splitw_lte.p8:2330 cx16.r3 = &lbl49b - lda #p8l_lbl49b - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2331 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2333 goto skip49b - bra p8l_skip49b - ; source: test_word_splitw_lte.p8:2334 lbl49b: success++ -p8l_lbl49b - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2335 skip49b: -p8l_skip49b - ; source: test_word_splitw_lte.p8:2337 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_291_afterif - ; source: test_word_splitw_lte.p8:2338 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_291_afterif - ; source: test_word_splitw_lte.p8:2341 if x<=values[1] - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp p8v_x - tya - sbc p8v_x+1 - bvc + - eor #128 -+ bmi label_asm_293_else - ; source: test_word_splitw_lte.p8:2342 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_292_afterif -label_asm_293_else - ; source: test_word_splitw_lte.p8:2344 cx16.r0L++ - inc cx16.r0L -label_asm_292_afterif - ; source: test_word_splitw_lte.p8:2347 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bmi p8l_lbl49c - ; source: test_word_splitw_lte.p8:2349 goto skip49c - bra p8l_skip49c - ; source: test_word_splitw_lte.p8:2350 lbl49c: success++ -p8l_lbl49c - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2351 skip49c: -p8l_skip49c - ; source: test_word_splitw_lte.p8:2353 cx16.r3 = &lbl49d - lda #p8l_lbl49d - sta cx16.r3 - sty cx16.r3+1 - ; source: test_word_splitw_lte.p8:2354 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvs + - eor #128 -+ bpl + - jmp (cx16.r3) -+ - ; source: test_word_splitw_lte.p8:2356 goto skip49d - bra p8l_skip49d - ; source: test_word_splitw_lte.p8:2357 lbl49d: success++ -p8l_lbl49d - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - ; source: test_word_splitw_lte.p8:2358 skip49d: -p8l_skip49d - ; source: test_word_splitw_lte.p8:2360 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_294_afterif - ; source: test_word_splitw_lte.p8:2361 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ -label_asm_294_afterif - ; source: test_word_splitw_lte.p8:2364 if sources[1]<=values[1] - lda p8v_sources_lsb+1 - ldy p8v_sources_msb+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda p8v_values_lsb+1 - ldy p8v_values_msb+1 - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #128 -+ bmi label_asm_296_else - ; source: test_word_splitw_lte.p8:2365 success++ - inc p8b_main.p8v_success - bne + - inc p8b_main.p8v_success+1 -+ - bra label_asm_295_afterif -label_asm_296_else - ; source: test_word_splitw_lte.p8:2367 cx16.r0L++ - inc cx16.r0L -label_asm_295_afterif - ; source: test_word_splitw_lte.p8:2369 verify_success(266) - ldy #>$010a - lda #<$010a - jmp p8b_main.p8s_verify_success - ; source: test_word_splitw_lte.p8:47 sub test_cmp_array() { -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -p8v_x .sint ? - .send BSS -; non-zeropage variables -_array_p8v_sources := $0000, $0000 -p8v_sources_lsb .byte <_array_p8v_sources -p8v_sources_msb .byte >_array_p8v_sources -_array_p8v_values := $0000, $0000 -p8v_values_lsb .byte <_array_p8v_values -p8v_values_msb .byte >_array_p8v_values - .pend -prog8_init_vars .block - rts - .bend - .pend - -; ---- block: 'prog8_interned_strings' ---- -prog8_interned_strings .proc - -; non-zeropage variables -string_1 ; PETSCII:"\nless-equal split words array tests for: " - .byte $0d, $4c, $45, $53, $53, $2d, $45, $51, $55, $41, $4c, $20, $53, $50, $4c, $49 - .byte $54, $20, $57, $4f, $52, $44, $53, $20, $41, $52, $52, $41, $59, $20, $54, $45 - .byte $53, $54, $53, $20, $46, $4f, $52, $3a, $20, $00 -string_2 ; PETSCII:"\n<=array[]: " - .byte $0d, $3c, $3d, $41, $52, $52, $41, $59, $5b, $5d, $3a, $20, $00 -string_4 ; PETSCII:" **failed** " - .byte $20, $2a, $2a, $46, $41, $49, $4c, $45, $44, $2a, $2a, $20, $00 -string_5 ; PETSCII:" success, expected " - .byte $20, $53, $55, $43, $43, $45, $53, $53, $2c, $20, $45, $58, $50, $45, $43, $54 - .byte $45, $44, $20, $00 -string_6 ; PETSCII:" **fail#" - .byte $20, $2a, $2a, $46, $41, $49, $4c, $23, $00 -string_7 ; PETSCII:" **" - .byte $20, $2a, $2a, $00 - - ; source: test_word_splitw_lte.p8:14 txt.print("\nless-equal split words array tests for: ") - ; source: test_word_splitw_lte.p8:18 txt.print("\n<=array[]: ") - ; source: test_word_splitw_lte.p8:27 txt.print(" **failed** ") - ; source: test_word_splitw_lte.p8:29 txt.print(" success, expected ") - ; source: test_word_splitw_lte.p8:35 txt.print(" **fail#") - ; source: test_word_splitw_lte.p8:37 txt.print(" **") - .pend - -; ---- block: 'txt' ---- -txt .proc - ; source: library:/prog8lib/cx16/textio.p8:9 txt { - DEFAULT_HEIGHT = $3c - DEFAULT_WIDTH = $50 - VERA_TEXTMATRIX_ADDR = $b000 - VERA_TEXTMATRIX_BANK = 1 - - chrout = $ffd2 - - ; source: library:/prog8lib/cx16/textio.p8:13 const ubyte DEFAULT_WIDTH = 80 - ; source: library:/prog8lib/cx16/textio.p8:14 const ubyte DEFAULT_HEIGHT = 60 - ; source: library:/prog8lib/cx16/textio.p8:16 const ubyte VERA_TEXTMATRIX_BANK = 1 - ; source: library:/prog8lib/cx16/textio.p8:17 const uword VERA_TEXTMATRIX_ADDR = $b000 - ; source: library:/prog8lib/shared_textio_functions.p8:1 txt { - ; source: library:/prog8lib/cx16/textio.p8:11 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/cx16/textio.p8:40 asmsub column(ubyte col @A) clobbers(A, X, Y) { - -column .proc - ; source: library:/prog8lib/cx16/textio.p8:42 %asm {{ - sec - jsr cbm.PLOT - tay - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:51 asmsub get_column() -> ubyte @Y { - -get_column .proc - ; source: library:/prog8lib/cx16/textio.p8:52 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:58 asmsub row(ubyte rownum @A) clobbers(A, X, Y) { - -row .proc - ; source: library:/prog8lib/cx16/textio.p8:60 %asm {{ - sec - jsr cbm.PLOT - tax - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:69 asmsub get_row() -> ubyte @X { - -get_row .proc - ; source: library:/prog8lib/cx16/textio.p8:70 %asm {{ - sec - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:88 asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { - -fill_screen .proc - ; source: library:/prog8lib/cx16/textio.p8:90 %asm {{ - sty _ly+1 - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00010000 - jsr set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified - phy -_ly ldy #1 ; modified -- sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sty cx16.VERA_DATA0 - dex - bne - - ply - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - -set_vera_textmatrix_addresses: - stz cx16.VERA_CTRL - ora #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L ; start at (0,0) - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:134 asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { - -clear_screenchars .proc - ; source: library:/prog8lib/cx16/textio.p8:137 %asm {{ - pha - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - pla -_lx ldx #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:163 asmsub clear_screencolors (ubyte color @ A) clobbers(X, Y) { - -clear_screencolors .proc - ; source: library:/prog8lib/cx16/textio.p8:166 %asm {{ - sta _la+1 - jsr cbm.SCREEN ; get dimensions in X/Y - txa - lsr a - lsr a - sta _lx+1 - stz cx16.VERA_CTRL - lda #%00100000 - jsr fill_screen.set_vera_textmatrix_addresses - inc cx16.VERA_ADDR_L ; start at (1,0) - the color attribute byte -_lx ldx #0 ; modified -_la lda #0 ; modified -- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - dex - bne - - dey - beq + - lda #1 - sta cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M ; next line - bra _lx -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:232 asmsub scroll_left() clobbers(A, X, Y) { - -scroll_left .proc - ; source: library:/prog8lib/cx16/textio.p8:235 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - lda #2 - sta cx16.VERA_ADDR_L ; begin in column 1 - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00010000 | VERA_TEXTMATRIX_BANK ; auto increment 1 - sta cx16.VERA_ADDR_H - stz cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:276 asmsub scroll_right() clobbers(A,X,Y) { - -scroll_right .proc - ; source: library:/prog8lib/cx16/textio.p8:279 %asm {{ - jsr cbm.SCREEN - dex - stx _lx+1 - txa - asl a - dea - sta _rcol+1 - ina - ina - sta _rcol2+1 - dey - sty P8ZP_SCRATCH_B1 ; number of rows to scroll - -_nextline - stz cx16.VERA_CTRL ; data port 0: source column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol lda #79*2-1 ; modified - sta cx16.VERA_ADDR_L ; begin in rightmost column minus one - lda P8ZP_SCRATCH_B1 - clc - adc #>VERA_TEXTMATRIX_ADDR - tay - sty cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1: destination column - lda #%00011000 | VERA_TEXTMATRIX_BANK ; auto decrement 1 - sta cx16.VERA_ADDR_H -_rcol2 lda #79*2+1 ; modified - sta cx16.VERA_ADDR_L - sty cx16.VERA_ADDR_M - -_lx ldx #0 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - bpl _nextline - - lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:328 asmsub scroll_up() clobbers(A, X, Y) { - -scroll_up .proc - ; source: library:/prog8lib/cx16/textio.p8:331 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - lda #1 | (>VERA_TEXTMATRIX_ADDR) - sta cx16.VERA_ADDR_M ; start at second line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - lda #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at top line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - inc cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:376 asmsub scroll_down() clobbers(A, X, Y) { - -scroll_down .proc - ; source: library:/prog8lib/cx16/textio.p8:379 %asm {{ - jsr cbm.SCREEN - stx _nextline+1 - dey - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL ; data port 0 is source - dey - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at line before bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - - lda #1 - sta cx16.VERA_CTRL ; data port 1 is destination - iny - tya - clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M ; start at bottom line - stz cx16.VERA_ADDR_L - lda #%00010000 | VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0. - -_nextline - ldx #80 ; modified -- lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy char - lda cx16.VERA_DATA0 - sta cx16.VERA_DATA1 ; copy color - dex - bne - - dec P8ZP_SCRATCH_B1 - beq + - stz cx16.VERA_CTRL ; data port 0 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - lda #1 - sta cx16.VERA_CTRL ; data port 1 - stz cx16.VERA_ADDR_L - dec cx16.VERA_ADDR_M - bra _nextline - -+ lda #0 - sta cx16.VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:430 romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. - - ; source: library:/prog8lib/cx16/textio.p8:432 asmsub print (str text @ AY) clobbers(A,Y) { - -print .proc - ; source: library:/prog8lib/cx16/textio.p8:437 %asm {{ - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy #0 -- lda (P8ZP_SCRATCH_B1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:450 asmsub print_ub0 (ubyte value @ A) clobbers(A,X,Y) { - -print_ub0 .proc - ; source: library:/prog8lib/cx16/textio.p8:452 %asm {{ - jsr conv.ubyte2decimal - pha - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:464 asmsub print_ub (ubyte value @ A) clobbers(A,X,Y) { - -print_ub .proc - ; source: library:/prog8lib/cx16/textio.p8:466 %asm {{ - jsr conv.ubyte2decimal -_print_byte_digits - pha - cpy #'0' - beq + - tya - jsr cbm.CHROUT - pla - jsr cbm.CHROUT - bra _ones -+ pla - cmp #'0' - beq _ones - jsr cbm.CHROUT -_ones txa - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:486 asmsub print_b (byte value @ A) clobbers(A,X,Y) { - -print_b .proc - ; source: library:/prog8lib/cx16/textio.p8:488 %asm {{ - pha - cmp #0 - bpl + - lda #'-' - jsr cbm.CHROUT -+ pla - jsr conv.byte2decimal - bra print_ub._print_byte_digits - .pend - ; source: library:/prog8lib/cx16/textio.p8:500 asmsub print_ubhex (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubhex .proc - ; source: library:/prog8lib/cx16/textio.p8:502 %asm {{ - bcc + - pha - lda #'$' - jsr cbm.CHROUT - pla -+ jsr conv.ubyte2hex - jsr cbm.CHROUT - tya - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:515 asmsub print_ubbin (ubyte value @ A, bool prefix @ Pc) clobbers(A,X,Y) { - -print_ubbin .proc - ; source: library:/prog8lib/cx16/textio.p8:517 %asm {{ - sta P8ZP_SCRATCH_B1 - bcc + - lda #'%' - jsr cbm.CHROUT -+ ldy #8 -- lda #'0' - asl P8ZP_SCRATCH_B1 - bcc + - lda #'1' -+ jsr cbm.CHROUT - dey - bne - - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:534 asmsub print_uwbin (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwbin .proc - ; source: library:/prog8lib/cx16/textio.p8:536 %asm {{ - pha - tya - jsr print_ubbin - pla - clc - bra print_ubbin - .pend - ; source: library:/prog8lib/cx16/textio.p8:546 asmsub print_uwhex (uword value @ AY, bool prefix @ Pc) clobbers(A,X,Y) { - -print_uwhex .proc - ; source: library:/prog8lib/cx16/textio.p8:549 %asm {{ - pha - tya - jsr print_ubhex - pla - clc - bra print_ubhex - .pend - ; source: library:/prog8lib/cx16/textio.p8:559 asmsub print_uw0 (uword value @ AY) clobbers(A,X,Y) { - -print_uw0 .proc - ; source: library:/prog8lib/cx16/textio.p8:561 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:573 asmsub print_uw (uword value @ AY) clobbers(A,X,Y) { - -print_uw .proc - ; source: library:/prog8lib/cx16/textio.p8:575 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - - -_gotdigit - jsr cbm.CHROUT - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit - rts -_allzero - lda #'0' - jmp cbm.CHROUT - .pend - ; source: library:/prog8lib/cx16/textio.p8:597 asmsub print_w (word value @ AY) clobbers(A,X,Y) { - -print_w .proc - ; source: library:/prog8lib/cx16/textio.p8:599 %asm {{ - cpy #0 - bpl + - pha - lda #'-' - jsr cbm.CHROUT - tya - eor #255 - tay - pla - eor #255 - ina - bne + - iny -+ bra print_uw - .pend - ; source: library:/prog8lib/cx16/textio.p8:617 asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - -input_chars .proc - ; source: library:/prog8lib/cx16/textio.p8:622 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 ; char counter = 0 -- jsr cbm.CHRIN - cmp #$0d ; return (ascii 13) pressed? - beq + ; yes, end. - sta (P8ZP_SCRATCH_W1),y ; else store char in buffer - iny - bne - -+ lda #0 - sta (P8ZP_SCRATCH_W1),y ; finish string with 0 byte - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:639 asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) { - -setchr .proc - ; source: library:/prog8lib/cx16/textio.p8:641 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:659 asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getchr .proc - ; source: library:/prog8lib/cx16/textio.p8:661 %asm {{ - asl a - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:678 asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) { - -setclr .proc - ; source: library:/prog8lib/cx16/textio.p8:682 %asm {{ - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - txa - asl a - ina - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - pla - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:701 asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { - -getclr .proc - ; source: library:/prog8lib/cx16/textio.p8:703 %asm {{ - asl a - ina - pha - stz cx16.VERA_CTRL - lda #VERA_TEXTMATRIX_BANK - sta cx16.VERA_ADDR_H - pla - sta cx16.VERA_ADDR_L - tya - ; clc - adc #>VERA_TEXTMATRIX_ADDR - sta cx16.VERA_ADDR_M - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:778 asmsub plot (ubyte col @ Y, ubyte row @ X) { - -plot .proc - ; source: library:/prog8lib/cx16/textio.p8:779 %asm {{ - clc - jmp cbm.PLOT - .pend - ; source: library:/prog8lib/cx16/textio.p8:785 asmsub width() clobbers(X,Y) -> ubyte @A { - -width .proc - ; source: library:/prog8lib/cx16/textio.p8:787 %asm {{ - jsr cbm.SCREEN - txa - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:794 asmsub height() clobbers(X, Y) -> ubyte @A { - -height .proc - ; source: library:/prog8lib/cx16/textio.p8:796 %asm {{ - jsr cbm.SCREEN - tya - rts - .pend - ; source: library:/prog8lib/cx16/textio.p8:803 asmsub waitkey() -> ubyte @A { - -waitkey .proc - ; source: library:/prog8lib/cx16/textio.p8:804 %asm {{ -- jsr cbm.GETIN - beq - - rts - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:5 asmsub petscii2scr(ubyte petscii_char @A) -> ubyte @A { - -petscii2scr .proc - ; source: library:/prog8lib/shared_textio_functions.p8:7 %asm {{ - sta P8ZP_SCRATCH_REG - lsr a - lsr a - lsr a - lsr a - lsr a - tax - lda _offsets,x - eor P8ZP_SCRATCH_REG - rts -_offsets .byte 128, 0, 64, 32, 64, 192, 128, 128 - .pend - ; source: library:/prog8lib/shared_textio_functions.p8:22 asmsub petscii2scr_str(str petscii_string @AY) { - -petscii2scr_str .proc - ; source: library:/prog8lib/shared_textio_functions.p8:24 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr petscii2scr - sta (P8ZP_SCRATCH_W1),y - iny - bne - -+ rts - .pend - .pend - -; ---- block: 'cbm' ---- -cbm .proc - ; source: library:/prog8lib/cx16/syslib.p8:6 cbm { - - CINT = $ff81 - IOINIT = $ff84 - RAMTAS = $ff87 - RESTOR = $ff8a - VECTOR = $ff8d - SETMSG = $ff90 - SECOND = $ff93 - TKSA = $ff96 - MEMTOP = $ff99 - MEMBOT = $ff9c - SCNKEY = $ff9f - SETTMO = $ffa2 - ACPTR = $ffa5 - CIOUT = $ffa8 - UNTLK = $ffab - UNLSN = $ffae - LISTEN = $ffb1 - TALK = $ffb4 - READST = $ffb7 - SETLFS = $ffba - SETNAM = $ffbd - OPEN = $ffc0 - CLOSE = $ffc3 - CHKIN = $ffc6 - CHKOUT = $ffc9 - CLRCHN = $ffcc - CHRIN = $ffcf - CHROUT = $ffd2 - LOAD = $ffd5 - SAVE = $ffd8 - SETTIM = $ffdb - RDTIM = $ffde - STOP = $ffe1 - GETIN = $ffe4 - CLALL = $ffe7 - UDTIM = $ffea - SCREEN = $ffed - PLOT = $fff0 - IOBASE = $fff3 - - ; source: library:/prog8lib/cx16/syslib.p8:14 romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip, including resetting to the default color palette. Note: also sets the video mode back to VGA - - ; source: library:/prog8lib/cx16/syslib.p8:15 romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, IRQ, ...) - - ; source: library:/prog8lib/cx16/syslib.p8:16 romsub $FF87 = RAMTAS() clobbers(A,X,Y) ; initialize RAM, screen - - ; source: library:/prog8lib/cx16/syslib.p8:17 romsub $FF8A = RESTOR() clobbers(A,X,Y) ; restore default I/O vectors - - ; source: library:/prog8lib/cx16/syslib.p8:18 romsub $FF8D = VECTOR(uword userptr @ XY, bool dir @ Pc) clobbers(A,Y) ; read/set I/O vector table - - ; source: library:/prog8lib/cx16/syslib.p8:19 romsub $FF90 = SETMSG(ubyte value @ A) ; set Kernal message control flag - - ; source: library:/prog8lib/cx16/syslib.p8:20 romsub $FF93 = SECOND(ubyte address @ A) clobbers(A) ; (alias: LSTNSA) send secondary address after LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:21 romsub $FF96 = TKSA(ubyte address @ A) clobbers(A) ; (alias: TALKSA) send secondary address after TALK - - ; source: library:/prog8lib/cx16/syslib.p8:22 romsub $FF99 = MEMTOP(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set top of memory pointer. NOTE: as a Cx16 extension, also returns the number of RAM memory banks in register A ! See cx16.numbanks() - - ; source: library:/prog8lib/cx16/syslib.p8:23 romsub $FF9C = MEMBOT(uword address @ XY, bool dir @ Pc) -> uword @ XY ; read/set bottom of memory pointer - - ; source: library:/prog8lib/cx16/syslib.p8:24 romsub $FF9F = SCNKEY() clobbers(A,X,Y) ; scan the keyboard, also called kbd_scan - - ; source: library:/prog8lib/cx16/syslib.p8:25 romsub $FFA2 = SETTMO(ubyte timeout @ A) ; set time-out flag for IEEE bus - - ; source: library:/prog8lib/cx16/syslib.p8:26 romsub $FFA5 = ACPTR() -> ubyte @ A ; (alias: IECIN) input byte from serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:27 romsub $FFA8 = CIOUT(ubyte databyte @ A) ; (alias: IECOUT) output byte to serial bus - - ; source: library:/prog8lib/cx16/syslib.p8:28 romsub $FFAB = UNTLK() clobbers(A) ; command serial bus device to UNTALK - - ; source: library:/prog8lib/cx16/syslib.p8:29 romsub $FFAE = UNLSN() clobbers(A) ; command serial bus device to UNLISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:30 romsub $FFB1 = LISTEN(ubyte device @ A) clobbers(A) ; command serial bus device to LISTEN - - ; source: library:/prog8lib/cx16/syslib.p8:31 romsub $FFB4 = TALK(ubyte device @ A) clobbers(A) ; command serial bus device to TALK - - ; source: library:/prog8lib/cx16/syslib.p8:32 romsub $FFB7 = READST() -> ubyte @ A ; read I/O status word (use CLEARST to reset it to 0) - - ; source: library:/prog8lib/cx16/syslib.p8:33 romsub $FFBA = SETLFS(ubyte logical @ A, ubyte device @ X, ubyte secondary @ Y) ; set logical file parameters - - ; source: library:/prog8lib/cx16/syslib.p8:34 romsub $FFBD = SETNAM(ubyte namelen @ A, str filename @ XY) ; set filename parameters - - ; source: library:/prog8lib/cx16/syslib.p8:35 romsub $FFC0 = OPEN() clobbers(X,Y) -> bool @Pc, ubyte @A ; (via 794 ($31A)) open a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:36 romsub $FFC3 = CLOSE(ubyte logical @ A) clobbers(A,X,Y) ; (via 796 ($31C)) close a logical file - - ; source: library:/prog8lib/cx16/syslib.p8:37 romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 ($31E)) define an input channel - - ; source: library:/prog8lib/cx16/syslib.p8:38 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel - - ; source: library:/prog8lib/cx16/syslib.p8:39 romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices - - ; source: library:/prog8lib/cx16/syslib.p8:40 romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. - - ; source: library:/prog8lib/cx16/syslib.p8:41 romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character - - ; source: library:/prog8lib/cx16/syslib.p8:42 romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device - - ; source: library:/prog8lib/cx16/syslib.p8:43 romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device. See also BSAVE - - ; source: library:/prog8lib/cx16/syslib.p8:44 romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:45 romsub $FFDE = RDTIM() -> ubyte @ A, ubyte @ X, ubyte @ Y ; read the software clock (A=lo,X=mid,Y=high) - - ; source: library:/prog8lib/cx16/syslib.p8:46 romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; (via 808 ($328)) check the STOP key (and some others in A) - - ; source: library:/prog8lib/cx16/syslib.p8:47 romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; (via 810 ($32A)) get a character - - ; source: library:/prog8lib/cx16/syslib.p8:48 romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files - - ; source: library:/prog8lib/cx16/syslib.p8:49 romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock - - ; source: library:/prog8lib/cx16/syslib.p8:50 romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns - - ; source: library:/prog8lib/cx16/syslib.p8:51 romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. - - ; source: library:/prog8lib/cx16/syslib.p8:52 romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices - - ; source: library:/prog8lib/cx16/syslib.p8:56 asmsub STOP2() clobbers(X) -> bool @A { - -STOP2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:58 %asm {{ - jsr cbm.STOP - beq + - lda #0 - rts -+ lda #1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:68 asmsub RDTIM16() clobbers(X) -> uword @AY { - -RDTIM16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:70 %asm {{ - php - sei - jsr cbm.RDTIM - plp - cli - pha - txa - tay - pla - rts - .pend - .pend - -; ---- block: 'cx16' ---- -cx16 .proc - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - r0 = 2 - r0s = 2 - r0L = 2 - r0sL = 2 - r0H = 3 - r0sH = 3 - r1 = 4 - r1s = 4 - r1L = 4 - r1sL = 4 - r1H = 5 - r1sH = 5 - r2 = 6 - r2s = 6 - r2L = 6 - r2sL = 6 - r2H = 7 - r2sH = 7 - r3 = 8 - r3s = 8 - r3L = 8 - r3sL = 8 - r3H = 9 - r3sH = 9 - r4 = 10 - r4s = 10 - r4L = 10 - r4sL = 10 - r4H = 11 - r4sH = 11 - r5 = 12 - r5s = 12 - r5L = 12 - r5sL = 12 - r5H = 13 - r5sH = 13 - r6 = 14 - r6s = 14 - r6L = 14 - r6sL = 14 - r6H = 15 - r6sH = 15 - r7 = $10 - r7s = $10 - r7L = $10 - r7sL = $10 - r7H = $11 - r7sH = $11 - r8 = $12 - r8s = $12 - r8L = $12 - r8sL = $12 - r8H = $13 - r8sH = $13 - r9 = $14 - r9s = $14 - r9L = $14 - r9sL = $14 - r9H = $15 - r9sH = $15 - r10 = $16 - r10s = $16 - r10L = $16 - r10sL = $16 - r10H = $17 - r10sH = $17 - r11 = $18 - r11s = $18 - r11L = $18 - r11sL = $18 - r11H = $19 - r11sH = $19 - r12 = $1a - r12s = $1a - r12L = $1a - r12sL = $1a - r12H = $1b - r12sH = $1b - r13 = $1c - r13s = $1c - r13L = $1c - r13sL = $1c - r13H = $1d - r13sH = $1d - r14 = $1e - r14s = $1e - r14L = $1e - r14sL = $1e - r14H = $1f - r14sH = $1f - r15 = $20 - r15s = $20 - r15L = $20 - r15sL = $20 - r15H = $21 - r15sH = $21 - IERROR = $0300 - IMAIN = $0302 - ICRNCH = $0304 - IQPLOP = $0306 - IGONE = $0308 - IEVAL = $030a - SAREG = $030c - SXREG = $030d - SYREG = $030e - SPREG = $030f - USRADD = $0311 - CINV = $0314 - CBINV = $0316 - NMINV = $0318 - IOPEN = $031a - ICLOSE = $031c - ICHKIN = $031e - ICKOUT = $0320 - ICLRCH = $0322 - IBASIN = $0324 - IBSOUT = $0326 - ISTOP = $0328 - IGETIN = $032a - ICLALL = $032c - KEYHDL = $032e - ILOAD = $0330 - ISAVE = $0332 - via1prb = $9f00 - via1pra = $9f01 - via1ddrb = $9f02 - via1ddra = $9f03 - via1t1l = $9f04 - via1t1h = $9f05 - via1t1ll = $9f06 - via1t1lh = $9f07 - via1t2l = $9f08 - via1t2h = $9f09 - via1sr = $9f0a - via1acr = $9f0b - via1pcr = $9f0c - via1ifr = $9f0d - via1ier = $9f0e - via1ora = $9f0f - via2prb = $9f10 - via2pra = $9f11 - via2ddrb = $9f12 - via2ddra = $9f13 - via2t1l = $9f14 - via2t1h = $9f15 - via2t1ll = $9f16 - via2t1lh = $9f17 - via2t2l = $9f18 - via2t2h = $9f19 - via2sr = $9f1a - via2acr = $9f1b - via2pcr = $9f1c - via2ifr = $9f1d - via2ier = $9f1e - via2ora = $9f1f - VERA_ADDR_L = $9f20 - VERA_ADDR = $9f20 - VERA_ADDR_M = $9f21 - VERA_ADDR_H = $9f22 - VERA_DATA0 = $9f23 - VERA_DATA1 = $9f24 - VERA_CTRL = $9f25 - VERA_IEN = $9f26 - VERA_ISR = $9f27 - VERA_IRQLINE_L = $9f28 - VERA_SCANLINE_L = $9f28 - VERA_DC_VIDEO = $9f29 - VERA_DC_HSTART = $9f29 - VERA_DC_VER0 = $9f29 - VERA_FX_CTRL = $9f29 - VERA_FX_X_INCR_L = $9f29 - VERA_FX_X_INCR = $9f29 - VERA_FX_X_POS_L = $9f29 - VERA_FX_X_POS = $9f29 - VERA_FX_X_POS_S = $9f29 - VERA_FX_CACHE_L = $9f29 - VERA_FX_ACCUM_RESET = $9f29 - VERA_DC_HSCALE = $9f2a - VERA_DC_HSTOP = $9f2a - VERA_DC_VER1 = $9f2a - VERA_FX_TILEBASE = $9f2a - VERA_FX_X_INCR_H = $9f2a - VERA_FX_X_POS_H = $9f2a - VERA_FX_Y_POS_S = $9f2a - VERA_FX_CACHE_M = $9f2a - VERA_FX_ACCUM = $9f2a - VERA_DC_VSCALE = $9f2b - VERA_DC_VSTART = $9f2b - VERA_DC_VER2 = $9f2b - VERA_FX_MAPBASE = $9f2b - VERA_FX_Y_INCR_L = $9f2b - VERA_FX_Y_INCR = $9f2b - VERA_FX_Y_POS_L = $9f2b - VERA_FX_Y_POS = $9f2b - VERA_FX_POLY_FILL_L = $9f2b - VERA_FX_POLY_FILL = $9f2b - VERA_FX_CACHE_H = $9f2b - VERA_DC_BORDER = $9f2c - VERA_DC_VSTOP = $9f2c - VERA_DC_VER3 = $9f2c - VERA_FX_MULT = $9f2c - VERA_FX_Y_INCR_H = $9f2c - VERA_FX_Y_POS_H = $9f2c - VERA_FX_POLY_FILL_H = $9f2c - VERA_FX_CACHE_U = $9f2c - VERA_L0_CONFIG = $9f2d - VERA_L0_MAPBASE = $9f2e - VERA_L0_TILEBASE = $9f2f - VERA_L0_HSCROLL_L = $9f30 - VERA_L0_HSCROLL = $9f30 - VERA_L0_HSCROLL_H = $9f31 - VERA_L0_VSCROLL_L = $9f32 - VERA_L0_VSCROLL = $9f32 - VERA_L0_VSCROLL_H = $9f33 - VERA_L1_CONFIG = $9f34 - VERA_L1_MAPBASE = $9f35 - VERA_L1_TILEBASE = $9f36 - VERA_L1_HSCROLL_L = $9f37 - VERA_L1_HSCROLL = $9f37 - VERA_L1_HSCROLL_H = $9f38 - VERA_L1_VSCROLL_L = $9f39 - VERA_L1_VSCROLL = $9f39 - VERA_L1_VSCROLL_H = $9f3a - VERA_AUDIO_CTRL = $9f3b - VERA_AUDIO_RATE = $9f3c - VERA_AUDIO_DATA = $9f3d - VERA_SPI_DATA = $9f3e - VERA_SPI_CTRL = $9f3f - YM_ADDRESS = $9f40 - YM_DATA = $9f41 - edkeyvec = $ac03 - edkeybk = $ac05 - NMI_VEC = $fffa - RESET_VEC = $fffc - IRQ_VEC = $fffe - VERA_BASE = $9f20 - VIA1_BASE = $9f00 - VIA2_BASE = $9f10 - extdev = $9f60 - - CLOSE_ALL = $ff4a - LKUPLA = $ff59 - LKUPSA = $ff5c - screen_mode = $ff5f - screen_set_charset = $ff62 - JSRFAR = $ff6e - fetch = $ff74 - stash = $ff77 - PRIMM = $ff7d - GRAPH_init = $ff20 - GRAPH_clear = $ff23 - GRAPH_set_window = $ff26 - GRAPH_set_colors = $ff29 - GRAPH_draw_line = $ff2c - GRAPH_draw_rect = $ff2f - GRAPH_move_rect = $ff32 - GRAPH_draw_oval = $ff35 - GRAPH_draw_image = $ff38 - GRAPH_set_font = $ff3b - GRAPH_get_char_size = $ff3e - GRAPH_put_char = $ff41 - GRAPH_put_next_char = $ff41 - FB_init = $fef6 - FB_get_info = $fef9 - FB_set_palette = $fefc - FB_cursor_position = $feff - FB_cursor_next_line = $ff02 - FB_get_pixel = $ff05 - FB_get_pixels = $ff08 - FB_set_pixel = $ff0b - FB_set_pixels = $ff0e - FB_set_8_pixels = $ff11 - FB_set_8_pixels_opaque = $ff14 - FB_fill_pixels = $ff17 - FB_filter_pixels = $ff1a - FB_move_pixels = $ff1d - BSAVE = $feba - i2c_read_byte = $fec6 - i2c_write_byte = $fec9 - sprite_set_image = $fef0 - sprite_set_position = $fef3 - memory_fill = $fee4 - memory_copy = $fee7 - memory_crc = $feea - memory_decompress = $feed - console_init = $fedb - console_put_char = $fede - console_get_char = $fee1 - console_put_image = $fed8 - console_set_paging_message = $fed5 - entropy_get = $fecf - monitor = $fecc - MACPTR = $ff44 - MCIOUT = $feb1 - enter_basic = $ff47 - clock_set_date_time = $ff4d - clock_get_date_time = $ff50 - kbdbuf_peek = $febd - kbdbuf_peek2 = $febd - kbdbuf_get_modifiers = $fec0 - kbdbuf_put = $fec3 - keymap = $fed2 - mouse_config = $ff68 - mouse_get = $ff6b - mouse_scan = $ff71 - joystick_scan = $ff53 - joystick_get = $ff56 - joystick_get2 = $ff56 - x16edit_default = $c000 - x16edit_loadfile = $c003 - x16edit_loadfile_options = $c006 - audio_init = $c09f - bas_fmfreq = $c000 - bas_fmnote = $c003 - bas_fmplaystring = $c006 - bas_fmvib = $c009 - bas_playstringvoice = $c00c - bas_psgfreq = $c00f - bas_psgnote = $c012 - bas_psgwav = $c015 - bas_psgplaystring = $c018 - bas_fmchordstring = $c08d - bas_psgchordstring = $c090 - notecon_bas2fm = $c01b - notecon_bas2midi = $c01e - notecon_bas2psg = $c021 - notecon_fm2bas = $c024 - notecon_fm2midi = $c027 - notecon_fm2psg = $c02a - notecon_freq2bas = $c02d - notecon_freq2fm = $c030 - notecon_freq2midi = $c033 - notecon_freq2psg = $c036 - notecon_midi2bas = $c039 - notecon_midi2fm = $c03c - notecon_midi2psg = $c03f - notecon_psg2bas = $c042 - notecon_psg2fm = $c045 - notecon_psg2midi = $c048 - psg_init = $c04b - psg_playfreq = $c04e - psg_read = $c051 - psg_setatten = $c054 - psg_setfreq = $c057 - psg_setpan = $c05a - psg_setvol = $c05d - psg_write = $c060 - psg_write_fast = $c0a2 - psg_getatten = $c093 - psg_getpan = $c096 - ym_init = $c063 - ym_loaddefpatches = $c066 - ym_loadpatch = $c069 - ym_loadpatchlfn = $c06c - ym_playdrum = $c06f - ym_playnote = $c072 - ym_setatten = $c075 - ym_setdrum = $c078 - ym_setnote = $c07b - ym_setpan = $c07e - ym_read = $c081 - ym_release = $c084 - ym_trigger = $c087 - ym_write = $c08a - ym_getatten = $c099 - ym_getpan = $c09c - ym_get_chip_type = $c0a5 - - ; source: library:/prog8lib/cx16/syslib.p8:98 &uword IERROR = $0300 - ; source: library:/prog8lib/cx16/syslib.p8:99 &uword IMAIN = $0302 - ; source: library:/prog8lib/cx16/syslib.p8:100 &uword ICRNCH = $0304 - ; source: library:/prog8lib/cx16/syslib.p8:101 &uword IQPLOP = $0306 - ; source: library:/prog8lib/cx16/syslib.p8:102 &uword IGONE = $0308 - ; source: library:/prog8lib/cx16/syslib.p8:103 &uword IEVAL = $030a - ; source: library:/prog8lib/cx16/syslib.p8:104 &ubyte SAREG = $030c ; register storage for A for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:105 &ubyte SXREG = $030d ; register storage for X for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:106 &ubyte SYREG = $030e ; register storage for Y for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:107 &ubyte SPREG = $030f ; register storage for P (status register) for SYS calls - ; source: library:/prog8lib/cx16/syslib.p8:108 &uword USRADD = $0311 ; vector for the USR() basic command - ; source: library:/prog8lib/cx16/syslib.p8:110 &uword CINV = $0314 ; IRQ vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:111 &uword CBINV = $0316 ; BRK vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:112 &uword NMINV = $0318 ; NMI vector (in ram) - ; source: library:/prog8lib/cx16/syslib.p8:113 &uword IOPEN = $031a - ; source: library:/prog8lib/cx16/syslib.p8:114 &uword ICLOSE = $031c - ; source: library:/prog8lib/cx16/syslib.p8:115 &uword ICHKIN = $031e - ; source: library:/prog8lib/cx16/syslib.p8:116 &uword ICKOUT = $0320 - ; source: library:/prog8lib/cx16/syslib.p8:117 &uword ICLRCH = $0322 - ; source: library:/prog8lib/cx16/syslib.p8:118 &uword IBASIN = $0324 - ; source: library:/prog8lib/cx16/syslib.p8:119 &uword IBSOUT = $0326 - ; source: library:/prog8lib/cx16/syslib.p8:120 &uword ISTOP = $0328 - ; source: library:/prog8lib/cx16/syslib.p8:121 &uword IGETIN = $032a - ; source: library:/prog8lib/cx16/syslib.p8:122 &uword ICLALL = $032c - ; source: library:/prog8lib/cx16/syslib.p8:123 &uword KEYHDL = $032e ; keyboard scan code handler see examples/cx16/keyboardhandler.p8 - ; source: library:/prog8lib/cx16/syslib.p8:124 &uword ILOAD = $0330 - ; source: library:/prog8lib/cx16/syslib.p8:125 &uword ISAVE = $0332 - ; source: library:/prog8lib/cx16/syslib.p8:126 &uword NMI_VEC = $FFFA ; 65c02 nmi vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:127 &uword RESET_VEC = $FFFC ; 65c02 reset vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:128 &uword IRQ_VEC = $FFFE ; 65c02 interrupt vector, determined by the kernal if banked in - ; source: library:/prog8lib/cx16/syslib.p8:130 &uword edkeyvec = $ac03 ; (ram bank 0): for intercepting BASIN/CHRIN key strokes. See set_chrin_keyhandler() - ; source: library:/prog8lib/cx16/syslib.p8:131 &ubyte edkeybk = $ac05 ; ...the RAM bank of the handler routine, if not in low ram - ; source: library:/prog8lib/cx16/syslib.p8:135 &uword r0 = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:136 &uword r1 = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:137 &uword r2 = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:138 &uword r3 = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:139 &uword r4 = $000a - ; source: library:/prog8lib/cx16/syslib.p8:140 &uword r5 = $000c - ; source: library:/prog8lib/cx16/syslib.p8:141 &uword r6 = $000e - ; source: library:/prog8lib/cx16/syslib.p8:142 &uword r7 = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:143 &uword r8 = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:144 &uword r9 = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:145 &uword r10 = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:146 &uword r11 = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:147 &uword r12 = $001a - ; source: library:/prog8lib/cx16/syslib.p8:148 &uword r13 = $001c - ; source: library:/prog8lib/cx16/syslib.p8:149 &uword r14 = $001e - ; source: library:/prog8lib/cx16/syslib.p8:150 &uword r15 = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:152 &word r0s = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:153 &word r1s = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:154 &word r2s = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:155 &word r3s = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:156 &word r4s = $000a - ; source: library:/prog8lib/cx16/syslib.p8:157 &word r5s = $000c - ; source: library:/prog8lib/cx16/syslib.p8:158 &word r6s = $000e - ; source: library:/prog8lib/cx16/syslib.p8:159 &word r7s = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:160 &word r8s = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:161 &word r9s = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:162 &word r10s = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:163 &word r11s = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:164 &word r12s = $001a - ; source: library:/prog8lib/cx16/syslib.p8:165 &word r13s = $001c - ; source: library:/prog8lib/cx16/syslib.p8:166 &word r14s = $001e - ; source: library:/prog8lib/cx16/syslib.p8:167 &word r15s = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:169 &ubyte r0L = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:170 &ubyte r1L = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:171 &ubyte r2L = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:172 &ubyte r3L = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:173 &ubyte r4L = $000a - ; source: library:/prog8lib/cx16/syslib.p8:174 &ubyte r5L = $000c - ; source: library:/prog8lib/cx16/syslib.p8:175 &ubyte r6L = $000e - ; source: library:/prog8lib/cx16/syslib.p8:176 &ubyte r7L = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:177 &ubyte r8L = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:178 &ubyte r9L = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:179 &ubyte r10L = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:180 &ubyte r11L = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:181 &ubyte r12L = $001a - ; source: library:/prog8lib/cx16/syslib.p8:182 &ubyte r13L = $001c - ; source: library:/prog8lib/cx16/syslib.p8:183 &ubyte r14L = $001e - ; source: library:/prog8lib/cx16/syslib.p8:184 &ubyte r15L = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:186 &ubyte r0H = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:187 &ubyte r1H = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:188 &ubyte r2H = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:189 &ubyte r3H = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:190 &ubyte r4H = $000b - ; source: library:/prog8lib/cx16/syslib.p8:191 &ubyte r5H = $000d - ; source: library:/prog8lib/cx16/syslib.p8:192 &ubyte r6H = $000f - ; source: library:/prog8lib/cx16/syslib.p8:193 &ubyte r7H = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:194 &ubyte r8H = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:195 &ubyte r9H = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:196 &ubyte r10H = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:197 &ubyte r11H = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:198 &ubyte r12H = $001b - ; source: library:/prog8lib/cx16/syslib.p8:199 &ubyte r13H = $001d - ; source: library:/prog8lib/cx16/syslib.p8:200 &ubyte r14H = $001f - ; source: library:/prog8lib/cx16/syslib.p8:201 &ubyte r15H = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:203 &byte r0sL = $0002 - ; source: library:/prog8lib/cx16/syslib.p8:204 &byte r1sL = $0004 - ; source: library:/prog8lib/cx16/syslib.p8:205 &byte r2sL = $0006 - ; source: library:/prog8lib/cx16/syslib.p8:206 &byte r3sL = $0008 - ; source: library:/prog8lib/cx16/syslib.p8:207 &byte r4sL = $000a - ; source: library:/prog8lib/cx16/syslib.p8:208 &byte r5sL = $000c - ; source: library:/prog8lib/cx16/syslib.p8:209 &byte r6sL = $000e - ; source: library:/prog8lib/cx16/syslib.p8:210 &byte r7sL = $0010 - ; source: library:/prog8lib/cx16/syslib.p8:211 &byte r8sL = $0012 - ; source: library:/prog8lib/cx16/syslib.p8:212 &byte r9sL = $0014 - ; source: library:/prog8lib/cx16/syslib.p8:213 &byte r10sL = $0016 - ; source: library:/prog8lib/cx16/syslib.p8:214 &byte r11sL = $0018 - ; source: library:/prog8lib/cx16/syslib.p8:215 &byte r12sL = $001a - ; source: library:/prog8lib/cx16/syslib.p8:216 &byte r13sL = $001c - ; source: library:/prog8lib/cx16/syslib.p8:217 &byte r14sL = $001e - ; source: library:/prog8lib/cx16/syslib.p8:218 &byte r15sL = $0020 - ; source: library:/prog8lib/cx16/syslib.p8:220 &byte r0sH = $0003 - ; source: library:/prog8lib/cx16/syslib.p8:221 &byte r1sH = $0005 - ; source: library:/prog8lib/cx16/syslib.p8:222 &byte r2sH = $0007 - ; source: library:/prog8lib/cx16/syslib.p8:223 &byte r3sH = $0009 - ; source: library:/prog8lib/cx16/syslib.p8:224 &byte r4sH = $000b - ; source: library:/prog8lib/cx16/syslib.p8:225 &byte r5sH = $000d - ; source: library:/prog8lib/cx16/syslib.p8:226 &byte r6sH = $000f - ; source: library:/prog8lib/cx16/syslib.p8:227 &byte r7sH = $0011 - ; source: library:/prog8lib/cx16/syslib.p8:228 &byte r8sH = $0013 - ; source: library:/prog8lib/cx16/syslib.p8:229 &byte r9sH = $0015 - ; source: library:/prog8lib/cx16/syslib.p8:230 &byte r10sH = $0017 - ; source: library:/prog8lib/cx16/syslib.p8:231 &byte r11sH = $0019 - ; source: library:/prog8lib/cx16/syslib.p8:232 &byte r12sH = $001b - ; source: library:/prog8lib/cx16/syslib.p8:233 &byte r13sH = $001d - ; source: library:/prog8lib/cx16/syslib.p8:234 &byte r14sH = $001f - ; source: library:/prog8lib/cx16/syslib.p8:235 &byte r15sH = $0021 - ; source: library:/prog8lib/cx16/syslib.p8:239 const uword VERA_BASE = $9F20 - ; source: library:/prog8lib/cx16/syslib.p8:240 &ubyte VERA_ADDR_L = VERA_BASE + $0000 - ; source: library:/prog8lib/cx16/syslib.p8:241 &ubyte VERA_ADDR_M = VERA_BASE + $0001 - ; source: library:/prog8lib/cx16/syslib.p8:242 &uword VERA_ADDR = VERA_BASE + $0000 ; still need to do the _H separately - ; source: library:/prog8lib/cx16/syslib.p8:243 &ubyte VERA_ADDR_H = VERA_BASE + $0002 - ; source: library:/prog8lib/cx16/syslib.p8:244 &ubyte VERA_DATA0 = VERA_BASE + $0003 - ; source: library:/prog8lib/cx16/syslib.p8:245 &ubyte VERA_DATA1 = VERA_BASE + $0004 - ; source: library:/prog8lib/cx16/syslib.p8:246 &ubyte VERA_CTRL = VERA_BASE + $0005 - ; source: library:/prog8lib/cx16/syslib.p8:247 &ubyte VERA_IEN = VERA_BASE + $0006 - ; source: library:/prog8lib/cx16/syslib.p8:248 &ubyte VERA_ISR = VERA_BASE + $0007 - ; source: library:/prog8lib/cx16/syslib.p8:249 &ubyte VERA_IRQLINE_L = VERA_BASE + $0008 ; write only - ; source: library:/prog8lib/cx16/syslib.p8:250 &ubyte VERA_SCANLINE_L = VERA_BASE + $0008 ; read only - ; source: library:/prog8lib/cx16/syslib.p8:251 &ubyte VERA_DC_VIDEO = VERA_BASE + $0009 ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:252 &ubyte VERA_DC_HSCALE = VERA_BASE + $000A ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:253 &ubyte VERA_DC_VSCALE = VERA_BASE + $000B ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:254 &ubyte VERA_DC_BORDER = VERA_BASE + $000C ; DCSEL= 0 - ; source: library:/prog8lib/cx16/syslib.p8:255 &ubyte VERA_DC_HSTART = VERA_BASE + $0009 ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:256 &ubyte VERA_DC_HSTOP = VERA_BASE + $000A ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:257 &ubyte VERA_DC_VSTART = VERA_BASE + $000B ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:258 &ubyte VERA_DC_VSTOP = VERA_BASE + $000C ; DCSEL= 1 - ; source: library:/prog8lib/cx16/syslib.p8:259 &ubyte VERA_DC_VER0 = VERA_BASE + $0009 ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:260 &ubyte VERA_DC_VER1 = VERA_BASE + $000A ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:261 &ubyte VERA_DC_VER2 = VERA_BASE + $000B ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:262 &ubyte VERA_DC_VER3 = VERA_BASE + $000C ; DCSEL=63 - ; source: library:/prog8lib/cx16/syslib.p8:263 &ubyte VERA_L0_CONFIG = VERA_BASE + $000D - ; source: library:/prog8lib/cx16/syslib.p8:264 &ubyte VERA_L0_MAPBASE = VERA_BASE + $000E - ; source: library:/prog8lib/cx16/syslib.p8:265 &ubyte VERA_L0_TILEBASE = VERA_BASE + $000F - ; source: library:/prog8lib/cx16/syslib.p8:266 &ubyte VERA_L0_HSCROLL_L = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:267 &ubyte VERA_L0_HSCROLL_H = VERA_BASE + $0011 - ; source: library:/prog8lib/cx16/syslib.p8:268 &uword VERA_L0_HSCROLL = VERA_BASE + $0010 - ; source: library:/prog8lib/cx16/syslib.p8:269 &ubyte VERA_L0_VSCROLL_L = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:270 &ubyte VERA_L0_VSCROLL_H = VERA_BASE + $0013 - ; source: library:/prog8lib/cx16/syslib.p8:271 &uword VERA_L0_VSCROLL = VERA_BASE + $0012 - ; source: library:/prog8lib/cx16/syslib.p8:272 &ubyte VERA_L1_CONFIG = VERA_BASE + $0014 - ; source: library:/prog8lib/cx16/syslib.p8:273 &ubyte VERA_L1_MAPBASE = VERA_BASE + $0015 - ; source: library:/prog8lib/cx16/syslib.p8:274 &ubyte VERA_L1_TILEBASE = VERA_BASE + $0016 - ; source: library:/prog8lib/cx16/syslib.p8:275 &ubyte VERA_L1_HSCROLL_L = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:276 &ubyte VERA_L1_HSCROLL_H = VERA_BASE + $0018 - ; source: library:/prog8lib/cx16/syslib.p8:277 &uword VERA_L1_HSCROLL = VERA_BASE + $0017 - ; source: library:/prog8lib/cx16/syslib.p8:278 &ubyte VERA_L1_VSCROLL_L = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:279 &ubyte VERA_L1_VSCROLL_H = VERA_BASE + $001A - ; source: library:/prog8lib/cx16/syslib.p8:280 &uword VERA_L1_VSCROLL = VERA_BASE + $0019 - ; source: library:/prog8lib/cx16/syslib.p8:281 &ubyte VERA_AUDIO_CTRL = VERA_BASE + $001B - ; source: library:/prog8lib/cx16/syslib.p8:282 &ubyte VERA_AUDIO_RATE = VERA_BASE + $001C - ; source: library:/prog8lib/cx16/syslib.p8:283 &ubyte VERA_AUDIO_DATA = VERA_BASE + $001D - ; source: library:/prog8lib/cx16/syslib.p8:284 &ubyte VERA_SPI_DATA = VERA_BASE + $001E - ; source: library:/prog8lib/cx16/syslib.p8:285 &ubyte VERA_SPI_CTRL = VERA_BASE + $001F - ; source: library:/prog8lib/cx16/syslib.p8:288 &ubyte VERA_FX_CTRL = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:289 &ubyte VERA_FX_TILEBASE = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:290 &ubyte VERA_FX_MAPBASE = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:291 &ubyte VERA_FX_MULT = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:292 &ubyte VERA_FX_X_INCR_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:293 &ubyte VERA_FX_X_INCR_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:294 &uword VERA_FX_X_INCR = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:295 &ubyte VERA_FX_Y_INCR_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:296 &ubyte VERA_FX_Y_INCR_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:297 &uword VERA_FX_Y_INCR = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:298 &ubyte VERA_FX_X_POS_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:299 &ubyte VERA_FX_X_POS_H = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:300 &uword VERA_FX_X_POS = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:301 &ubyte VERA_FX_Y_POS_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:302 &ubyte VERA_FX_Y_POS_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:303 &uword VERA_FX_Y_POS = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:304 &ubyte VERA_FX_X_POS_S = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:305 &ubyte VERA_FX_Y_POS_S = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:306 &ubyte VERA_FX_POLY_FILL_L = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:307 &ubyte VERA_FX_POLY_FILL_H = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:308 &uword VERA_FX_POLY_FILL = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:309 &ubyte VERA_FX_CACHE_L = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:310 &ubyte VERA_FX_CACHE_M = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:311 &ubyte VERA_FX_CACHE_H = VERA_BASE + $000b - ; source: library:/prog8lib/cx16/syslib.p8:312 &ubyte VERA_FX_CACHE_U = VERA_BASE + $000c - ; source: library:/prog8lib/cx16/syslib.p8:313 &ubyte VERA_FX_ACCUM = VERA_BASE + $000a - ; source: library:/prog8lib/cx16/syslib.p8:314 &ubyte VERA_FX_ACCUM_RESET = VERA_BASE + $0009 - ; source: library:/prog8lib/cx16/syslib.p8:323 const uword VIA1_BASE = $9f00 ;VIA 6522 #1 - ; source: library:/prog8lib/cx16/syslib.p8:324 &ubyte via1prb = VIA1_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:325 &ubyte via1pra = VIA1_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:326 &ubyte via1ddrb = VIA1_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:327 &ubyte via1ddra = VIA1_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:328 &ubyte via1t1l = VIA1_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:329 &ubyte via1t1h = VIA1_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:330 &ubyte via1t1ll = VIA1_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:331 &ubyte via1t1lh = VIA1_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:332 &ubyte via1t2l = VIA1_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:333 &ubyte via1t2h = VIA1_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:334 &ubyte via1sr = VIA1_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:335 &ubyte via1acr = VIA1_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:336 &ubyte via1pcr = VIA1_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:337 &ubyte via1ifr = VIA1_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:338 &ubyte via1ier = VIA1_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:339 &ubyte via1ora = VIA1_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:341 const uword VIA2_BASE = $9f10 ;VIA 6522 #2 - ; source: library:/prog8lib/cx16/syslib.p8:342 &ubyte via2prb = VIA2_BASE + 0 - ; source: library:/prog8lib/cx16/syslib.p8:343 &ubyte via2pra = VIA2_BASE + 1 - ; source: library:/prog8lib/cx16/syslib.p8:344 &ubyte via2ddrb = VIA2_BASE + 2 - ; source: library:/prog8lib/cx16/syslib.p8:345 &ubyte via2ddra = VIA2_BASE + 3 - ; source: library:/prog8lib/cx16/syslib.p8:346 &ubyte via2t1l = VIA2_BASE + 4 - ; source: library:/prog8lib/cx16/syslib.p8:347 &ubyte via2t1h = VIA2_BASE + 5 - ; source: library:/prog8lib/cx16/syslib.p8:348 &ubyte via2t1ll = VIA2_BASE + 6 - ; source: library:/prog8lib/cx16/syslib.p8:349 &ubyte via2t1lh = VIA2_BASE + 7 - ; source: library:/prog8lib/cx16/syslib.p8:350 &ubyte via2t2l = VIA2_BASE + 8 - ; source: library:/prog8lib/cx16/syslib.p8:351 &ubyte via2t2h = VIA2_BASE + 9 - ; source: library:/prog8lib/cx16/syslib.p8:352 &ubyte via2sr = VIA2_BASE + 10 - ; source: library:/prog8lib/cx16/syslib.p8:353 &ubyte via2acr = VIA2_BASE + 11 - ; source: library:/prog8lib/cx16/syslib.p8:354 &ubyte via2pcr = VIA2_BASE + 12 - ; source: library:/prog8lib/cx16/syslib.p8:355 &ubyte via2ifr = VIA2_BASE + 13 - ; source: library:/prog8lib/cx16/syslib.p8:356 &ubyte via2ier = VIA2_BASE + 14 - ; source: library:/prog8lib/cx16/syslib.p8:357 &ubyte via2ora = VIA2_BASE + 15 - ; source: library:/prog8lib/cx16/syslib.p8:360 &ubyte YM_ADDRESS = $9f40 - ; source: library:/prog8lib/cx16/syslib.p8:361 &ubyte YM_DATA = $9f41 - ; source: library:/prog8lib/cx16/syslib.p8:363 const uword extdev = $9f60 - ; source: library:/prog8lib/cx16/syslib.p8:95 cx16 { - ; source: library:/prog8lib/cx16/syslib.p8:370 romsub $ff4a = CLOSE_ALL(ubyte device @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:371 romsub $ff59 = LKUPLA(ubyte la @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:372 romsub $ff5c = LKUPSA(ubyte sa @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:373 romsub $ff5f = screen_mode(ubyte mode @A, bool getCurrent @Pc) clobbers(X, Y) -> ubyte @A, bool @Pc ; note: X,Y size result is not supported, use SCREEN or get_screen_mode routine for that - - ; source: library:/prog8lib/cx16/syslib.p8:374 romsub $ff62 = screen_set_charset(ubyte charset @A, uword charsetptr @XY) clobbers(A,X,Y) ; incompatible with C128 dlchr() - - ; source: library:/prog8lib/cx16/syslib.p8:376 romsub $ff6e = JSRFAR() ; following word = address to call, byte after that=rom/ram bank it is in - - ; source: library:/prog8lib/cx16/syslib.p8:377 romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:378 romsub $ff77 = stash(ubyte data @A, ubyte bank @X, ubyte index @Y) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:379 romsub $ff7d = PRIMM() - - ; source: library:/prog8lib/cx16/syslib.p8:384 romsub $ff20 = GRAPH_init(uword vectors @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:385 romsub $ff23 = GRAPH_clear() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:386 romsub $ff26 = GRAPH_set_window(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:387 romsub $ff29 = GRAPH_set_colors(ubyte stroke @A, ubyte fill @X, ubyte background @Y) clobbers (A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:388 romsub $ff2c = GRAPH_draw_line(uword x1 @R0, uword y1 @R1, uword x2 @R2, uword y2 @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:389 romsub $ff2f = GRAPH_draw_rect(uword x @R0, uword y @R1, uword width @R2, uword height @R3, uword cornerradius @R4, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:390 romsub $ff32 = GRAPH_move_rect(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword width @R4, uword height @R5) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:391 romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword height @R3, bool fill @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:392 romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:393 romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:394 romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:395 romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:396 romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character - - ; source: library:/prog8lib/cx16/syslib.p8:399 romsub $fef6 = FB_init() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:400 romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 - - ; source: library:/prog8lib/cx16/syslib.p8:401 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:402 romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:403 romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:404 romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:405 romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:406 romsub $ff0b = FB_set_pixel(ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:407 romsub $ff0e = FB_set_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:408 romsub $ff11 = FB_set_8_pixels(ubyte pattern @A, ubyte color @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:409 romsub $ff14 = FB_set_8_pixels_opaque(ubyte pattern @R0, ubyte mask @A, ubyte color1 @X, ubyte color2 @Y) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:410 romsub $ff17 = FB_fill_pixels(uword count @R0, uword pstep @R1, ubyte color @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:411 romsub $ff1a = FB_filter_pixels(uword pointer @ R0, uword count @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:412 romsub $ff1d = FB_move_pixels(uword sx @R0, uword sy @R1, uword tx @R2, uword ty @R3, uword count @R4) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:415 romsub $FEBA = BSAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; like cbm.SAVE, but omits the 2-byte prg header - - ; source: library:/prog8lib/cx16/syslib.p8:416 romsub $fec6 = i2c_read_byte(ubyte device @X, ubyte offset @Y) clobbers (X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:417 romsub $fec9 = i2c_write_byte(ubyte device @X, ubyte offset @Y, ubyte data @A) clobbers (A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:418 romsub $fef0 = sprite_set_image(uword pixels @R0, uword mask @R1, ubyte bpp @R2, ubyte number @A, ubyte width @X, ubyte height @Y, bool apply_mask @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:419 romsub $fef3 = sprite_set_position(uword x @R0, uword y @R1, ubyte number @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:420 romsub $fee4 = memory_fill(uword address @R0, uword num_bytes @R1, ubyte value @A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:421 romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:422 romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 - - ; source: library:/prog8lib/cx16/syslib.p8:423 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 - - ; source: library:/prog8lib/cx16/syslib.p8:424 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:425 romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:426 romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:427 romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:428 romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:429 romsub $fecf = entropy_get() -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:430 romsub $fecc = monitor() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:432 romsub $ff44 = MACPTR(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:433 romsub $feb1 = MCIOUT(ubyte length @A, uword buffer @XY, bool dontAdvance @Pc) clobbers(A) -> bool @Pc, uword @XY - - ; source: library:/prog8lib/cx16/syslib.p8:434 romsub $ff47 = enter_basic(bool cold_or_warm @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:435 romsub $ff4d = clock_set_date_time(uword yearmonth @R0, uword dayhours @R1, uword minsecs @R2, uword jiffiesweekday @R3) clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:436 romsub $ff50 = clock_get_date_time() clobbers(A, X, Y) -> uword @R0, uword @R1, uword @R2, uword @R3 ; result registers see clock_set_date_time() - - ; source: library:/prog8lib/cx16/syslib.p8:440 romsub $febd = kbdbuf_peek() -> ubyte @A, ubyte @X ; key in A, queue length in X - - ; source: library:/prog8lib/cx16/syslib.p8:441 romsub $febd = kbdbuf_peek2() -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:442 romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:443 romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X) - - ; source: library:/prog8lib/cx16/syslib.p8:444 romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:445 romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:446 romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:447 romsub $ff71 = mouse_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:448 romsub $ff53 = joystick_scan() clobbers(A, X, Y) - - ; source: library:/prog8lib/cx16/syslib.p8:449 romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y - - ; source: library:/prog8lib/cx16/syslib.p8:450 romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values - - ; source: library:/prog8lib/cx16/syslib.p8:453 romsub $C000 = x16edit_default() clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:454 romsub $C003 = x16edit_loadfile(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, ubyte filenameLength @R1) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:455 romsub $C006 = x16edit_loadfile_options(ubyte firstbank @X, ubyte lastbank @Y, str filename @R0, - - ; source: library:/prog8lib/cx16/syslib.p8:460 romsub $C09F = audio_init() clobbers(A,X,Y) -> bool @Pc ; (re)initialize both vera PSG and YM audio chips - - ; source: library:/prog8lib/cx16/syslib.p8:461 romsub $C000 = bas_fmfreq(ubyte channel @A, uword freq @XY, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:462 romsub $C003 = bas_fmnote(ubyte channel @A, ubyte note @X, ubyte fracsemitone @Y, bool noretrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:463 romsub $C006 = bas_fmplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:464 romsub $C009 = bas_fmvib(ubyte speed @A, ubyte depth @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:465 romsub $C00C = bas_playstringvoice(ubyte channel @A) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:466 romsub $C00F = bas_psgfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:467 romsub $C012 = bas_psgnote(ubyte voice @A, ubyte note @X, ubyte fracsemitone @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:468 romsub $C015 = bas_psgwav(ubyte voice @A, ubyte waveform @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:469 romsub $C018 = bas_psgplaystring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:470 romsub $C08D = bas_fmchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:471 romsub $C090 = bas_psgchordstring(ubyte length @A, str string @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:472 romsub $C01B = notecon_bas2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:473 romsub $C01E = notecon_bas2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:474 romsub $C021 = notecon_bas2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:475 romsub $C024 = notecon_fm2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:476 romsub $C027 = notecon_fm2midi(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:477 romsub $C02A = notecon_fm2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:478 romsub $C02D = notecon_freq2bas(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:479 romsub $C030 = notecon_freq2fm(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:480 romsub $C033 = notecon_freq2midi(uword freqHz @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:481 romsub $C036 = notecon_freq2psg(uword freqHz @XY) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:482 romsub $C039 = notecon_midi2bas(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:483 romsub $C03C = notecon_midi2fm(ubyte note @X) clobbers(A) -> ubyte @X, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:484 romsub $C03F = notecon_midi2psg(ubyte note @X, ubyte fracsemitone @Y) clobbers(A) -> uword @XY, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:485 romsub $C042 = notecon_psg2bas(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:486 romsub $C045 = notecon_psg2fm(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:487 romsub $C048 = notecon_psg2midi(uword freq @XY) clobbers(A) -> ubyte @X, ubyte @Y, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:488 romsub $C04B = psg_init() clobbers(A,X,Y) ; (re)init Vera PSG - - ; source: library:/prog8lib/cx16/syslib.p8:489 romsub $C04E = psg_playfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:490 romsub $C051 = psg_read(ubyte offset @X, bool cookedVol @Pc) clobbers(Y) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:491 romsub $C054 = psg_setatten(ubyte voice @A, ubyte attenuation @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:492 romsub $C057 = psg_setfreq(ubyte voice @A, uword freq @XY) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:493 romsub $C05A = psg_setpan(ubyte voice @A, ubyte panning @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:494 romsub $C05D = psg_setvol(ubyte voice @A, ubyte volume @X) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:495 romsub $C060 = psg_write(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:496 romsub $C0A2 = psg_write_fast(ubyte value @A, ubyte offset @X) clobbers(Y) - - ; source: library:/prog8lib/cx16/syslib.p8:497 romsub $C093 = psg_getatten(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:498 romsub $C096 = psg_getpan(ubyte voice @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:499 romsub $C063 = ym_init() clobbers(A,X,Y) -> bool @Pc ; (re)init YM chip - - ; source: library:/prog8lib/cx16/syslib.p8:500 romsub $C066 = ym_loaddefpatches() clobbers(A,X,Y) -> bool @Pc ; load default YM patches - - ; source: library:/prog8lib/cx16/syslib.p8:501 romsub $C069 = ym_loadpatch(ubyte channel @A, uword patchOrAddress @XY, bool what @Pc) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/syslib.p8:502 romsub $C06C = ym_loadpatchlfn(ubyte channel @A, ubyte lfn @X) clobbers(X,Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:503 romsub $C06F = ym_playdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:504 romsub $C072 = ym_playnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y, bool notrigger @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:505 romsub $C075 = ym_setatten(ubyte channel @A, ubyte attenuation @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:506 romsub $C078 = ym_setdrum(ubyte channel @A, ubyte note @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:507 romsub $C07B = ym_setnote(ubyte channel @A, ubyte kc @X, ubyte kf @Y) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:508 romsub $C07E = ym_setpan(ubyte channel @A, ubyte panning @X) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:509 romsub $C081 = ym_read(ubyte register @X, bool cooked @Pc) clobbers(Y) -> ubyte @A, bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:510 romsub $C084 = ym_release(ubyte channel @A) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:511 romsub $C087 = ym_trigger(ubyte channel @A, bool noRelease @Pc) clobbers(A,X,Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:512 romsub $C08A = ym_write(ubyte value @A, ubyte register @X) clobbers(Y) -> bool @Pc - - ; source: library:/prog8lib/cx16/syslib.p8:513 romsub $C099 = ym_getatten(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:514 romsub $C09C = ym_getpan(ubyte channel @A) clobbers(Y) -> ubyte @X - - ; source: library:/prog8lib/cx16/syslib.p8:515 romsub $C0A5 = ym_get_chip_type() clobbers(X) -> ubyte @A - - ; source: library:/prog8lib/cx16/syslib.p8:518 asmsub set_screen_mode(ubyte mode @A) clobbers(A,X,Y) -> bool @Pc { - -set_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:520 %asm {{ - clc - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:526 asmsub get_screen_mode() -> byte @A, byte @X, byte @Y { - -get_screen_mode .proc - ; source: library:/prog8lib/cx16/syslib.p8:531 %asm {{ - sec - jmp screen_mode - .pend - ; source: library:/prog8lib/cx16/syslib.p8:537 asmsub kbdbuf_clear() { - -kbdbuf_clear .proc - ; source: library:/prog8lib/cx16/syslib.p8:539 %asm {{ -- jsr cbm.GETIN - bne - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:546 asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) { - -mouse_config2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:548 %asm {{ - pha ; save shape - sec - jsr cx16.screen_mode ; set current screen mode and res in A, X, Y - pla ; get shape back - jmp cx16.mouse_config - .pend - ; source: library:/prog8lib/cx16/syslib.p8:557 asmsub mouse_pos() clobbers(X) -> ubyte @A { - -mouse_pos .proc - ; source: library:/prog8lib/cx16/syslib.p8:560 %asm {{ - ldx #cx16.r0 - jmp cx16.mouse_get - .pend - ; source: library:/prog8lib/cx16/syslib.p8:572 inline asmsub rombank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:579 inline asmsub rambank(ubyte bank @A) { - ; source: library:/prog8lib/cx16/syslib.p8:586 inline asmsub getrombank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:593 inline asmsub getrambank() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:600 asmsub numbanks() clobbers(X) -> uword @AY { - -numbanks .proc - ; source: library:/prog8lib/cx16/syslib.p8:607 %asm {{ - sec - jsr cbm.MEMTOP - ldy #0 - cmp #0 - bne + - iny -+ rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:618 asmsub vpeek(ubyte bank @A, uword address @XY) -> ubyte @A { - -vpeek .proc - ; source: library:/prog8lib/cx16/syslib.p8:621 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - sty cx16.VERA_ADDR_M - stx cx16.VERA_ADDR_L - lda cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:631 asmsub vaddr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, byte autoIncrOrDecrByOne @Y) clobbers(A) { - -vaddr .proc - ; source: library:/prog8lib/cx16/syslib.p8:635 %asm {{ - pha - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - pla - cpy #0 - bmi ++ - beq + - ora #%00010000 -+ sta cx16.VERA_ADDR_H - rts -+ ora #%00011000 - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:657 asmsub vaddr_clone(ubyte port @A) clobbers (A,X,Y) { - -vaddr_clone .proc - ; source: library:/prog8lib/cx16/syslib.p8:659 %asm {{ - sta VERA_CTRL - ldx VERA_ADDR_L - ldy VERA_ADDR_H - phy - ldy VERA_ADDR_M - eor #1 - sta VERA_CTRL - stx VERA_ADDR_L - sty VERA_ADDR_M - ply - sty VERA_ADDR_H - eor #1 - sta VERA_CTRL - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:677 asmsub vaddr_autoincr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoIncrAmount @R2) clobbers(A,Y) { - -vaddr_autoincr .proc - ; source: library:/prog8lib/cx16/syslib.p8:681 %asm {{ - jsr _setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr _determine_incr_bits -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - -_setup sta P8ZP_SCRATCH_REG - lda cx16.r1 - and #1 - sta cx16.VERA_CTRL - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - rts - -_determine_incr_bits - lda cx16.r2H - bne _large - lda cx16.r2L - ldy #13 -- cmp _strides_lsb,y - beq + - dey - bpl - -+ tya - asl a - asl a - asl a - asl a - rts -_large ora cx16.r2L - cmp #1 ; 256 - bne + - lda #9<<4 - rts -+ cmp #2 ; 512 - bne + - lda #10<<4 - rts -+ cmp #65 ; 320 - bne + - lda #14<<4 - rts -+ cmp #130 ; 640 - bne + - lda #15<<4 - rts -+ lda #0 - rts -_strides_lsb .byte 0,1,2,4,8,16,32,64,128,255,255,40,80,160,255,255 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:739 asmsub vaddr_autodecr(ubyte bank @A, uword address @R0, ubyte addrsel @R1, uword autoDecrAmount @R2) clobbers(A,Y) { - -vaddr_autodecr .proc - ; source: library:/prog8lib/cx16/syslib.p8:743 %asm {{ - jsr vaddr_autoincr._setup - lda cx16.r2H - ora cx16.r2L - beq + - jsr vaddr_autoincr._determine_incr_bits - ora #%00001000 ; autodecrement -+ ora P8ZP_SCRATCH_REG - sta cx16.VERA_ADDR_H - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:756 asmsub vpoke(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke .proc - ; source: library:/prog8lib/cx16/syslib.p8:759 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - sty cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:771 asmsub vpoke_or(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_or .proc - ; source: library:/prog8lib/cx16/syslib.p8:774 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - ora cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:788 asmsub vpoke_and(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers(A) { - -vpoke_and .proc - ; source: library:/prog8lib/cx16/syslib.p8:791 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - and cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:805 asmsub vpoke_xor(ubyte bank @A, uword address @R0, ubyte value @Y) clobbers (A) { - -vpoke_xor .proc - ; source: library:/prog8lib/cx16/syslib.p8:808 %asm {{ - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - tya - eor cx16.VERA_DATA0 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:822 asmsub vpoke_mask(ubyte bank @A, uword address @R0, ubyte mask @X, ubyte value @Y) clobbers (A) { - -vpoke_mask .proc - ; source: library:/prog8lib/cx16/syslib.p8:825 %asm {{ - sty P8ZP_SCRATCH_B1 - stz cx16.VERA_CTRL - sta cx16.VERA_ADDR_H - lda cx16.r0 - sta cx16.VERA_ADDR_L - lda cx16.r0+1 - sta cx16.VERA_ADDR_M - txa - and cx16.VERA_DATA0 - ora P8ZP_SCRATCH_B1 - sta cx16.VERA_DATA0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:841 asmsub save_virtual_registers() clobbers(A,Y) { - -save_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:842 %asm {{ - ldy #31 -- lda cx16.r0,y - sta _cx16_vreg_storage,y - dey - bpl - - rts - -_cx16_vreg_storage - .word 0,0,0,0,0,0,0,0 - .word 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:856 asmsub restore_virtual_registers() clobbers(A,Y) { - -restore_virtual_registers .proc - ; source: library:/prog8lib/cx16/syslib.p8:857 %asm {{ - ldy #31 -- lda save_virtual_registers._cx16_vreg_storage,y - sta cx16.r0,y - dey - bpl - - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:868 asmsub save_vera_context() clobbers(A) { - -save_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:870 %asm {{ - ; note cannot store this on cpu hardware stack because this gets called as a subroutine - lda cx16.VERA_ADDR_L - sta _vera_storage - lda cx16.VERA_ADDR_M - sta _vera_storage+1 - lda cx16.VERA_ADDR_H - sta _vera_storage+2 - lda cx16.VERA_CTRL - sta _vera_storage+3 - eor #1 - sta _vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.VERA_ADDR_L - sta _vera_storage+4 - lda cx16.VERA_ADDR_M - sta _vera_storage+5 - lda cx16.VERA_ADDR_H - sta _vera_storage+6 - rts -_vera_storage: .byte 0,0,0,0,0,0,0,0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:894 asmsub restore_vera_context() clobbers(A) { - -restore_vera_context .proc - ; source: library:/prog8lib/cx16/syslib.p8:896 %asm {{ - lda cx16.save_vera_context._vera_storage+7 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+6 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+5 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+4 - sta cx16.VERA_ADDR_L - lda cx16.save_vera_context._vera_storage+3 - sta cx16.VERA_CTRL - lda cx16.save_vera_context._vera_storage+2 - sta cx16.VERA_ADDR_H - lda cx16.save_vera_context._vera_storage+1 - sta cx16.VERA_ADDR_M - lda cx16.save_vera_context._vera_storage+0 - sta cx16.VERA_ADDR_L - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:918 asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) { - -set_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:921 %asm {{ - sei - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - lda P8ZP_SCRATCH_REG - sta cx16.edkeybk - stx cx16.edkeyvec - sty cx16.edkeyvec+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:938 asmsub get_chrin_keyhandler() -> ubyte @R0, uword @R1 { - -get_chrin_keyhandler .proc - ; source: library:/prog8lib/cx16/syslib.p8:940 %asm {{ - sei - lda $00 - pha - stz $00 - lda cx16.edkeybk - sta cx16.r0L - lda cx16.edkeyvec - ldy cx16.edkeyvec+1 - sta cx16.r1 - sty cx16.r1+1 - pla - sta $00 - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:961 inline asmsub disable_irqs() clobbers(A) { - ; source: library:/prog8lib/cx16/syslib.p8:969 asmsub enable_irq_handlers(bool disable_all_irq_sources @Pc) clobbers(A,Y) { - -enable_irq_handlers .proc - ; source: library:/prog8lib/cx16/syslib.p8:974 %asm {{ - php - sei - bcc + - lda #%00001111 - trb cx16.VERA_IEN ; disable all IRQ sources -+ lda #<_irq_dispatcher - ldy #>_irq_dispatcher - sta cx16.CINV - sty cx16.CINV+1 - plp - rts - -_irq_dispatcher - ; order of handling: LINE, SPRCOL, AFLOW, VSYNC. - jsr sys.save_prog8_internals - cld - lda cx16.VERA_ISR - and cx16.VERA_IEN ; only consider the bits for sources that can actually raise the IRQ - - bit #2 - beq + -_mod_line_jump - jsr _default_line_handler ; modified - ldy #2 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #4 - beq + -_mod_sprcol_jump - jsr _default_sprcol_handler ; modified - ldy #4 - sty cx16.VERA_ISR - bra _dispatch_end -+ - bit #8 - beq + -_mod_aflow_jump - jsr _default_aflow_handler ; modified - ; note: AFLOW can only be cleared by filling the audio FIFO for at least 1/4. Not via the ISR bit. - bra _dispatch_end -+ - bit #1 - beq + -_mod_vsync_jump - jsr _default_vsync_handler ; modified - cmp #0 - bne _dispatch_end - ldy #1 - sty cx16.VERA_ISR - bra _return_irq -+ - lda #0 -_dispatch_end - cmp #0 - beq _return_irq - jsr sys.restore_prog8_internals - jmp (sys.restore_irq._orig_irqvec) ; continue with normal kernal irq routine -_return_irq - jsr sys.restore_prog8_internals - ply - plx - pla - rti - -_default_vsync_handler - lda #1 - rts -_default_line_handler - lda #0 - rts -_default_sprcol_handler - lda #0 - rts -_default_aflow_handler - lda #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1055 asmsub set_vsync_irq_handler(uword address @AY) clobbers(A) { - -set_vsync_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1058 %asm {{ - php - sei - sta enable_irq_handlers._mod_vsync_jump+1 - sty enable_irq_handlers._mod_vsync_jump+2 - lda #1 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1070 asmsub set_line_irq_handler(uword rasterline @R0, uword address @AY) clobbers(A,Y) { - -set_line_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1074 %asm {{ - php - sei - sta enable_irq_handlers._mod_line_jump+1 - sty enable_irq_handlers._mod_line_jump+2 - lda cx16.r0 - ldy cx16.r0+1 - jsr sys.set_rasterline - lda #2 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1089 asmsub set_sprcol_irq_handler(uword address @AY) clobbers(A) { - -set_sprcol_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1092 %asm {{ - php - sei - sta enable_irq_handlers._mod_sprcol_jump+1 - sty enable_irq_handlers._mod_sprcol_jump+2 - lda #4 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1104 asmsub set_aflow_irq_handler(uword address @AY) clobbers(A) { - -set_aflow_irq_handler .proc - ; source: library:/prog8lib/cx16/syslib.p8:1107 %asm {{ - php - sei - sta enable_irq_handlers._mod_aflow_jump+1 - sty enable_irq_handlers._mod_aflow_jump+2 - lda #8 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1120 inline asmsub disable_irq_handlers() { - ; source: library:/prog8lib/cx16/syslib.p8:1159 asmsub cpu_is_65816() -> bool @A { - -cpu_is_65816 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1161 %asm {{ - php - clv - .byte $e2, $ea ; SEP #$ea, should be interpreted as 2 NOPs by 6502. 65c816 will set the Overflow flag. - bvc + - lda #1 - plp - rts -+ lda #0 - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1187 asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) { - -get_program_args .proc - ; source: library:/prog8lib/cx16/syslib.p8:1191 %asm {{ - lda #0 - rol a - sta P8ZP_SCRATCH_REG - lda $00 - pha - stz $00 - stz P8ZP_SCRATCH_W1 - lda #$bf - sta P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - sta (cx16.r0),y - beq + -_continue iny - cpy cx16.r1L ; max size? - bne - - beq ++ -+ lda P8ZP_SCRATCH_REG ; binary? - bne _continue -+ pla - sta $00 - rts - .pend - .pend - -; ---- block: 'sys' ---- -sys .proc - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - target = $10 - - - ; source: library:/prog8lib/cx16/syslib.p8:1221 const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16. - ; source: library:/prog8lib/cx16/syslib.p8:1218 sys { - ; source: library:/prog8lib/cx16/syslib.p8:1223 asmsub init_system() { - -init_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1226 %asm {{ - sei - lda #0 - tax - tay - jsr cx16.mouse_config ; disable mouse - cld - lda cx16.VERA_DC_VIDEO - and #%00000111 ; retain chroma + output mode - sta P8ZP_SCRATCH_REG - lda #$0a - sta $01 ; rom bank 10 (audio) - jsr cx16.audio_init ; silence - stz $01 ; rom bank 0 (kernal) - jsr cbm.IOINIT - jsr cbm.RESTOR - jsr cbm.CINT - lda cx16.VERA_DC_VIDEO - and #%11111000 - ora P8ZP_SCRATCH_REG - sta cx16.VERA_DC_VIDEO ; restore old output mode - lda #$90 ; black - jsr cbm.CHROUT - lda #1 - jsr cbm.CHROUT ; swap fg/bg - lda #$9e ; yellow - jsr cbm.CHROUT - lda #147 ; clear screen - jsr cbm.CHROUT - lda #8 ; disable charset case switch - jsr cbm.CHROUT - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - lda #0 - tax - tay - clc - clv - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1269 asmsub init_system_phase2() { - -init_system_phase2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1270 %asm {{ - sei - lda cx16.CINV - sta restore_irq._orig_irqvec - lda cx16.CINV+1 - sta restore_irq._orig_irqvec+1 - lda #PROG8_VARSHIGH_RAMBANK - sta $00 ; select ram bank - cli - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1283 asmsub cleanup_at_exit() { - -cleanup_at_exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1285 %asm {{ - lda #1 - sta $00 ; ram bank 1 - lda #4 - sta $01 ; rom bank 4 (basic) - stz $2d ; hack to reset machine code monitor bank to 0 - jsr cbm.CLRCHN ; reset i/o channels -_exitcodeCarry = *+1 - lda #0 - lsr a -_exitcode = *+1 - lda #0 ; exit code possibly modified in exit() -_exitcodeX = *+1 - ldx #0 -_exitcodeY = *+1 - ldy #0 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1305 asmsub set_irq(uword handler @AY) clobbers(A) { - -set_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1307 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda #<_irq_handler - sta cx16.CINV - lda #>_irq_handler - sta cx16.CINV+1 - lda #1 - tsb cx16.VERA_IEN ; enable the vsync irq - cli - rts - -_irq_handler - jsr sys.save_prog8_internals - cld -_modified - jsr $ffff ; modified - pha - jsr sys.restore_prog8_internals - pla - beq + - jmp (restore_irq._orig_irqvec) ; continue with normal kernal irq routine -+ lda #1 - sta cx16.VERA_ISR ; clear Vera Vsync irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1339 asmsub restore_irq() clobbers(A) { - -restore_irq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1340 %asm {{ - sei - lda _orig_irqvec - sta cx16.CINV - lda _orig_irqvec+1 - sta cx16.CINV+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all Vera IRQs but the vsync - ora #%00000001 - sta cx16.VERA_IEN - cli - rts -_orig_irqvec .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1356 asmsub set_rasterirq(uword handler @AY, uword rasterpos @R0) clobbers(A) { - -set_rasterirq .proc - ; source: library:/prog8lib/cx16/syslib.p8:1358 %asm {{ - sei - sta _modified+1 - sty _modified+2 - lda cx16.r0 - ldy cx16.r0+1 - lda cx16.VERA_IEN - and #%11110000 ; disable all irqs but the line(raster) one - ora #%00000010 - sta cx16.VERA_IEN - lda cx16.r0 - ldy cx16.r0+1 - jsr set_rasterline - lda #<_raster_irq_handler - sta cx16.CINV - lda #>_raster_irq_handler - sta cx16.CINV+1 - cli - rts - -_raster_irq_handler - jsr sys.save_prog8_internals - cld -_modified jsr $ffff ; modified - jsr sys.restore_prog8_internals - ; end irq processing - don't use kernal's irq handling - lda #2 - tsb cx16.VERA_ISR ; clear Vera line irq status - ply - plx - pla - rti - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1393 asmsub set_rasterline(uword line @AY) { - -set_rasterline .proc - ; source: library:/prog8lib/cx16/syslib.p8:1394 %asm {{ - php - sei - sta cx16.VERA_IRQLINE_L - tya - lsr a - bcs + - lda #%10000000 - trb cx16.VERA_IEN - plp - rts -+ lda #%10000000 - tsb cx16.VERA_IEN - plp - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1412 asmsub reset_system() { - -reset_system .proc - ; source: library:/prog8lib/cx16/syslib.p8:1415 %asm {{ - sei - ldx #$42 - ldy #2 - lda #0 - jsr cx16.i2c_write_byte - bra * - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1435 asmsub wait(uword jiffies @AY) clobbers(X) { - -wait .proc - ; source: library:/prog8lib/cx16/syslib.p8:1439 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - -_loop lda P8ZP_SCRATCH_W1 - ora P8ZP_SCRATCH_W1+1 - bne + - rts - -+ sei - jsr cbm.RDTIM - cli - sta P8ZP_SCRATCH_B1 -- sei - jsr cbm.RDTIM - cli - cmp P8ZP_SCRATCH_B1 - beq - - - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 - bra _loop - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1466 inline asmsub waitvsync() { - ; source: library:/prog8lib/cx16/syslib.p8:1475 asmsub internal_stringcopy(uword source @R0, uword target @AY) clobbers (A,Y) { - -internal_stringcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1477 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda cx16.r0 - ldy cx16.r0+1 - jmp prog8_lib.strcpy - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1486 asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) { - -memcopy .proc - ; source: library:/prog8lib/cx16/syslib.p8:1492 %asm {{ - cpy #0 - bne _longcopy - - ; copy <= 255 bytes - tay - bne _copyshort - rts ; nothing to copy - -_copyshort - dey - beq + -- lda (cx16.r0),y - sta (cx16.r1),y - dey - bne - -+ lda (cx16.r0),y - sta (cx16.r1),y - rts - -_longcopy - pha ; lsb(count) = remainder in last page - tya - tax ; x = num pages (1+) - ldy #0 -- lda (cx16.r0),y - sta (cx16.r1),y - iny - bne - - inc cx16.r0+1 - inc cx16.r1+1 - dex - bne - - ply - bne _copyshort - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1531 asmsub memset(uword mem @R0, uword numbytes @R1, ubyte value @A) clobbers(A,X,Y) { - -memset .proc - ; source: library:/prog8lib/cx16/syslib.p8:1532 %asm {{ - ldy cx16.r0 - sty P8ZP_SCRATCH_W1 - ldy cx16.r0+1 - sty P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - ldy cx16.r1+1 - jmp prog8_lib.memset - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1543 asmsub memsetw(uword mem @R0, uword numwords @R1, uword value @AY) clobbers (A,X,Y) { - -memsetw .proc - ; source: library:/prog8lib/cx16/syslib.p8:1544 %asm {{ - ldx cx16.r0 - stx P8ZP_SCRATCH_W1 - ldx cx16.r0+1 - stx P8ZP_SCRATCH_W1+1 - ldx cx16.r1 - stx P8ZP_SCRATCH_W2 - ldx cx16.r1+1 - stx P8ZP_SCRATCH_W2+1 - jmp prog8_lib.memsetw - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1557 inline asmsub read_flags() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1564 inline asmsub clear_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1570 inline asmsub set_carry() { - ; source: library:/prog8lib/cx16/syslib.p8:1576 inline asmsub clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1582 inline asmsub set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1588 inline asmsub irqsafe_set_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1595 inline asmsub irqsafe_clear_irqd() { - ; source: library:/prog8lib/cx16/syslib.p8:1601 inline asmsub disable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1608 inline asmsub enable_caseswitch() { - ; source: library:/prog8lib/cx16/syslib.p8:1615 asmsub save_prog8_internals() { - -save_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1616 %asm {{ - lda P8ZP_SCRATCH_B1 - sta save_SCRATCH_ZPB1 - lda P8ZP_SCRATCH_REG - sta save_SCRATCH_ZPREG - lda P8ZP_SCRATCH_W1 - sta save_SCRATCH_ZPWORD1 - lda P8ZP_SCRATCH_W1+1 - sta save_SCRATCH_ZPWORD1+1 - lda P8ZP_SCRATCH_W2 - sta save_SCRATCH_ZPWORD2 - lda P8ZP_SCRATCH_W2+1 - sta save_SCRATCH_ZPWORD2+1 - rts -save_SCRATCH_ZPB1 .byte 0 -save_SCRATCH_ZPREG .byte 0 -save_SCRATCH_ZPWORD1 .word 0 -save_SCRATCH_ZPWORD2 .word 0 - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1637 asmsub restore_prog8_internals() { - -restore_prog8_internals .proc - ; source: library:/prog8lib/cx16/syslib.p8:1638 %asm {{ - lda save_prog8_internals.save_SCRATCH_ZPB1 - sta P8ZP_SCRATCH_B1 - lda save_prog8_internals.save_SCRATCH_ZPREG - sta P8ZP_SCRATCH_REG - lda save_prog8_internals.save_SCRATCH_ZPWORD1 - sta P8ZP_SCRATCH_W1 - lda save_prog8_internals.save_SCRATCH_ZPWORD1+1 - sta P8ZP_SCRATCH_W1+1 - lda save_prog8_internals.save_SCRATCH_ZPWORD2 - sta P8ZP_SCRATCH_W2 - lda save_prog8_internals.save_SCRATCH_ZPWORD2+1 - sta P8ZP_SCRATCH_W2+1 - rts - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1655 asmsub exit(ubyte returnvalue @A) { - -exit .proc - ; source: library:/prog8lib/cx16/syslib.p8:1657 %asm {{ - sta cleanup_at_exit._exitcode - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1665 asmsub exit2(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) { - -exit2 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1667 %asm {{ - sta cleanup_at_exit._exitcode - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1677 asmsub exit3(ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) { - -exit3 .proc - ; source: library:/prog8lib/cx16/syslib.p8:1679 %asm {{ - sta cleanup_at_exit._exitcode - lda #0 - rol a - sta cleanup_at_exit._exitcodeCarry - stx cleanup_at_exit._exitcodeX - sty cleanup_at_exit._exitcodeY - ldx prog8_lib.orig_stackpointer - txs - jmp cleanup_at_exit - .pend - ; source: library:/prog8lib/cx16/syslib.p8:1692 inline asmsub progend() -> uword @AY { - ; source: library:/prog8lib/cx16/syslib.p8:1699 inline asmsub push(ubyte value @A) { - ; source: library:/prog8lib/cx16/syslib.p8:1705 inline asmsub pushw(uword value @AY) { - ; source: library:/prog8lib/cx16/syslib.p8:1712 inline asmsub pop() -> ubyte @A { - ; source: library:/prog8lib/cx16/syslib.p8:1718 inline asmsub popw() -> uword @AY { - .pend - -; ---- block: 'conv' ---- -conv .proc - ; source: library:/prog8lib/conv.p8:3 conv { - -; non-zeropage variables -string_out ; PETSCII:"????????????????" - .byte $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f, $3f - .byte $00 - - ; source: library:/prog8lib/conv.p8:9 str @shared string_out = "????????????????" ; result buffer for the string conversion routines - ; source: library:/prog8lib/conv.p8:5 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/conv.p8:11 asmsub str_ub0 (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub0 .proc - ; source: library:/prog8lib/conv.p8:13 %asm {{ - jsr conv.ubyte2decimal - sty string_out - sta string_out+1 - stx string_out+2 - lda #0 - sta string_out+3 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:26 asmsub str_ub (ubyte value @ A) clobbers(X) -> str @AY { - -str_ub .proc - ; source: library:/prog8lib/conv.p8:28 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - jsr conv.ubyte2decimal -_output_byte_digits - ; hundreds? - cpy #'0' - beq + - pha - tya - ldy P8ZP_SCRATCH_B1 - sta string_out,y - pla - inc P8ZP_SCRATCH_B1 - ; tens? -+ ldy P8ZP_SCRATCH_B1 - cmp #'0' - beq + - sta string_out,y - iny -+ ; ones. - txa - sta string_out,y - iny - lda #0 - sta string_out,y - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:60 asmsub str_b (byte value @ A) clobbers(X) -> str @AY { - -str_b .proc - ; source: library:/prog8lib/conv.p8:62 %asm {{ - ldy #0 - sty P8ZP_SCRATCH_B1 - cmp #0 - bpl + - pha - lda #'-' - sta string_out - inc P8ZP_SCRATCH_B1 - pla -+ jsr conv.byte2decimal - bra str_ub._output_byte_digits - .pend - ; source: library:/prog8lib/conv.p8:77 asmsub str_ubhex (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubhex .proc - ; source: library:/prog8lib/conv.p8:79 %asm {{ - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - lda #0 - sta string_out+2 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:91 asmsub str_ubbin (ubyte value @ A) clobbers(X) -> str @AY { - -str_ubbin .proc - ; source: library:/prog8lib/conv.p8:93 %asm {{ - sta P8ZP_SCRATCH_B1 - ldy #0 - sty string_out+8 - ldy #7 -- lsr P8ZP_SCRATCH_B1 - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:112 asmsub str_uwbin (uword value @ AY) clobbers(X) -> str @AY { - -str_uwbin .proc - ; source: library:/prog8lib/conv.p8:114 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr str_ubbin - ldy #0 - sty string_out+16 - ldy #7 -- lsr P8ZP_SCRATCH_REG - bcc + - lda #'1' - bne _digit -+ lda #'0' -_digit sta string_out+8,y - dey - bpl - - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:135 asmsub str_uwhex (uword value @ AY) -> str @AY { - -str_uwhex .proc - ; source: library:/prog8lib/conv.p8:137 %asm {{ - pha - tya - jsr conv.ubyte2hex - sta string_out - sty string_out+1 - pla - jsr conv.ubyte2hex - sta string_out+2 - sty string_out+3 - lda #0 - sta string_out+4 - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:155 asmsub str_uw0 (uword value @ AY) clobbers(X) -> str @AY { - -str_uw0 .proc - ; source: library:/prog8lib/conv.p8:157 %asm {{ - jsr conv.uword2decimal - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - sta string_out,y - beq + - iny - bne - -+ - lda #string_out - rts - .pend - ; source: library:/prog8lib/conv.p8:172 asmsub str_uw (uword value @ AY) clobbers(X) -> str @AY { - -str_uw .proc - ; source: library:/prog8lib/conv.p8:174 %asm {{ - jsr conv.uword2decimal - ldx #0 -_output_digits - ldy #0 -- lda conv.uword2decimal.decTenThousands,y - beq _allzero - cmp #'0' - bne _gotdigit - iny - bne - -_gotdigit sta string_out,x - inx - iny - lda conv.uword2decimal.decTenThousands,y - bne _gotdigit -_end lda #0 - sta string_out,x - lda #string_out - rts - -_allzero lda #'0' - sta string_out,x - inx - bne _end - .pend - ; source: library:/prog8lib/conv.p8:203 asmsub str_w (word value @ AY) clobbers(X) -> str @AY { - -str_w .proc - ; source: library:/prog8lib/conv.p8:205 %asm {{ - cpy #0 - bpl str_uw - pha - lda #'-' - sta string_out - tya - eor #255 - tay - pla - eor #255 - clc - adc #1 - bcc + - iny -+ jsr conv.uword2decimal - ldx #1 - bne str_uw._output_digits - rts - .pend - ; source: library:/prog8lib/conv.p8:230 asmsub any2uword(str string @AY) clobbers(Y) -> ubyte @A { - -any2uword .proc - ; source: library:/prog8lib/conv.p8:236 %asm {{ - pha - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - ldy P8ZP_SCRATCH_W1+1 - cmp #'$' - beq _hex - cmp #'%' - beq _bin - pla - jsr str2uword - jmp _result -_hex pla - jsr hex2uword - jmp _result -_bin pla - jsr bin2uword -_result - pha - lda cx16.r15 - sta P8ZP_SCRATCH_B1 ; result value - pla - sta cx16.r15 - sty cx16.r15+1 - lda P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/conv.p8:267 inline asmsub str2ubyte(str string @AY) clobbers(Y) -> ubyte @A { - ; source: library:/prog8lib/conv.p8:277 inline asmsub str2byte(str string @AY) clobbers(Y) -> byte @A { - ; source: library:/prog8lib/conv.p8:287 asmsub str2uword(str string @AY) -> uword @AY { - -str2uword .proc - ; source: library:/prog8lib/conv.p8:292 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty cx16.r15+1 -_loop - lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr _result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _loop - ; never reached - -_result_times_10 ; (W*4 + W)*2 - lda _result+1 - sta P8ZP_SCRATCH_REG - lda _result - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - clc - adc _result - sta _result - lda P8ZP_SCRATCH_REG - adc _result+1 - asl _result - rol a - sta _result+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:346 asmsub str2word(str string @AY) -> word @AY { - -str2word .proc - ; source: library:/prog8lib/conv.p8:351 %asm {{ -_result = P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty _result - sty _result+1 - sty _negative - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - cmp #'+' - bne + - iny -+ cmp #'-' - bne _parse - inc _negative - iny -_parse lda (P8ZP_SCRATCH_W2),y - sec - sbc #48 - bpl _digit -_done - sty cx16.r15 - lda _negative - beq + - sec - lda #0 - sbc _result - sta _result - lda #0 - sbc _result+1 - sta _result+1 -+ lda _result - ldy _result+1 - rts -_digit - cmp #10 - bcs _done - ; add digit to result - pha - jsr str2uword._result_times_10 - pla - clc - adc _result - sta _result - bcc + - inc _result+1 -+ iny - bne _parse - ; never reached -_negative .byte 0 - .pend - ; source: library:/prog8lib/conv.p8:405 asmsub hex2uword(str string @AY) -> uword @AY { - -hex2uword .proc - ; source: library:/prog8lib/conv.p8:410 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'$' - bne _loop - iny -_loop - lda #0 - sta P8ZP_SCRATCH_B1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #7 ; screencode letters A-F are 1-6 - bcc _add_letter - and #127 - cmp #97 - bcs _try_iso ; maybe letter is iso:'a'-iso:'f' (97-102) - cmp #'g' - bcs _stop - cmp #'a' - bcs _add_letter - cmp #'0' - bcc _stop - cmp #'9'+1 - bcs _stop -_calc - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #$0f - clc - adc P8ZP_SCRATCH_B1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts -_add_letter - pha - lda #9 - sta P8ZP_SCRATCH_B1 - pla - jmp _calc -_try_iso - cmp #103 - bcs _stop - and #63 - bne _add_letter - .pend - ; source: library:/prog8lib/conv.p8:475 asmsub bin2uword(str string @AY) -> uword @AY { - -bin2uword .proc - ; source: library:/prog8lib/conv.p8:479 %asm {{ - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - sty P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sty cx16.r15+1 - lda (P8ZP_SCRATCH_W2),y - beq _stop - cmp #'%' - bne _loop - iny -_loop - lda (P8ZP_SCRATCH_W2),y - cmp #'0' - bcc _stop - cmp #'2' - bcs _stop -_first asl P8ZP_SCRATCH_W1 - rol P8ZP_SCRATCH_W1+1 - and #1 - ora P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - iny - bne _loop -_stop - sty cx16.r15 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/conv.p8:515 asmsub ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -ubyte2decimal .proc - ; source: library:/prog8lib/conv.p8:517 %asm {{ - ldy #uword2decimal.ASCII_0_OFFSET - jmp uword2decimal.hex_try200 - .pend - ; source: library:/prog8lib/conv.p8:523 asmsub uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X { - -uword2decimal .proc - ; source: library:/prog8lib/conv.p8:529 %asm {{ -;Convert 16 bit Hex to Decimal (0-65535) Rev 2 -;By Omegamatrix Further optimizations by tepples -; routine from https://forums.nesdev.org/viewtopic.php?p=130363&sid=1944ba8bac4d6afa9c02e3cc42304e6b#p130363 - -;HexToDec99 -; start in A -; end with A = 10's, decOnes (also in X) - -;HexToDec255 -; start in A -; end with Y = 100's, A = 10's, decOnes (also in X) - -;HexToDec999 -; start with A = high byte, Y = low byte -; end with Y = 100's, A = 10's, decOnes (also in X) -; requires 1 extra temp register on top of decOnes, could combine -; these two if HexToDec65535 was eliminated... - -;HexToDec65535 -; start with A/Y (low/high) as 16 bit value -; end with decTenThousand, decThousand, Y = 100's, A = 10's, decOnes (also in X) -; (irmen: I store Y and A in decHundreds and decTens too, so all of it can be easily printed) - - -ASCII_0_OFFSET = $30 -temp = P8ZP_SCRATCH_B1 ; byte in zeropage -hexHigh = P8ZP_SCRATCH_W1 ; byte in zeropage -hexLow = P8ZP_SCRATCH_W1+1 ; byte in zeropage - - -HexToDec65535; SUBROUTINE - sty hexHigh ;3 @9 - sta hexLow ;3 @12 - tya - tax ;2 @14 - lsr a ;2 @16 - lsr a ;2 @18 integer divide 1024 (result 0-63) - - cpx #$A7 ;2 @20 account for overflow of multiplying 24 from 43,000 ($A7F8) onward, - adc #1 ;2 @22 we can just round it to $A700, and the divide by 1024 is fine... - - ;at this point we have a number 1-65 that we have to times by 24, - ;add to original sum, and Mod 1024 to get a remainder 0-999 - - - sta temp ;3 @25 - asl a ;2 @27 - adc temp ;3 @30 x3 - tay ;2 @32 - lsr a ;2 @34 - lsr a ;2 @36 - lsr a ;2 @38 - lsr a ;2 @40 - lsr a ;2 @42 - tax ;2 @44 - tya ;2 @46 - asl a ;2 @48 - asl a ;2 @50 - asl a ;2 @52 - clc ;2 @54 - adc hexLow ;3 @57 - sta hexLow ;3 @60 - txa ;2 @62 - adc hexHigh ;3 @65 - sta hexHigh ;3 @68 - ror a ;2 @70 - lsr a ;2 @72 - tay ;2 @74 integer divide 1,000 (result 0-65) - - lsr a ;2 @76 split the 1,000 and 10,000 digit - tax ;2 @78 - lda ShiftedBcdTab,x ;4 @82 - tax ;2 @84 - rol a ;2 @86 - and #$0F ;2 @88 - ora #ASCII_0_OFFSET - sta decThousands ;3 @91 - txa ;2 @93 - lsr a ;2 @95 - lsr a ;2 @97 - lsr a ;2 @99 - ora #ASCII_0_OFFSET - sta decTenThousands ;3 @102 - - lda hexLow ;3 @105 - cpy temp ;3 @108 - bmi _doSubtract ;2³ @110/111 - beq _useZero ;2³ @112/113 - adc #23 + 24 ;2 @114 -_doSubtract - sbc #23 ;2 @116 - sta hexLow ;3 @119 -_useZero - lda hexHigh ;3 @122 - sbc #0 ;2 @124 - -Start100s - and #$03 ;2 @126 - tax ;2 @128 0,1,2,3 - cmp #2 ;2 @130 - rol a ;2 @132 0,2,5,7 - ora #ASCII_0_OFFSET - tay ;2 @134 Y = Hundreds digit - - lda hexLow ;3 @137 - adc Mod100Tab,x ;4 @141 adding remainder of 256, 512, and 256+512 (all mod 100) - bcs hex_doSub200 ;2³ @143/144 - -hex_try200 - cmp #200 ;2 @145 - bcc hex_try100 ;2³ @147/148 -hex_doSub200 - iny ;2 @149 - iny ;2 @151 - sbc #200 ;2 @153 -hex_try100 - cmp #100 ;2 @155 - bcc HexToDec99 ;2³ @157/158 - iny ;2 @159 - sbc #100 ;2 @161 - -HexToDec99; SUBROUTINE - lsr a ;2 @163 - tax ;2 @165 - lda ShiftedBcdTab,x ;4 @169 - tax ;2 @171 - rol a ;2 @173 - and #$0F ;2 @175 - ora #ASCII_0_OFFSET - sta decOnes ;3 @178 - txa ;2 @180 - lsr a ;2 @182 - lsr a ;2 @184 - lsr a ;2 @186 - ora #ASCII_0_OFFSET - - ; irmen: load X with ones, and store Y and A too, for easy printing afterwards - sty decHundreds - sta decTens - ldx decOnes - rts ;6 @192 Y=hundreds, A = tens digit, X=ones digit - - -HexToDec999; SUBROUTINE - sty hexLow ;3 @9 - jmp Start100s ;3 @12 - -Mod100Tab - .byte 0,56,12,56+12 - -ShiftedBcdTab - .byte $00,$01,$02,$03,$04,$08,$09,$0A,$0B,$0C - .byte $10,$11,$12,$13,$14,$18,$19,$1A,$1B,$1C - .byte $20,$21,$22,$23,$24,$28,$29,$2A,$2B,$2C - .byte $30,$31,$32,$33,$34,$38,$39,$3A,$3B,$3C - .byte $40,$41,$42,$43,$44,$48,$49,$4A,$4B,$4C - -decTenThousands .byte 0 -decThousands .byte 0 -decHundreds .byte 0 -decTens .byte 0 -decOnes .byte 0 - .byte 0 ; zero-terminate the decimal output string - .pend - ; source: library:/prog8lib/conv.p8:698 asmsub byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X { - -byte2decimal .proc - ; source: library:/prog8lib/conv.p8:701 %asm {{ - cmp #0 - bpl + - eor #255 - clc - adc #1 -+ jmp ubyte2decimal - .pend - ; source: library:/prog8lib/conv.p8:711 asmsub ubyte2hex (ubyte value @A) clobbers(X) -> ubyte @A, ubyte @Y { - -ubyte2hex .proc - ; source: library:/prog8lib/conv.p8:713 %asm {{ - pha - and #$0f - tax - ldy _hex_digits,x - pla - lsr a - lsr a - lsr a - lsr a - tax - lda _hex_digits,x - rts - -_hex_digits .text "0123456789abcdef" ; can probably be reused for other stuff as well - .pend - ; source: library:/prog8lib/conv.p8:731 asmsub uword2hex (uword value @AY) clobbers(A,Y) { - -uword2hex .proc - ; source: library:/prog8lib/conv.p8:733 %asm {{ - sta P8ZP_SCRATCH_REG - tya - jsr ubyte2hex - sta output - sty output+1 - lda P8ZP_SCRATCH_REG - jsr ubyte2hex - sta output+2 - sty output+3 - rts -output .text "0000", $00 ; 0-terminated output buffer (to make printing easier) - .pend - .pend - -; ---- block: 'floats' ---- -floats .proc - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - AYINT_facmo = $c6 - PI = 3.141592653589793 - TWOPI = 6.283185307179586 - π = 3.141592653589793 - - AYINT = $fe00 - GIVAYF = $fe03 - FOUT = $fe06 - VAL_1 = $fe09 - GETADR = $fe0c - FLOATC = $fe0f - FSUB = $fe12 - FSUBT = $fe15 - FADD = $fe18 - FADDT = $fe1b - FMULT = $fe1e - FMULTT = $fe21 - FDIV = $fe24 - FDIVT = $fe27 - LOG = $fe2a - INT = $fe2d - SQR = $fe30 - NEGOP = $fe33 - FPWR = $fe36 - FPWRT = $fe39 - EXP = $fe3c - COS = $fe3f - SIN = $fe42 - TAN = $fe45 - ATN = $fe48 - ROUND = $fe4b - ABS = $fe4e - SIGN = $fe51 - FCOMP = $fe54 - RND_0 = $fe57 - RND = $fe57 - CONUPK = $fe5a - ROMUPK = $fe5d - MOVFRM = $fe60 - MOVFM = $fe63 - MOVMF = $fe66 - MOVFA = $fe69 - MOVAF = $fe6c - FADDH = $fe6f - ZEROFC = $fe72 - NORMAL = $fe75 - NEGFAC = $fe78 - MUL10 = $fe7b - DIV10 = $fe7e - MOVEF = $fe81 - SGN = $fe84 - FLOAT = $fe87 - FLOATS = $fe8a - QINT = $fe8d - FINLOG = $fe90 - - ; source: library:/prog8lib/cx16/floats.p8:9 const float π = 3.141592653589793 - ; source: library:/prog8lib/cx16/floats.p8:10 const float PI = π - ; source: library:/prog8lib/cx16/floats.p8:11 const float TWOPI = 2*π - ; source: library:/prog8lib/cx16/floats.p8:176 &uword AYINT_facmo = $c6 ; $c6/$c7 contain result of AYINT - ; source: library:/prog8lib/cx16/floats.p8:6 floats { - ; source: library:/prog8lib/shared_floats_functions.p8:1 floats { - ; source: library:/prog8lib/cx16/floats.p8:22 romsub $fe00 = AYINT() clobbers(A,X,Y) ; fac1-> signed word in 100-101 ($64-$65) MSB FIRST. (might throw ILLEGAL QUANTITY) - - ; source: library:/prog8lib/cx16/floats.p8:27 romsub $fe03 = GIVAYF(ubyte lo @ Y, ubyte hi @ A) clobbers(A,X,Y) - - ; source: library:/prog8lib/cx16/floats.p8:29 romsub $fe06 = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, address returned in AY - - ; source: library:/prog8lib/cx16/floats.p8:30 romsub $fe09 = VAL_1(uword string @XY, ubyte length @A) clobbers(A,X,Y) -> float @FAC1 ; convert ASCII string in XY and length in A, to floating point in FAC1. WARNING: only implemented in ROM 47+. Safer to use floats.parse() instead. - - ; source: library:/prog8lib/cx16/floats.p8:34 romsub $fe0c = GETADR() clobbers(X) -> ubyte @ Y, ubyte @ A - - ; source: library:/prog8lib/cx16/floats.p8:35 romsub $fe0f = FLOATC() clobbers(A,X,Y) ; convert address to floating point - - ; source: library:/prog8lib/cx16/floats.p8:37 romsub $fe12 = FSUB(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt from A/Y - fac1 - - ; source: library:/prog8lib/cx16/floats.p8:38 romsub $fe15 = FSUBT() clobbers(A,X,Y) ; fac1 = fac2-fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:39 romsub $fe18 = FADD(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 += mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:40 romsub $fe1b = FADDT() clobbers(A,X,Y) ; fac1 += fac2 - - ; source: library:/prog8lib/cx16/floats.p8:41 romsub $fe1e = FMULT(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 *= mflpt value from A/Y - - ; source: library:/prog8lib/cx16/floats.p8:42 romsub $fe21 = FMULTT() clobbers(A,X,Y) ; fac1 *= fac2 - - ; source: library:/prog8lib/cx16/floats.p8:43 romsub $fe24 = FDIV(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = mflpt in A/Y / fac1 - - ; source: library:/prog8lib/cx16/floats.p8:44 romsub $fe27 = FDIVT() clobbers(A,X,Y) ; fac1 = fac2/fac1 mind the order of the operands - - ; source: library:/prog8lib/cx16/floats.p8:45 romsub $fe2a = LOG() clobbers(A,X,Y) ; fac1 = LN(fac1) (natural log) - - ; source: library:/prog8lib/cx16/floats.p8:46 romsub $fe2d = INT() clobbers(A,X,Y) ; INT() truncates, use ROUND or FADDH first to round instead of trunc - - ; source: library:/prog8lib/cx16/floats.p8:47 romsub $fe30 = SQR() clobbers(A,X,Y) ; fac1 = SQRT(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:48 romsub $fe33 = NEGOP() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) - - ; source: library:/prog8lib/cx16/floats.p8:49 romsub $fe36 = FPWR(uword mflpt @ AY) clobbers(A,X,Y) ; fac1 = fac2 ** float in A/Y - - ; source: library:/prog8lib/cx16/floats.p8:50 romsub $fe39 = FPWRT() clobbers(A,X,Y) ; fac1 = fac2 ** fac1 - - ; source: library:/prog8lib/cx16/floats.p8:51 romsub $fe3c = EXP() clobbers(A,X,Y) ; fac1 = EXP(fac1) (e ** fac1) - - ; source: library:/prog8lib/cx16/floats.p8:52 romsub $fe3f = COS() clobbers(A,X,Y) ; fac1 = COS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:53 romsub $fe42 = SIN() clobbers(A,X,Y) ; fac1 = SIN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:54 romsub $fe45 = TAN() clobbers(A,X,Y) ; fac1 = TAN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:55 romsub $fe48 = ATN() clobbers(A,X,Y) ; fac1 = ATN(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:56 romsub $fe4b = ROUND() clobbers(A,X,Y) ; round fac1 - - ; source: library:/prog8lib/cx16/floats.p8:57 romsub $fe4e = ABS() clobbers(A,X,Y) ; fac1 = ABS(fac1) - - ; source: library:/prog8lib/cx16/floats.p8:58 romsub $fe51 = SIGN() clobbers(X,Y) -> ubyte @ A ; SIGN(fac1) to A, $ff, $0, $1 for negative, zero, positive - - ; source: library:/prog8lib/cx16/floats.p8:59 romsub $fe54 = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than - - ; source: library:/prog8lib/cx16/floats.p8:60 romsub $fe57 = RND_0() clobbers(A,X,Y) ; fac1 = RND(fac1) float random number generator NOTE: incompatible with C64's RND routine - - ; source: library:/prog8lib/cx16/floats.p8:61 romsub $fe57 = RND() clobbers(A,X,Y) ; alias for RND_0 - - ; source: library:/prog8lib/cx16/floats.p8:62 romsub $fe5a = CONUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:63 romsub $fe5d = ROMUPK(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in current bank in A/Y into fac2 - - ; source: library:/prog8lib/cx16/floats.p8:64 romsub $fe60 = MOVFRM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 (use MOVFM instead) - - ; source: library:/prog8lib/cx16/floats.p8:65 romsub $fe63 = MOVFM(uword mflpt @ AY) clobbers(A,X,Y) ; load mflpt value from memory in A/Y into fac1 - - ; source: library:/prog8lib/cx16/floats.p8:66 romsub $fe66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memory X/Y as 5-byte mflpt - - ; source: library:/prog8lib/cx16/floats.p8:67 romsub $fe69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 - - ; source: library:/prog8lib/cx16/floats.p8:68 romsub $fe6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) - - ; source: library:/prog8lib/cx16/floats.p8:71 romsub $fe6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT - - ; source: library:/prog8lib/cx16/floats.p8:72 romsub $fe72 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 - - ; source: library:/prog8lib/cx16/floats.p8:73 romsub $fe75 = NORMAL() clobbers(A,X,Y) ; normalize fac1 - - ; source: library:/prog8lib/cx16/floats.p8:74 romsub $fe78 = NEGFAC() clobbers(A) ; switch the sign of fac1 (fac1 = -fac1) (doesn't work, juse use NEGOP() instead!) - - ; source: library:/prog8lib/cx16/floats.p8:75 romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 - - ; source: library:/prog8lib/cx16/floats.p8:76 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! Have to restore sign manually! - - ; source: library:/prog8lib/cx16/floats.p8:77 romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 - - ; source: library:/prog8lib/cx16/floats.p8:78 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) - - ; source: library:/prog8lib/cx16/floats.p8:79 romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A - - ; source: library:/prog8lib/cx16/floats.p8:80 romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho - - ; source: library:/prog8lib/cx16/floats.p8:81 romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) - - ; source: library:/prog8lib/cx16/floats.p8:82 romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A - - ; source: library:/prog8lib/cx16/floats.p8:86 asmsub FREADSA (byte value @A) clobbers(A,X,Y) { - -FREADSA .proc - ; source: library:/prog8lib/cx16/floats.p8:88 %asm {{ - tay - bpl + - lda #$ff - jmp GIVAYF -+ lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:98 asmsub GIVUAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVUAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:100 %asm {{ - sty $c4 ; facmo ($64 on c128) - sta $c5 ; facmo+1 ($65 on c128) - ldx #$90 - sec - jmp FLOATC - .pend - ; source: library:/prog8lib/cx16/floats.p8:109 asmsub GIVAYFAY (uword value @ AY) clobbers(A,X,Y) { - -GIVAYFAY .proc - ; source: library:/prog8lib/cx16/floats.p8:111 %asm {{ - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - jmp GIVAYF ; this uses the inverse order, Y/A - .pend - ; source: library:/prog8lib/cx16/floats.p8:119 asmsub GETADRAY () clobbers(X) -> uword @ AY { - -GETADRAY .proc - ; source: library:/prog8lib/cx16/floats.p8:121 %asm {{ - jsr GETADR ; this uses the inverse order, Y/A - sta P8ZP_SCRATCH_B1 - tya - ldy P8ZP_SCRATCH_B1 - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:130 asmsub FREADUY (ubyte value @Y) { - -FREADUY .proc - ; source: library:/prog8lib/cx16/floats.p8:132 %asm {{ - lda #0 - jmp GIVAYF - .pend - ; source: library:/prog8lib/cx16/floats.p8:138 asmsub parse(str value @AY) -> float @FAC1 { - -parse .proc - ; source: library:/prog8lib/cx16/floats.p8:143 %asm {{ - ldx VAL_1 - cpx #$4c ; is there an implementation in VAL_1? (test for JMP) - bne + ; no, do it ourselves - pha ; yes, count the length and call rom VAL_1. - phy - jsr prog8_lib.strlen - tya - ply - plx - jmp VAL_1 -+ sta $a9 ; 'index' variable - sty $aa - jsr prog8_lib.strlen - lda $deb6 - cmp #$d0 ; sanity check for kernal routine correct - bne + - tya - jmp $deb6 ; kernal version dependent... -+ ; print error message if routine is borked in kernal, and exit program - ldy #0 -- lda _msg,y - beq + - jsr cbm.CHROUT - iny - bne - -+ jmp sys.exit - -_msg .text 13,"?val kaputt",13,0 - .pend - ; source: library:/prog8lib/cx16/floats.p8:185 asmsub normalize(float value @FAC1) -> float @ FAC1 { - -normalize .proc - ; source: library:/prog8lib/cx16/floats.p8:186 %asm {{ - jmp floats.NORMAL - .pend - ; source: library:/prog8lib/cx16/floats.p8:191 %asminclude "library:c64/floats.asm" -; --- low level floating point assembly routines for the C64 - -FL_ONE_const .byte 129 ; 1.0 -FL_ZERO_const .byte 0,0,0,0,0 ; 0.0 -FL_LOG2_const .byte $80, $31, $72, $17, $f8 ; log(2) - - -floats_temp_var .byte 0,0,0,0,0 ; temporary storage for a float - -ub2float .proc - ; -- convert ubyte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_B1 - lda #0 - jsr GIVAYF -_fac_to_mem ldx P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jmp MOVMF - .pend - -b2float .proc - ; -- convert byte in SCRATCH_ZPB1 to float at address A/Y - ; clobbers A, X, Y - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_B1 - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -uw2float .proc - ; -- convert uword in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - -w2float .proc - ; -- convert word in SCRATCH_ZPWORD1 to float at address A/Y - ; clobbers X - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - jsr GIVAYF - jmp ub2float._fac_to_mem - .pend - - -cast_from_uw .proc - ; -- uword in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVUAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_w .proc - ; -- word in A/Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr GIVAYFAY - jmp ub2float._fac_to_mem - .pend - - -cast_from_ub .proc - ; -- ubyte in Y into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADUY - jmp ub2float._fac_to_mem - .pend - - -cast_from_b .proc - ; -- byte in A into float var at (P8ZP_SCRATCH_W2) - ; clobbers X - jsr FREADSA - jmp ub2float._fac_to_mem - .pend - -cast_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast float at A/Y to uword into Y/A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_uw_into_ya - .pend - -cast_as_w_into_ay .proc ; also used for float 2 b - ; -- cast float at A/Y to word into A/Y - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_w_into_ay - .pend - -cast_as_bool_into_a .proc - ; -- cast float at A/Y to bool into A - ; clobbers X - jsr MOVFM - jmp cast_FAC1_as_bool_into_a - .pend - -cast_FAC1_as_bool_into_a .proc - ; -- cast fac1 to bool into A - ; clobbers X - jsr SIGN - and #1 - rts - .pend - -cast_FAC1_as_uw_into_ya .proc ; also used for float 2 ub - ; -- cast fac1 to uword into Y/A - ; clobbers X - jmp GETADR ; into Y/A - .pend - -cast_FAC1_as_w_into_ay .proc ; also used for float 2 b - ; -- cast fac1 to word into A/Y - ; clobbers X - jsr AYINT - ldy floats.AYINT_facmo - lda floats.AYINT_facmo+1 - rts - .pend - - -copy_float .proc - ; -- copies the 5 bytes of the mflt value pointed to by P8ZP_SCRATCH_W1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - iny - lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts - .pend - -inc_var_f .proc - ; -- add 1 to float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - jsr MOVFM - lda #FL_ONE_const - jsr FADD - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - -dec_var_f .proc - ; -- subtract 1 from float pointed to by A/Y - ; clobbers X - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #FL_ONE_const - jsr MOVFM - lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jsr FSUB - ldx P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - jmp MOVMF - .pend - - -fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value -fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value - - -var_fac1_less_f .proc - ; -- is the float in FAC1 < the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_lesseq_f .proc - ; -- is the float in FAC1 <= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #255 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greater_f .proc - ; -- is the float in FAC1 > the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_greatereq_f .proc - ; -- is the float in FAC1 >= the variable AY? Result in A. Clobbers X. - jsr FCOMP - cmp #0 - beq + - cmp #1 - beq + - lda #0 - rts -+ lda #1 - rts - .pend - -var_fac1_equal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - eor #1 - rts - .pend - -var_fac1_notequal_f .proc - ; -- are the floats numbers in FAC1 and the variable AY *not* identical? Result in A. Clobbers X. - jsr FCOMP - and #1 - rts - .pend - -vars_equal_f .proc - ; -- are the mflpt5 numbers in P8ZP_SCRATCH_W1 and AY identical? Result in A - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - iny - lda (P8ZP_SCRATCH_W1),y - cmp (P8ZP_SCRATCH_W2),y - bne _false - lda #1 - rts -_false lda #0 - rts - .pend - - -vars_less_f .proc - ; -- is float in AY < float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + - lda #1 - rts -+ lda #0 - rts - .pend - -vars_lesseq_f .proc - ; -- is float in AY <= float in P8ZP_SCRATCH_W2 ? Result in A. Clobbers X. - jsr MOVFM - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - jsr FCOMP - cmp #255 - bne + -- lda #1 - rts -+ cmp #0 - beq - - lda #0 - rts - .pend - -less_f .proc - ; -- is f1 < f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - - -lesseq_f .proc - ; -- is f1 <= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #255 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greater_f .proc - ; -- is f1 > f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -greatereq_f .proc - ; -- is f1 >= f2? Result in A. Clobbers X. - jsr compare_floats - cmp #1 - beq compare_floats._return_true - cmp #0 - beq compare_floats._return_true - bne compare_floats._return_false - .pend - -set_array_float_from_fac1 .proc - ; -- set the float in FAC1 in the array (index in A, array in P8ZP_SCRATCH_W1) - ; clobbers X - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - ldy P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W1 - bcc + - iny -+ tax - jmp MOVMF - .pend - - -set_0_array_float .proc - ; -- set a float in an array to zero (index in A, array in P8ZP_SCRATCH_W1) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - tay - lda #0 - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - iny - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -set_array_float .proc - ; -- set a float in an array to a value (index in A, float in P8ZP_SCRATCH_W1, array in P8ZP_SCRATCH_W2) - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - bcc + - iny -+ jmp copy_float - ; -- copies the 5 bytes of the mflt value pointed to by SCRATCH_ZPWORD1, - ; into the 5 bytes pointed to by A/Y. Clobbers A,Y. - .pend - - -pushFAC1 .proc - ;-- push floating point in FAC onto the cpu stack - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - ldx #floats.floats_temp_var - jsr floats.MOVMF - lda floats.floats_temp_var - pha - lda floats.floats_temp_var+1 - pha - lda floats.floats_temp_var+2 - pha - lda floats.floats_temp_var+3 - pha - lda floats.floats_temp_var+4 - pha - ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - -popFAC .proc - ; -- pop floating point value from cpu stack into FAC1 or FAC2 ( - ; carry flag clear=FAC1, carry set=FAC2 - ; save return address - pla - sta P8ZP_SCRATCH_W2 - pla - sta P8ZP_SCRATCH_W2+1 - pla - sta floats.floats_temp_var+4 - pla - sta floats.floats_temp_var+3 - pla - sta floats.floats_temp_var+2 - pla - sta floats.floats_temp_var+1 - pla - sta floats.floats_temp_var - lda #floats.floats_temp_var - bcs + - jsr floats.MOVFM - jmp ++ -+ jsr floats.CONUPK -+ ; re-push return address - lda P8ZP_SCRATCH_W2+1 - pha - lda P8ZP_SCRATCH_W2 - pha - rts - .pend - ; source: library:/prog8lib/cx16/floats.p8:192 %asminclude "library:c64/floats_funcs.asm" -; --- floating point builtin functions - - -func_sign_f_into_A .proc - jsr MOVFM - jmp SIGN - .pend - -func_swap_f .proc - ; -- swap floats pointed to by SCRATCH_ZPWORD1, SCRATCH_ZPWORD2 - ldy #4 -- lda (P8ZP_SCRATCH_W1),y - pha - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - pla - sta (P8ZP_SCRATCH_W2),y - dey - bpl - - rts - .pend - -func_reverse_f .proc - ; --- reverse an array of floats (array in P8ZP_SCRATCH_W1, num elements in A) -_left_index = P8ZP_SCRATCH_W2 -_right_index = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - jsr a_times_5 - sec - sbc #5 - sta _right_index - lda #0 - sta _left_index - pla - lsr a - sta _loop_count -_loop ; push the left indexed float on the stack - ldy _left_index - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - pha - ; copy right index float to left index float - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - inc _left_index - inc _right_index - ldy _right_index - lda (P8ZP_SCRATCH_W1),y - ldy _left_index - sta (P8ZP_SCRATCH_W1),y - ; pop the float off the stack into the right index float - ldy _right_index - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - dey - pla - sta (P8ZP_SCRATCH_W1),y - inc _left_index - lda _right_index - sec - sbc #9 - sta _right_index - dec _loop_count - bne _loop - rts - - .pend - - - -a_times_5 .proc - sta P8ZP_SCRATCH_B1 - asl a - asl a - clc - adc P8ZP_SCRATCH_B1 - rts - .pend - -func_any_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_into_A - .pend - -func_all_f_into_A .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_into_A - .pend - -func_any_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_any_b_stack - .pend - -func_all_f_stack .proc - jsr a_times_5 - jmp prog8_lib.func_all_b_stack - .pend - -func_abs_f_into_FAC1 .proc - jsr MOVFM - jmp ABS - .pend - -func_sqrt_into_FAC1 .proc - jsr MOVFM - jmp SQR - .pend - - - -containment_floatarray .proc - ; -- check if a value exists in a float array. - ; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - sty P8ZP_SCRATCH_REG - ldx #floats.floats_temp_var - jsr floats.MOVMF - ldx P8ZP_SCRATCH_REG - ldy #0 -- lda floats.floats_temp_var - cmp (P8ZP_SCRATCH_W1),y - bne _firstmiss - iny - lda floats.floats_temp_var+1 - cmp (P8ZP_SCRATCH_W1),y - bne _secondmiss - iny - lda floats.floats_temp_var+2 - cmp (P8ZP_SCRATCH_W1),y - bne _thirdmiss - iny - lda floats.floats_temp_var+3 - cmp (P8ZP_SCRATCH_W1),y - bne _fourthmiss - iny - lda floats.floats_temp_var+4 - cmp (P8ZP_SCRATCH_W1),y - bne _fifthmiss - lda #1 - rts - -_firstmiss - iny -_secondmiss - iny -_thirdmiss - iny -_fourthmiss - iny -_fifthmiss - iny - dex - bne - - lda #0 - rts - - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:5 asmsub print(float value @FAC1) clobbers(A,X,Y) { - -print .proc - ; source: library:/prog8lib/shared_floats_functions.p8:7 %asm {{ - jsr tostr - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - jsr cbm.CHROUT - iny - bne - -+ rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:19 asmsub tostr(float value @FAC1) clobbers(X) -> str @AY { - -tostr .proc - ; source: library:/prog8lib/shared_floats_functions.p8:21 %asm {{ - jsr FOUT - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #' ' - bne + - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:54 sub sin(float angle) -> float { - -sin .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:55 %asm {{ - lda #angle - jsr MOVFM - jmp SIN -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:114 sub rad(float angle) -> float { - -rad .proc -; statements - ; source: library:/prog8lib/shared_floats_functions.p8:116 %asm {{ - lda #angle - jsr MOVFM - lda #<_pi_div_180 - ldy #>_pi_div_180 - jmp FMULT -_pi_div_180 .byte 123, 14, 250, 53, 18 ; pi / 180 -; variables - .section BSS - .send BSS - -; non-zeropage variables without initialization value - .section BSS -angle .fill 5 - .send BSS - .pend - ; source: library:/prog8lib/shared_floats_functions.p8:218 inline asmsub push(float value @FAC1) { - ; source: library:/prog8lib/shared_floats_functions.p8:224 inline asmsub pop() -> float @FAC1 { - .pend - -; ---- block: 'test_stack' ---- -test_stack .proc - ; source: library:/prog8lib/test_stack.p8:5 test_stack { - - - ; source: library:/prog8lib/test_stack.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/test_stack.p8:8 asmsub test() { - -test .proc - ; source: library:/prog8lib/test_stack.p8:9 %asm {{ - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jsr txt.chrout - lda #'s' - jsr txt.chrout - lda #'p' - jsr txt.chrout - lda #'=' - jsr txt.chrout - tsx - txa - jsr txt.print_ub - lda #13 - jsr txt.chrout - lda #'-' - ldy #12 -- jsr txt.chrout - dey - bne - - lda #13 - jmp txt.chrout - .pend - .pend - -; ---- block: 'math' ---- -math .proc - ; source: library:/prog8lib/math.p8:5 math { - - - ; source: library:/prog8lib/math.p8:6 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/math.p8:8 %asminclude "library:math.asm" -; Internal Math library routines - always included by the compiler -; Generic machine independent 6502 code. -; -; some more interesting routines can be found here: -; http://6502org.wikidot.com/software-math -; http://codebase64.org/doku.php?id=base:6502_6510_maths -; https://github.com/TobyLobster/multiply_test -; https://github.com/TobyLobster/sqrt_test - - -multiply_bytes .proc - ; -- multiply 2 bytes A and Y, result as byte in A (signed or unsigned) - ; https://github.com/TobyLobster/multiply_test/blob/main/tests/mult29.a - -_multiplicand = P8ZP_SCRATCH_B1 -_multiplier = P8ZP_SCRATCH_REG - - sty _multiplicand - lsr a - sta _multiplier - lda #0 - ldx #2 -- - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - bcc + - clc - adc _multiplicand -+ - ror a - ror _multiplier - dex - bne - - ; tay ; if you want 16 bits result in AY, enable this again - lda _multiplier - rts - .pend - - -multiply_words .proc - ; -- multiply two 16-bit words into a 32-bit result (signed and unsigned) - ; input: A/Y = first 16-bit number, multiply_words.multiplier = second 16-bit number - ; output: multiply_words.result, 4-bytes/32-bits product, LSB order (low-to-high) low 16 bits also in AY. - - ; NOTE: the result (which includes the multiplier parameter on entry) is a 4-byte array. - ; this routine could be faster if we could stick that into zeropage, - ; but there currently is no way to use 4 consecutive bytes in ZP (without disabling irq and saving/restoring them)... - -; mult62.a -; from: https://github.com/TobyLobster/multiply_test/blob/main/tests/mult62.a -; based on Dr Jefyll, http://forum.6502.org/viewtopic.php?f=9&t=689&start=0#p19958 -; - adjusted to use fixed zero page addresses -; - removed 'decrement to avoid clc' as this is slower on average -; - rearranged memory use to remove final memory copy and give LSB first order to result -; - removed temp zp storage bytes -; - unrolled the outer loop -; - unrolled the two inner loops once -; -; 16 bit x 16 bit unsigned multiply, 32 bit result -; Average cycles: ~442 ? -; 93 bytes - -_multiplicand = P8ZP_SCRATCH_W2 ; 2 bytes -multiplier = result - -; 16 bit x 16 bit unsigned multiply, 32 bit result -; -; On Entry: -; (multiplier, multiplier+1): two byte multiplier, four bytes needed for result -; (multiplicand, multiplicand+1): two byte multiplicand -; On Exit: -; (result, result+1, result+2, result+3): product - - sta _multiplicand - sty _multiplicand+1 - - lda #0 ; - sta result+2 ; 16 bits of zero in A, result+2 - ; Note: First 8 shifts are A -> result+2 -> result - ; Final 8 shifts are A -> result+2 -> result+1 - - ; --- 1st byte --- - ldy #4 ; count for inner loop - lsr result - - ; inner loop (8 times) -_inner_loop - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result - - dey - bne _inner_loop ; go back for 1 more shift? - - ; --- 2nd byte --- - ldy #4 ; count for inner loop - lsr result+1 - - ; inner loop (8 times) -_inner_loop2 - ; first time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - - ; second time - bcc + - tax ; retain A - lda result+2 - clc - adc _multiplicand - sta result+2 - txa ; recall A - adc _multiplicand+1 - -+ - ror a ; shift - ror result+2 - ror result+1 - dey - bne _inner_loop2 ; go back for 1 more shift? - - sta result+3 ; ms byte of hi-word of result - - lda result - ldy result+1 - rts - -result .byte 0,0,0,0 - - .pend - - -divmod_b_asm .proc - ; signed byte division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_B1 - tya - eor P8ZP_SCRATCH_B1 - php ; save sign - lda P8ZP_SCRATCH_B1 - bpl + - eor #$ff - sec - adc #0 ; make it positive -+ pha - tya - bpl + - eor #$ff - sec - adc #0 ; make it positive - tay -+ pla - jsr divmod_ub_asm - sta _remainder - plp - bpl + - tya - eor #$ff - sec - adc #0 ; negate result - tay -+ rts -_remainder .byte 0 - .pend - - -divmod_ub_asm .proc - ; -- divide A by Y, result quotient in Y, remainder in A (unsigned) - ; division by zero will result in quotient = 255 and remainder = original number - sty P8ZP_SCRATCH_REG - sta P8ZP_SCRATCH_B1 - - lda #0 - ldx #8 - asl P8ZP_SCRATCH_B1 -- rol a - cmp P8ZP_SCRATCH_REG - bcc + - sbc P8ZP_SCRATCH_REG -+ rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 - rts - .pend - -divmod_w_asm .proc - ; signed word division: make everything positive and fix sign afterwards - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W1+1 - eor P8ZP_SCRATCH_W2+1 - php ; save sign - lda P8ZP_SCRATCH_W1+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W1 - sta P8ZP_SCRATCH_W1 - lda #0 - sbc P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W1+1 -+ lda P8ZP_SCRATCH_W2+1 - bpl + - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W2 - lda #0 - sbc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W2+1 -+ tay - lda P8ZP_SCRATCH_W2 - jsr divmod_uw_asm - plp ; restore sign - bpl + - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda #0 - sec - sbc P8ZP_SCRATCH_W2 - pha - lda #0 - sbc P8ZP_SCRATCH_W2+1 - tay - pla -+ rts - .pend - -divmod_uw_asm .proc - ; -- divide two unsigned words (16 bit each) into 16 bit results - ; input: P8ZP_SCRATCH_W1 in ZP: 16 bit number, A/Y: 16 bit divisor - ; output: P8ZP_SCRATCH_W2 in ZP: 16 bit remainder, A/Y: 16 bit division result - ; division by zero will result in quotient = 65535 and remainder = divident - - -dividend = P8ZP_SCRATCH_W1 -remainder = P8ZP_SCRATCH_W2 -result = dividend ;save memory by reusing divident to store the result - - sta _divisor - sty _divisor+1 - lda #0 ;preset remainder to 0 - sta remainder - sta remainder+1 - ldx #16 ;repeat for each bit: ... - -- asl dividend ;dividend lb & hb*2, msb -> Carry - rol dividend+1 - rol remainder ;remainder lb & hb * 2 + msb from carry - rol remainder+1 - lda remainder - sec - sbc _divisor ;substract divisor to see if it fits in - tay ;lb result -> Y, for we may need it later - lda remainder+1 - sbc _divisor+1 - bcc + ;if carry=0 then divisor didn't fit in yet - - sta remainder+1 ;else save substraction result as new remainder, - sty remainder - inc result ;and INCrement result cause divisor fit in 1 times - -+ dex - bne - - - lda result - ldy result+1 - rts -_divisor .word 0 - .pend - - -randword .proc - ; -- 16 bit pseudo random number generator into AY - ; default seed = $00c2 $1137 - ; routine from https://codebase64.org/doku.php?id=base:x_abc_random_number_generator_8_16_bit - inc x1 - clc -x1=*+1 - lda #$00 ;x1 -c1=*+1 - eor #$c2 ;c1 -a1=*+1 - eor #$11 ;a1 - sta a1 -b1=*+1 - adc #$37 ;b1 - sta b1 - lsr a - eor a1 - adc c1 - sta c1 - ldy b1 - rts - .pend - -randbyte = randword ; -- 8 bit pseudo random number generator into A (by just reusing randword) - - -; ----------- optimized multiplications (in-place A (byte) and ?? (word)) : --------- -mul_byte_3 .proc - ; A = A + A*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_3 .proc - ; AY = AY*2 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_5 .proc - ; A = A*4 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_5 .proc - ; AY = AY*4 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - - -mul_byte_6 .proc - ; A = (A*2 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_6 .proc - ; AY = (AY*2 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - tay - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - tya - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_7 .proc - ; A = A*8 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_7 .proc - ; AY = AY*8 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_9 .proc - ; A = A*8 + A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_9 .proc - ; AY = AY*8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - rts - .pend - -mul_byte_10 .proc - ; A=(A*4 + A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - rts - .pend - -mul_word_10 .proc - ; AY=(AY*4 + AY)*2 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_11 .proc - ; A=(A*2 + A)*4 - A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_11 is skipped (too much code) - -mul_byte_12 .proc - ; A=(A*2 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_12 .proc - ; AY=(AY*2 + AY)*4 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - ldy P8ZP_SCRATCH_W1+1 - rts - .pend - -mul_byte_13 .proc - ; A=(A*2 + A)*4 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -; mul_word_13 is skipped (too much code) - -mul_byte_14 .proc - ; A=(A*8 - A)*2 - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - asl a - rts - .pend - -; mul_word_14 is skipped (too much code) - -mul_byte_15 .proc - ; A=A*16 - A - sta P8ZP_SCRATCH_REG - asl a - asl a - asl a - asl a - sec - sbc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_15 .proc - ; AY = AY * 16 - AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - sec - sbc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - sbc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_20 .proc - ; A=(A*4 + A)*4 - sta P8ZP_SCRATCH_REG - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - rts - .pend - -mul_word_20 .proc - ; AY = AY * 10 * 2 - jsr mul_word_10 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_25 .proc - ; A=(A*2 + A)*8 + A - sta P8ZP_SCRATCH_REG - asl a - clc - adc P8ZP_SCRATCH_REG - asl a - asl a - asl a - clc - adc P8ZP_SCRATCH_REG - rts - .pend - -mul_word_25 .proc - ; AY = (AY*2 + AY) *8 + AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_40 .proc - and #7 - tay - lda _forties,y - rts -_forties .byte 0*40, 1*40, 2*40, 3*40, 4*40, 5*40, 6*40, 7*40 & 255 - .pend - -mul_word_40 .proc - ; AY = (AY*4 + AY)*8 - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - asl a - rol P8ZP_SCRATCH_W1+1 - asl a - rol P8ZP_SCRATCH_W1+1 - clc - adc P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_W1 - lda P8ZP_SCRATCH_W1+1 - adc P8ZP_SCRATCH_W2+1 - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - asl P8ZP_SCRATCH_W1 - rol a - tay - lda P8ZP_SCRATCH_W1 - rts - .pend - -mul_byte_50 .proc - and #7 - tay - lda _fifties, y - rts -_fifties .byte 0*50, 1*50, 2*50, 3*50, 4*50, 5*50, 6*50 & 255, 7*50 & 255 - .pend - -mul_word_50 .proc - ; AY = AY * 25 * 2 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_80 .proc - and #3 - tay - lda _eighties, y - rts -_eighties .byte 0*80, 1*80, 2*80, 3*80 - .pend - -mul_word_80 .proc - ; AY = AY * 40 * 2 - jsr mul_word_40 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_byte_100 .proc - and #3 - tay - lda _hundreds, y - rts -_hundreds .byte 0*100, 1*100, 2*100, 3*100 & 255 - .pend - -mul_word_100 .proc - ; AY = AY * 25 * 4 - jsr mul_word_25 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_REG - rts - .pend - -mul_word_320 .proc - ; AY = A * 256 + A * 64 (msb in Y doesn't matter) - sta P8ZP_SCRATCH_B1 - ldy #0 - sty P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - asl a - rol P8ZP_SCRATCH_REG - pha - clc - lda P8ZP_SCRATCH_B1 - adc P8ZP_SCRATCH_REG - tay - pla - rts - .pend - -mul_word_640 .proc - ; AY = (A * 2 * 320) (msb in Y doesn't matter) - asl a - jmp mul_word_320 - .pend - - -; ----------- end optimized multiplications ----------- - - -; support for bit shifting that is too large to be unrolled: - -lsr_byte_A .proc - ; -- lsr signed byte in A times the value in Y - cpy #0 - beq + - cmp #0 - bpl lsr_ubyte_A -- sec - ror a - dey - bne - -+ rts - .pend - -lsr_ubyte_A .proc - ; -- lsr unsigned byte in A times the value in Y - cpy #0 - beq + -- lsr a - dey - bne - -+ rts - .pend - -asl_byte_A .proc - ; -- asl any byte in A times the value in Y - cpy #0 - beq + -- asl a - dey - bne - -+ rts - .pend - - -lsr_word_AY .proc - ; -- lsr signed word in AY times the value in X - cpx #0 - beq + - cpy #0 - bpl lsr_uword_AY - sty P8ZP_SCRATCH_B1 -- sec - ror P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -lsr_uword_AY .proc - ; -- lsr unsigned word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- lsr P8ZP_SCRATCH_B1 - ror a - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - -asl_word_AY .proc - ; -- asl any word in AY times the value in X - cpx #0 - beq + - sty P8ZP_SCRATCH_B1 -- asl a - rol P8ZP_SCRATCH_B1 - dex - bne - - ldy P8ZP_SCRATCH_B1 -+ rts - .pend - - -square .proc -; -- calculate square of signed word (actually -255..255) in AY, result in AY -; routine by Lee Davison, source: http://6502.org/source/integers/square.htm -; using this routine is a lot faster as doing a regular multiplication (for words) -; -; Calculates the 16 bit unsigned integer square of the signed 16 bit integer in -; Numberl/Numberh. The result is always in the range 0 to 65025 and is held in -; Squarel/Squareh -; -; The maximum input range is only +/-255 and no checking is done to ensure that -; this is so. -; -; This routine is useful if you are trying to draw circles as for any circle -; -; x^2+y^2=r^2 where x and y are the co-ordinates of any point on the circle and -; r is the circle radius - -numberl = P8ZP_SCRATCH_W1 ; number to square low byte -numberh = P8ZP_SCRATCH_W1+1 ; number to square high byte -squarel = P8ZP_SCRATCH_W2 ; square low byte -squareh = P8ZP_SCRATCH_W2+1 ; square high byte -tempsq = P8ZP_SCRATCH_B1 ; temp byte for intermediate result - - sta numberl - sty numberh - - lda #$00 ; clear a - sta squarel ; clear square low byte - ; (no need to clear the high byte, it gets shifted out) - lda numberl ; get number low byte - ldx numberh ; get number high byte - bpl _nonneg ; if +ve don't negate it - ; else do a two's complement - eor #$ff ; invert - sec ; +1 - adc #$00 ; and add it - -_nonneg: - sta tempsq ; save abs(number) - ldx #$08 ; set bit count - -_nextr2bit: - asl squarel ; low byte *2 - rol squareh ; high byte *2+carry from low - asl a ; shift number byte - bcc _nosqadd ; don't do add if c = 0 - tay ; save a - clc ; clear carry for add - lda tempsq ; get number - adc squarel ; add number^2 low byte - sta squarel ; save number^2 low byte - lda #$00 ; clear a - adc squareh ; add number^2 high byte - sta squareh ; save number^2 high byte - tya ; get a back - -_nosqadd: - dex ; decrement bit count - bne _nextr2bit ; go do next bit - - lda squarel - ldy squareh - rts - - .pend - ; source: library:/prog8lib/math.p8:10 asmsub sin8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -sin8u .proc - ; source: library:/prog8lib/math.p8:11 %asm {{ - tay - lda _sinecos8u,y - rts -_sinecos8u .byte trunc(128.0 + 127.5 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:19 asmsub cos8u(ubyte angle @A) clobbers(Y) -> ubyte @A { - -cos8u .proc - ; source: library:/prog8lib/math.p8:20 %asm {{ - tay - lda sin8u._sinecos8u+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:27 asmsub sin8(ubyte angle @A) clobbers(Y) -> byte @A { - -sin8 .proc - ; source: library:/prog8lib/math.p8:28 %asm {{ - tay - lda _sinecos8,y - rts -_sinecos8 .char trunc(127.0 * sin(range(256+64) * rad(360.0/256.0))) - .pend - ; source: library:/prog8lib/math.p8:36 asmsub cos8(ubyte angle @A) clobbers(Y) -> byte @A { - -cos8 .proc - ; source: library:/prog8lib/math.p8:37 %asm {{ - tay - lda sin8._sinecos8+64,y - rts - .pend - ; source: library:/prog8lib/math.p8:44 asmsub sinr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -sinr8u .proc - ; source: library:/prog8lib/math.p8:45 %asm {{ - tay - lda _sinecosR8u,y - rts -_sinecosR8u .byte trunc(128.0 + 127.5 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:53 asmsub cosr8u(ubyte radians @A) clobbers(Y) -> ubyte @A { - -cosr8u .proc - ; source: library:/prog8lib/math.p8:54 %asm {{ - tay - lda sinr8u._sinecosR8u+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:61 asmsub sinr8(ubyte radians @A) clobbers(Y) -> byte @A { - -sinr8 .proc - ; source: library:/prog8lib/math.p8:62 %asm {{ - tay - lda _sinecosR8,y - rts -_sinecosR8 .char trunc(127.0 * sin(range(180+45) * rad(360.0/180.0))) - .pend - ; source: library:/prog8lib/math.p8:70 asmsub cosr8(ubyte radians @A) clobbers(Y) -> byte @A { - -cosr8 .proc - ; source: library:/prog8lib/math.p8:71 %asm {{ - tay - lda sinr8._sinecosR8+45,y - rts - .pend - ; source: library:/prog8lib/math.p8:78 asmsub rnd() clobbers(Y) -> ubyte @A { - -rnd .proc - ; source: library:/prog8lib/math.p8:79 %asm {{ - jmp math.randbyte - .pend - ; source: library:/prog8lib/math.p8:84 asmsub rndw() -> uword @AY { - -rndw .proc - ; source: library:/prog8lib/math.p8:85 %asm {{ - jmp math.randword - .pend - ; source: library:/prog8lib/math.p8:108 asmsub rndseed(uword seed1 @AY, uword seed2 @R0) clobbers(A,Y) { - -rndseed .proc - ; source: library:/prog8lib/math.p8:110 %asm {{ - sta math.randword.x1 - sty math.randword.c1 - lda cx16.r0L - sta math.randword.a1 - lda cx16.r0H - sta math.randword.b1 - rts - .pend - ; source: library:/prog8lib/math.p8:121 asmsub log2(ubyte value @A) -> ubyte @Y { - -log2 .proc - ; source: library:/prog8lib/math.p8:122 %asm {{ - sta P8ZP_SCRATCH_B1 - lda #$80 - ldy #7 -- bit P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr a - bne - - .pend - ; source: library:/prog8lib/math.p8:137 asmsub log2w(uword value @AY) -> ubyte @Y { - -log2w .proc - ; source: library:/prog8lib/math.p8:138 %asm {{ - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - lda #<$8000 - sta cx16.r0 - lda #>$8000 - sta cx16.r0+1 - ldy #15 -- lda P8ZP_SCRATCH_W1 - and cx16.r0 - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1+1 - and cx16.r0+1 - ora P8ZP_SCRATCH_B1 - beq + - rts -+ dey - bne + - rts -+ lsr cx16.r0+1 - ror cx16.r0 - jmp - - .pend - ; source: library:/prog8lib/math.p8:163 asmsub mul16_last_upper() -> uword @AY { - -mul16_last_upper .proc - ; source: library:/prog8lib/math.p8:171 %asm {{ - lda multiply_words.result+2 - ldy multiply_words.result+3 - rts - .pend - ; source: library:/prog8lib/math.p8:212 asmsub direction_qd(ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A { - -direction_qd .proc - ; source: library:/prog8lib/math.p8:220 %asm {{ -x_delta = cx16.r0L -y_delta = cx16.r1L -quadrant = cx16.r2L -half_value = cx16.r3L -region_number = cx16.r4L -small = cx16.r5L -large = cx16.r5H - - sta quadrant - sty y_delta - stx x_delta - cpx y_delta - bcs _XGreaterOrEqualY - -_XLessY: - lda #16 - sta region_number - stx small - sty large - bne _DetermineRegion - -_XGreaterOrEqualY: - lda #0 - sta region_number - stx large - sty small - -_DetermineRegion: - ; set A = small * 2.5 - lda small - lsr a - sta half_value - lda small - asl a - bcs _SmallerQuotient - clc - adc half_value - bcs _SmallerQuotient - cmp large - bcc _LargerQuotient - -; S * 2.5 > L -_SmallerQuotient: - ; set A = S * 1.25 - lsr half_value - lda small - clc - adc half_value - cmp large - bcc _Region1 ; if S * 1.25 < L then goto Region1 (L / S > 1.25) - bcs _Region0 ; (L / S < 1.25) - -; S * 2.5 < L -_LargerQuotient: - ; set A = S * 7.5 - lda small - asl a - asl a - asl a - bcs _Region2 - sec - sbc half_value - cmp large - bcc _Region3 ; if S * 7.5 < L then goto Region3 (L / S > 7.5) - jmp _Region2 ; (L / S < 7.5) - -_Region0: - ; L / S < 1.25. d=3,9,15,21 - jmp _LookupResult - -_Region1: - ; 1.25 < L / S < 2.5. d=2,4,8,10,14,16,20,22 - lda region_number - clc - adc #4 - sta region_number - bpl _LookupResult - -_Region2: - ; 2.5 < L / S < 7.5. d=1,5,7,11,13,17,19,23 - lda region_number - clc - adc #8 - sta region_number - bpl _LookupResult - -_Region3: - ; 7.5 < L / S. d=0,6,12,18 - lda region_number - clc - adc #12 - sta region_number - -_LookupResult: - lda quadrant - clc - adc region_number - tax - lda _quadrant_region_to_direction,x - rts - -_quadrant_region_to_direction: - .byte 9, 3,15,21 - .byte 10, 2,14,22 - .byte 11, 1,13,23 - .byte 12, 0,12, 0 - .byte 9, 3,15,21 - .byte 8, 4,16,20 - .byte 7, 5,17,19 - .byte 6, 6,18,18 - .pend - ; source: library:/prog8lib/math.p8:335 asmsub atan2(ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A { - -atan2 .proc - ; source: library:/prog8lib/math.p8:341 %asm {{ -x1 = cx16.r0L -y1 = cx16.r1L -x2 = cx16.r2L -y2 = cx16.r3L -octant = cx16.r4L ;; temporary zeropage variable - - lda x1 - sec - sbc x2 - bcs *+4 - eor #$ff - tax - rol octant - - lda y1 - sec - sbc y2 - bcs *+4 - eor #$ff - tay - rol octant - - lda log2_tab,x - sec - sbc log2_tab,y - bcc *+4 - eor #$ff - tax - - lda octant - rol a - and #%111 - tay - - lda atan_tab,x - eor octant_adjust,y - rts - -octant_adjust - .byte %00111111 ;; x+,y+,|x|>|y| - .byte %00000000 ;; x+,y+,|x|<|y| - .byte %11000000 ;; x+,y-,|x|>|y| - .byte %11111111 ;; x+,y-,|x|<|y| - .byte %01000000 ;; x-,y+,|x|>|y| - .byte %01111111 ;; x-,y+,|x|<|y| - .byte %10111111 ;; x-,y-,|x|>|y| - .byte %10000000 ;; x-,y-,|x|<|y| - - - ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;; - -atan_tab - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02 - .byte $03,$03,$03,$03,$03,$03,$03,$03 - .byte $03,$03,$03,$03,$03,$04,$04,$04 - .byte $04,$04,$04,$04,$04,$04,$04,$04 - .byte $05,$05,$05,$05,$05,$05,$05,$05 - .byte $06,$06,$06,$06,$06,$06,$06,$06 - .byte $07,$07,$07,$07,$07,$07,$08,$08 - .byte $08,$08,$08,$08,$09,$09,$09,$09 - .byte $09,$0a,$0a,$0a,$0a,$0b,$0b,$0b - .byte $0b,$0c,$0c,$0c,$0c,$0d,$0d,$0d - .byte $0d,$0e,$0e,$0e,$0e,$0f,$0f,$0f - .byte $10,$10,$10,$11,$11,$11,$12,$12 - .byte $12,$13,$13,$13,$14,$14,$15,$15 - .byte $15,$16,$16,$17,$17,$17,$18,$18 - .byte $19,$19,$19,$1a,$1a,$1b,$1b,$1c - .byte $1c,$1c,$1d,$1d,$1e,$1e,$1f,$1f - - - ;;;;;;;; log2(x)*32 ;;;;;;;; - -log2_tab - .byte $00,$00,$20,$32,$40,$4a,$52,$59 - .byte $60,$65,$6a,$6e,$72,$76,$79,$7d - .byte $80,$82,$85,$87,$8a,$8c,$8e,$90 - .byte $92,$94,$96,$98,$99,$9b,$9d,$9e - .byte $a0,$a1,$a2,$a4,$a5,$a6,$a7,$a9 - .byte $aa,$ab,$ac,$ad,$ae,$af,$b0,$b1 - .byte $b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9 - .byte $b9,$ba,$bb,$bc,$bd,$bd,$be,$bf - .byte $c0,$c0,$c1,$c2,$c2,$c3,$c4,$c4 - .byte $c5,$c6,$c6,$c7,$c7,$c8,$c9,$c9 - .byte $ca,$ca,$cb,$cc,$cc,$cd,$cd,$ce - .byte $ce,$cf,$cf,$d0,$d0,$d1,$d1,$d2 - .byte $d2,$d3,$d3,$d4,$d4,$d5,$d5,$d5 - .byte $d6,$d6,$d7,$d7,$d8,$d8,$d9,$d9 - .byte $d9,$da,$da,$db,$db,$db,$dc,$dc - .byte $dd,$dd,$dd,$de,$de,$de,$df,$df - .byte $df,$e0,$e0,$e1,$e1,$e1,$e2,$e2 - .byte $e2,$e3,$e3,$e3,$e4,$e4,$e4,$e5 - .byte $e5,$e5,$e6,$e6,$e6,$e7,$e7,$e7 - .byte $e7,$e8,$e8,$e8,$e9,$e9,$e9,$ea - .byte $ea,$ea,$ea,$eb,$eb,$eb,$ec,$ec - .byte $ec,$ec,$ed,$ed,$ed,$ed,$ee,$ee - .byte $ee,$ee,$ef,$ef,$ef,$ef,$f0,$f0 - .byte $f0,$f1,$f1,$f1,$f1,$f1,$f2,$f2 - .byte $f2,$f2,$f3,$f3,$f3,$f3,$f4,$f4 - .byte $f4,$f4,$f5,$f5,$f5,$f5,$f5,$f6 - .byte $f6,$f6,$f6,$f7,$f7,$f7,$f7,$f7 - .byte $f8,$f8,$f8,$f8,$f9,$f9,$f9,$f9 - .byte $f9,$fa,$fa,$fa,$fa,$fa,$fb,$fb - .byte $fb,$fb,$fb,$fc,$fc,$fc,$fc,$fc - .byte $fd,$fd,$fd,$fd,$fd,$fd,$fe,$fe - .byte $fe,$fe,$fe,$ff,$ff,$ff,$ff,$ff - .pend - ; source: library:/prog8lib/math.p8:468 asmsub diff(ubyte v1 @A, ubyte v2 @Y) -> ubyte @A { - -diff .proc - ; source: library:/prog8lib/math.p8:470 %asm {{ - sty P8ZP_SCRATCH_REG - sec - sbc P8ZP_SCRATCH_REG - bcs + - eor #255 - inc a -+ rts - .pend - ; source: library:/prog8lib/math.p8:481 asmsub diffw(uword w1 @R0, uword w2 @AY) -> uword @AY { - -diffw .proc - ; source: library:/prog8lib/math.p8:483 %asm {{ - sec - sbc cx16.r0L - sta cx16.r0L - tya - sbc cx16.r0H - sta cx16.r0H - bcs + - eor #255 - sta cx16.r0H - lda cx16.r0L - eor #255 - inc a - sta cx16.r0L - bne + - inc cx16.r0H -+ lda cx16.r0L - ldy cx16.r0H - rts - .pend - .pend - -; ---- block: 'prog8_lib' ---- -prog8_lib .proc - ; source: library:/prog8lib/prog8_lib.p8:3 prog8_lib { - - - ; source: library:/prog8lib/prog8_lib.p8:4 %option no_symbol_prefixing, ignore_unused - ; source: library:/prog8lib/prog8_lib.p8:6 %asminclude "library:prog8_lib.asm" -; Internal library routines - always included by the compiler -; Generic machine independent 6502 code. - - -orig_stackpointer .byte 0 ; stores the Stack pointer register at program start - - -read_byte_from_address_in_AY_into_A .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - lda (P8ZP_SCRATCH_W2),y - rts - .pend - - -write_byte_X_to_address_in_AY .proc - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #0 - txa - sta (P8ZP_SCRATCH_W2),y - rts - .pend - - -reg_less_uw .proc - ; AY < P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - bcc _true - bne _false - cmp P8ZP_SCRATCH_W2 - bcc _true -_false lda #0 - rts -_true lda #1 - rts - .pend - -reg_less_w .proc - ; -- AY < P8ZP_SCRATCH_W2? - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_uw .proc - ; AY <= P8ZP_SCRATCH_W2? - cpy P8ZP_SCRATCH_W2+1 - beq + - bcc _true - lda #0 - rts -+ cmp P8ZP_SCRATCH_W2 - bcc _true - beq _true - lda #0 - rts -_true lda #1 - rts - .pend - -reg_lesseq_w .proc - ; -- P8ZP_SCRATCH_W2 <= AY ? (note: order different from other routines) - cmp P8ZP_SCRATCH_W2 - tya - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bpl + - lda #0 - rts -+ lda #1 - rts - .pend - - -memcopy16_up .proc - ; -- copy memory UP from (P8ZP_SCRATCH_W1) to (P8ZP_SCRATCH_W2) of length X/Y (16-bit, X=lo, Y=hi) - ; clobbers register A,X,Y - source = P8ZP_SCRATCH_W1 - dest = P8ZP_SCRATCH_W2 - length = P8ZP_SCRATCH_B1 ; (and SCRATCH_ZPREG) - - stx length - sty length+1 - - ldx length ; move low byte of length into X - bne + ; jump to start if X > 0 - dec length ; subtract 1 from length -+ ldy #0 ; set Y to 0 -- lda (source),y ; set A to whatever (source) points to offset by Y - sta (dest),y ; move A to location pointed to by (dest) offset by Y - iny ; increment Y - bne + ; if Y<>0 then (rolled over) then still moving bytes - inc source+1 ; increment hi byte of source - inc dest+1 ; increment hi byte of dest -+ dex ; decrement X (lo byte counter) - bne - ; if X<>0 then move another byte - dec length ; we've moved 255 bytes, dec length - bpl - ; if length is still positive go back and move more - rts ; done - .pend - - -memset .proc - ; -- fill memory from (P8ZP_SCRATCH_W1), length XY, with value in A. - ; clobbers X, Y - stx P8ZP_SCRATCH_B1 - sty _save_reg - ldy #0 - ldx _save_reg - beq _lastpage - -_fullpage sta (P8ZP_SCRATCH_W1),y - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page - dex - bne _fullpage - -_lastpage ldy P8ZP_SCRATCH_B1 - beq + -- dey - sta (P8ZP_SCRATCH_W1),y - bne - - -+ rts -_save_reg .byte 0 - .pend - - -memsetw .proc - ; -- fill memory from (P8ZP_SCRATCH_W1) number of words in P8ZP_SCRATCH_W2, with word value in AY. - ; clobbers A, X, Y - sta _mod1+1 ; self-modify - sty _mod1b+1 ; self-modify - sta _mod2+1 ; self-modify - sty _mod2b+1 ; self-modify - ldx P8ZP_SCRATCH_W1 - stx P8ZP_SCRATCH_B1 - ldx P8ZP_SCRATCH_W1+1 - inx - stx P8ZP_SCRATCH_REG ; second page - - ldy #0 - ldx P8ZP_SCRATCH_W2+1 - beq _lastpage - -_fullpage -_mod1 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny -_mod1b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1),y ; first page - sta (P8ZP_SCRATCH_B1),y ; second page - iny - bne _fullpage - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_W1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - inc P8ZP_SCRATCH_B1+1 ; next page pair - dex - bne _fullpage - -_lastpage ldx P8ZP_SCRATCH_W2 - beq _done - - ldy #0 -- -_mod2 lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne _mod2b - inc P8ZP_SCRATCH_W1+1 -_mod2b lda #0 ; self-modified - sta (P8ZP_SCRATCH_W1), y - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ dex - bne - -_done rts - .pend - - - -ror2_mem_ub .proc - ; -- in-place 8-bit ror of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - lsr a - bcc + - ora #$80 -+ sta (P8ZP_SCRATCH_W1),y - rts - .pend - -rol2_mem_ub .proc - ; -- in-place 8-bit rol of byte at memory location in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - cmp #$80 - rol a - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -strcpy .proc - ; copy a string (must be 0-terminated) from A/Y to (P8ZP_SCRATCH_W1) - ; it is assumed the target string is large enough. - ; returns the length of the string that was copied in Y. - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - ldy #$ff -- iny - lda (P8ZP_SCRATCH_W2),y - sta (P8ZP_SCRATCH_W1),y - bne - - rts - .pend - -strcmp_expression .proc - ; -- compare strings, result in A - lda _arg_s2 - ldy _arg_s2+1 - sta P8ZP_SCRATCH_W2 - sty P8ZP_SCRATCH_W2+1 - lda _arg_s1 - ldy _arg_s1+1 - jmp strcmp_mem -_arg_s1 .word 0 -_arg_s2 .word 0 - .pend - -strcmp_mem .proc - ; -- compares strings in s1 (AY) and s2 (P8ZP_SCRATCH_W2). - ; Returns -1,0,1 in A, depeding on the ordering. Clobbers Y. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_loop lda (P8ZP_SCRATCH_W1),y - bne + - lda (P8ZP_SCRATCH_W2),y - bne _return_minusone - beq _return -+ cmp (P8ZP_SCRATCH_W2),y - bcc _return_minusone - bne _return_one - inc P8ZP_SCRATCH_W1 - bne + - inc P8ZP_SCRATCH_W1+1 -+ inc P8ZP_SCRATCH_W2 - bne _loop - inc P8ZP_SCRATCH_W2+1 - bne _loop -_return_one - lda #1 -_return rts -_return_minusone - lda #-1 - rts - .pend - - -strlen .proc - ; -- returns the number of bytes in the string in AY, in Y. Clobbers A. - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq + - iny - bne - -+ rts - .pend - - -containment_bytearray .proc - ; -- check if a value exists in a byte array. - ; parameters: P8ZP_SCRATCH_W1: address of the byte array, A = byte to check, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey -- cmp (P8ZP_SCRATCH_W1),y - beq + - dey - cpy #255 - bne - - lda #0 - rts -+ lda #1 - rts - .pend - -containment_wordarray .proc - ; -- check if a value exists in a word array. - ; parameters: P8ZP_SCRATCH_W1: value to check, P8ZP_SCRATCH_W2: address of the word array, Y = length of array (>=1). - ; returns boolean 0/1 in A. - dey - tya - asl a - tay -- lda P8ZP_SCRATCH_W1 - cmp (P8ZP_SCRATCH_W2),y - bne + - lda P8ZP_SCRATCH_W1+1 - iny - cmp (P8ZP_SCRATCH_W2),y - beq _found - dey -+ dey - dey - cpy #254 - bne - - lda #0 - rts -_found lda #1 - rts - .pend - - -arraycopy_split_to_normal_words .proc - ; P8ZP_SCRATCH_W1 = start of lsb array - ; P8ZP_SCRATCH_W2 = start of msb array - ; AY = start of normal word target array - ; X = number of elements to copy - sta _modlsb+1 - sty _modlsb+2 - clc - adc #1 - bne + - iny -+ sta _modmsb+1 - sty _modmsb+2 - ldy #0 -- lda (P8ZP_SCRATCH_W1),y -_modlsb sta $ffff ; modified lsb store - lda _modlsb+1 - clc - adc #2 - sta _modlsb+1 - bcc + - inc _modlsb+2 -+ lda (P8ZP_SCRATCH_W2),y -_modmsb sta $ffff ; modified msb store - lda _modmsb+1 - clc - adc #2 - sta _modmsb+1 - bcc + - inc _modmsb+2 -+ iny - dex - bne - - rts - .pend - - -arraycopy_normal_to_split_words .proc - ; P8ZP_SCRATCH_W1 = start of target lsb array - ; P8ZP_SCRATCH_W2 = start of target msb array - ; AY = start of normal word source array - ; X = number of elements to copy - sta _modsrclsb+1 - sty _modsrclsb+2 - clc - adc #1 - bne + - iny -+ sta _modsrcmsb+1 - sty _modsrcmsb+2 - ldy #0 -_modsrclsb lda $ffff ; modified lsb read - sta (P8ZP_SCRATCH_W1),y - lda _modsrclsb+1 - clc - adc #2 - sta _modsrclsb+1 - bcc + - inc _modsrclsb+2 -+ -_modsrcmsb lda $ffff ; modnfied msb read - sta (P8ZP_SCRATCH_W2),y - lda _modsrcmsb+1 - clc - adc #2 - sta _modsrcmsb+1 - bcc + - inc _modsrcmsb+2 -+ iny - dex - bne _modsrclsb - rts - .pend - -memcopy_small .proc - ; copy up to a single page (256 bytes) of memory. - ; note: only works for NON-OVERLAPPING memory regions! - ; P8ZP_SCRATCH_W1 = from address - ; P8ZP_SCRATCH_W2 = destination address - ; Y = number of bytes to copy (where 0 means 256) - cpy #0 - beq _fullpage - dey - beq _lastbyte -_loop lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _loop -_lastbyte lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - rts -_fullpage lda (P8ZP_SCRATCH_W1),y - sta (P8ZP_SCRATCH_W2),y - dey - bne _fullpage - rts - .pend - ; source: library:/prog8lib/prog8_lib.p8:7 %asminclude "library:prog8_funcs.asm" -; ---- builtin functions - - -func_any_b_into_A .proc - ; -- any(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne _got_any - iny -_cmp_mod cpy #255 ; modified - bne - - lda #0 - rts -_got_any lda #1 - rts - .pend - - -func_all_b_into_A .proc - ; -- all(array), array in P8ZP_SCRATCH_W1, num bytes in A - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - beq _got_not_all - iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 -_got_not_all rts - .pend - -func_any_w_into_A .proc - asl a - jmp func_any_b_into_A - .pend - -func_all_w_into_A .proc - ; -- all(warray), array in P8ZP_SCRATCH_W1, num bytes in A - asl a ; times 2 because of word - sta _cmp_mod+1 ; self-modifying code - ldy #0 -- lda (P8ZP_SCRATCH_W1),y - bne + - iny - lda (P8ZP_SCRATCH_W1),y - bne ++ - lda #0 - rts -+ iny -+ iny -_cmp_mod cpy #255 ; modified - bne - - lda #1 - rts - .pend - -abs_b_into_A .proc - ; -- A = abs(A) - cmp #0 - bmi + - rts -+ eor #$ff - clc - adc #1 - rts - .pend - -abs_w_into_AY .proc - ; -- AY = abs(AY) - cpy #0 - bmi + - rts -+ eor #$ff - pha - tya - eor #$ff - tay - pla - clc - adc #1 - bcc + - iny -+ rts - .pend - -func_sign_b_into_A .proc - cmp #0 - beq _zero - bmi _neg - lda #1 -_zero rts -_neg lda #-1 - rts - .pend - -func_sign_ub_into_A .proc - cmp #0 - bne _pos - rts -_pos lda #1 - rts - .pend - -func_sign_uw_into_A .proc - cpy #0 - beq _possibly_zero -_pos lda #1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - -func_sign_w_into_A .proc - cpy #0 - beq _possibly_zero - bmi _neg -_pos lda #1 - rts -_neg lda #-1 - rts -_possibly_zero cmp #0 - bne _pos - rts - .pend - - -func_sqrt16_into_A .proc - ; integer square root - ; http://6502org.wikidot.com/software-math-sqrt - ; https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt7.a - ; Tweaked by TobyLobster and 0xC0DE to be smaller and faster -_numl = P8ZP_SCRATCH_W1 -_numh = P8ZP_SCRATCH_W1+1 -_loop_counter = P8ZP_SCRATCH_REG -_root = P8ZP_SCRATCH_B1 - sta _numl - sty _numh - ldx #$ff - stx _loop_counter - inx - stx _root - sec -_loop lda _numh - sbc #$40 - tay - txa - sbc _root - bcc + - sty _numh - bcs ++ -+ txa -+ rol _root - asl _numl - rol _numh - rol a - asl _numl - rol _numh - rol a - tax - lsr _loop_counter - bne _loop - lda _root - rts - .pend - - -func_sort_ub .proc - ; 8bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in S - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bcc _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_b .proc - ; 8bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first, put pointer BEFORE array - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - bne + - dec P8ZP_SCRATCH_W1+1 -+ dec P8ZP_SCRATCH_W1 -_sortloop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta P8ZP_SCRATCH_REG ;save value. will be over-written by largest number - jmp _l2 -_l1 dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2+1 - bmi _l1 -_l2 sty P8ZP_SCRATCH_W2 ;index of potentially largest value - sta P8ZP_SCRATCH_W2+1 ;potentially largest value - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2+1 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - ldy P8ZP_SCRATCH_W2 ;index of free space - lda P8ZP_SCRATCH_REG ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - bne _sortloop ;start working with the shorter sequence - rts - .pend - - -func_sort_uw .proc - ; 16bit unsigned sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - iny - lda (P8ZP_SCRATCH_W1),y - dey - cmp P8ZP_SCRATCH_W2+1 - bne + - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 -+ bcc _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_sort_w .proc - ; 16bit signed sort - ; sorting subroutine coded by mats rosengren (mats.rosengren@esa.int) - ; input: address of array to sort in P8ZP_SCRATCH_W1, length in A - ; first: subtract 2 of the pointer - asl a - sta P8ZP_SCRATCH_B1 - lda P8ZP_SCRATCH_W1 - sec - sbc #2 - sta P8ZP_SCRATCH_W1 - bcs _sort_loop - dec P8ZP_SCRATCH_W1+1 -_sort_loop ldy P8ZP_SCRATCH_B1 ;start of subroutine sort - lda (P8ZP_SCRATCH_W1),y ;last value in (what is left of) sequence to be sorted - sta _work3 ;save value. will be over-written by largest number - iny - lda (P8ZP_SCRATCH_W1),y - sta _work3+1 - dey - jmp _l2 -_l1 dey - dey - beq _l3 - lda (P8ZP_SCRATCH_W1),y - cmp P8ZP_SCRATCH_W2 - iny - lda (P8ZP_SCRATCH_W1),y - dey - sbc P8ZP_SCRATCH_W2+1 - bvc + - eor #$80 -+ bmi _l1 -_l2 sty _work1 ;index of potentially largest value - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2 ;potentially largest value - iny - lda (P8ZP_SCRATCH_W1),y - sta P8ZP_SCRATCH_W2+1 - dey - jmp _l1 -_l3 ldy P8ZP_SCRATCH_B1 ;where the largest value shall be put - lda P8ZP_SCRATCH_W2 ;the largest value - sta (P8ZP_SCRATCH_W1),y ;put largest value in place - iny - lda P8ZP_SCRATCH_W2+1 - sta (P8ZP_SCRATCH_W1),y - ldy _work1 ;index of free space - lda _work3 ;the over-written value - sta (P8ZP_SCRATCH_W1),y ;put the over-written value in the free space - iny - lda _work3+1 - sta (P8ZP_SCRATCH_W1),y - dey - dec P8ZP_SCRATCH_B1 ;end of the shorter sequence still left - dec P8ZP_SCRATCH_B1 - bne _sort_loop ;start working with the shorter sequence - rts -_work1 .byte 0 -_work3 .word 0 - .pend - - -func_reverse_b .proc - ; --- reverse an array of bytes (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_right = P8ZP_SCRATCH_W2 -_index_left = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - sta _loop_count - lsr _loop_count - sec - sbc #1 - sta _index_right - lda #0 - sta _index_left -_loop ldy _index_right - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_left - lda (P8ZP_SCRATCH_W1),y - ldy _index_right - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_left - sta (P8ZP_SCRATCH_W1),y - inc _index_left - dec _index_right - dec _loop_count - bne _loop - rts - .pend - - -func_reverse_w .proc - ; --- reverse an array of words (in-place) - ; inputs: pointer to array in P8ZP_SCRATCH_W1, length in A -_index_first = P8ZP_SCRATCH_W2 -_index_second = P8ZP_SCRATCH_W2+1 -_loop_count = P8ZP_SCRATCH_REG - pha - asl a ; *2 because words - sec - sbc #2 - sta _index_first - lda #0 - sta _index_second - pla - lsr a - pha - sta _loop_count - ; first reverse the lsbs -_loop_lo ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - inc _index_second - inc _index_second - dec _index_first - dec _index_first - dec _loop_count - bne _loop_lo - ; now reverse the msbs - dec _index_second - inc _index_first - inc _index_first - inc _index_first - pla - sta _loop_count -_loop_hi ldy _index_first - lda (P8ZP_SCRATCH_W1),y - pha - ldy _index_second - lda (P8ZP_SCRATCH_W1),y - ldy _index_first - sta (P8ZP_SCRATCH_W1),y - pla - ldy _index_second - sta (P8ZP_SCRATCH_W1),y - dec _index_second - dec _index_second - inc _index_first - inc _index_first - dec _loop_count - bne _loop_hi - - rts - .pend - - -func_peekw .proc - ; -- read the word value on the address in AY - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 - lda (P8ZP_SCRATCH_W1),y - pha - iny - lda (P8ZP_SCRATCH_W1),y - tay - pla - rts - .pend - - -func_pokew .proc - ; -- store the word value in AY in the address in P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_REG - ldy #0 - sta (P8ZP_SCRATCH_W1),y - iny - lda P8ZP_SCRATCH_REG - sta (P8ZP_SCRATCH_W1),y - rts - .pend - - -func_clamp_byte .proc - ; signed value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - tay - sec - sbc P8ZP_SCRATCH_W1+1 - bvc + - eor #$80 -+ bmi + - lda P8ZP_SCRATCH_W1+1 - tay - jmp ++ -+ tya -+ sec - sbc P8ZP_SCRATCH_W1 - bvc + - eor #$80 -+ bmi + - tya - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - - -func_clamp_ubyte .proc - ; value in A, result in A - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W1+1 - cmp P8ZP_SCRATCH_W1+1 - bcc + - lda P8ZP_SCRATCH_W1+1 -+ cmp P8ZP_SCRATCH_W1 - bcc + - rts -+ lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_word .proc - ; signed value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - ldy P8ZP_SCRATCH_W2+1 - lda P8ZP_SCRATCH_W2 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - cmp P8ZP_SCRATCH_B1 - tya - sbc P8ZP_SCRATCH_REG - bvc + - eor #$80 -+ bpl + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - .pend - -func_clamp_uword .proc - ; value in AY, result in AY - ; minimum in P8ZP_SCRATCH_W1 - ; maximum in P8ZP_SCRATCH_W2 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG - cpy P8ZP_SCRATCH_W2+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W2 - bcc ++ -+ beq + - lda P8ZP_SCRATCH_W2 - ldy P8ZP_SCRATCH_W2+1 - sta P8ZP_SCRATCH_B1 - sty P8ZP_SCRATCH_REG -+ ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - cpy P8ZP_SCRATCH_W1+1 - bcc ++ - bne + - cmp P8ZP_SCRATCH_W1 - bcc ++ -+ beq + - ldy P8ZP_SCRATCH_REG - lda P8ZP_SCRATCH_B1 - rts -+ ldy P8ZP_SCRATCH_W1+1 - lda P8ZP_SCRATCH_W1 - rts - - .pend - .pend -; global float constants -; expression temp vars - .section BSS - .send BSS -; bss sections -PROG8_VARSHIGH_RAMBANK = 1 -prog8_bss_section_start - .dsection BSS -prog8_bss_section_size = * - prog8_bss_section_start - .dsection slabs_BSS -prog8_program_end ; end of program label for progend() diff --git a/compiler/test/comparisons/test_word_splitw_lte.p8 b/compiler/test/comparisons/test_word_splitw_lte.p8 deleted file mode 100644 index f58a6ac49..000000000 --- a/compiler/test/comparisons/test_word_splitw_lte.p8 +++ /dev/null @@ -1,2373 +0,0 @@ - -%import textio -%import floats -%import test_stack -%zeropage dontuse -%option no_sysinit - -main { - uword success = 0 - str datatype = "word" - uword @shared comparison - - sub start() { - txt.print("\nless-equal split words array tests for: ") - txt.print(datatype) - txt.nl() - test_stack.test() - txt.print("\n<=array[]: ") - test_cmp_array() - test_stack.test() - } - - sub verify_success(uword expected) { - if success==expected { - txt.print("ok") - } else { - txt.print(" **failed** ") - txt.print_uw(success) - txt.print(" success, expected ") - txt.print_uw(expected) - } - } - - sub fail_word(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - sub fail_uword(uword idx) { - txt.print(" **fail#") - txt.print_uw(idx) - txt.print(" **") - } - - - sub test_cmp_array() { - word @shared x - word[] @split values = [0, 0] - word[] @split sources = [0, 0] - success = 0 - x=-21829 - sources[1]=-21829 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl1a - goto skip1a -lbl1a: success++ -skip1a: - ; indirect jump - cx16.r3 = &lbl1b - if x<=values[1] - goto cx16.r3 - goto skip1b -lbl1b: success++ -skip1b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl1c - goto skip1c -lbl1c: success++ -skip1c: - ; indirect jump - cx16.r3 = &lbl1d - if sources[1]<=values[1] - goto cx16.r3 - goto skip1d -lbl1d: success++ -skip1d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl2a - goto skip2a -lbl2a: success++ -skip2a: - ; indirect jump - cx16.r3 = &lbl2b - if x<=values[1] - goto cx16.r3 - goto skip2b -lbl2b: success++ -skip2b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl2c - goto skip2c -lbl2c: success++ -skip2c: - ; indirect jump - cx16.r3 = &lbl2d - if sources[1]<=values[1] - goto cx16.r3 - goto skip2d -lbl2d: success++ -skip2d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl3a - goto skip3a -lbl3a: success++ -skip3a: - ; indirect jump - cx16.r3 = &lbl3b - if x<=values[1] - goto cx16.r3 - goto skip3b -lbl3b: success++ -skip3b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl3c - goto skip3c -lbl3c: success++ -skip3c: - ; indirect jump - cx16.r3 = &lbl3d - if sources[1]<=values[1] - goto cx16.r3 - goto skip3d -lbl3d: success++ -skip3d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl4a - goto skip4a -lbl4a: success++ -skip4a: - ; indirect jump - cx16.r3 = &lbl4b - if x<=values[1] - goto cx16.r3 - goto skip4b -lbl4b: success++ -skip4b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl4c - goto skip4c -lbl4c: success++ -skip4c: - ; indirect jump - cx16.r3 = &lbl4d - if sources[1]<=values[1] - goto cx16.r3 - goto skip4d -lbl4d: success++ -skip4d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl5a - goto skip5a -lbl5a: success++ -skip5a: - ; indirect jump - cx16.r3 = &lbl5b - if x<=values[1] - goto cx16.r3 - goto skip5b -lbl5b: success++ -skip5b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl5c - goto skip5c -lbl5c: success++ -skip5c: - ; indirect jump - cx16.r3 = &lbl5d - if sources[1]<=values[1] - goto cx16.r3 - goto skip5d -lbl5d: success++ -skip5d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl6a - goto skip6a -lbl6a: success++ -skip6a: - ; indirect jump - cx16.r3 = &lbl6b - if x<=values[1] - goto cx16.r3 - goto skip6b -lbl6b: success++ -skip6b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl6c - goto skip6c -lbl6c: success++ -skip6c: - ; indirect jump - cx16.r3 = &lbl6d - if sources[1]<=values[1] - goto cx16.r3 - goto skip6d -lbl6d: success++ -skip6d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl7a - goto skip7a -lbl7a: success++ -skip7a: - ; indirect jump - cx16.r3 = &lbl7b - if x<=values[1] - goto cx16.r3 - goto skip7b -lbl7b: success++ -skip7b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl7c - goto skip7c -lbl7c: success++ -skip7c: - ; indirect jump - cx16.r3 = &lbl7d - if sources[1]<=values[1] - goto cx16.r3 - goto skip7d -lbl7d: success++ -skip7d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=-1 - sources[1]=-1 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl8a - goto skip8a -lbl8a: fail_word(1) -skip8a: - ; indirect jump - cx16.r3 = &lbl8b - if x<=values[1] - goto cx16.r3 - goto skip8b -lbl8b: fail_word(2) -skip8b: - ; no else - if x<=values[1] - fail_word(3) - - ; with else - if x<=values[1] - fail_word(4) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl8c - goto skip8c -lbl8c: fail_word(5) -skip8c: - ; indirect jump - cx16.r3 = &lbl8d - if sources[1]<=values[1] - goto cx16.r3 - goto skip8d -lbl8d: fail_word(6) -skip8d: - ; no else - if sources[1]<=values[1] - fail_word(7) - - ; with else - if sources[1]<=values[1] - fail_word(8) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl9a - goto skip9a -lbl9a: success++ -skip9a: - ; indirect jump - cx16.r3 = &lbl9b - if x<=values[1] - goto cx16.r3 - goto skip9b -lbl9b: success++ -skip9b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl9c - goto skip9c -lbl9c: success++ -skip9c: - ; indirect jump - cx16.r3 = &lbl9d - if sources[1]<=values[1] - goto cx16.r3 - goto skip9d -lbl9d: success++ -skip9d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl10a - goto skip10a -lbl10a: success++ -skip10a: - ; indirect jump - cx16.r3 = &lbl10b - if x<=values[1] - goto cx16.r3 - goto skip10b -lbl10b: success++ -skip10b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl10c - goto skip10c -lbl10c: success++ -skip10c: - ; indirect jump - cx16.r3 = &lbl10d - if sources[1]<=values[1] - goto cx16.r3 - goto skip10d -lbl10d: success++ -skip10d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl11a - goto skip11a -lbl11a: success++ -skip11a: - ; indirect jump - cx16.r3 = &lbl11b - if x<=values[1] - goto cx16.r3 - goto skip11b -lbl11b: success++ -skip11b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl11c - goto skip11c -lbl11c: success++ -skip11c: - ; indirect jump - cx16.r3 = &lbl11d - if sources[1]<=values[1] - goto cx16.r3 - goto skip11d -lbl11d: success++ -skip11d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl12a - goto skip12a -lbl12a: success++ -skip12a: - ; indirect jump - cx16.r3 = &lbl12b - if x<=values[1] - goto cx16.r3 - goto skip12b -lbl12b: success++ -skip12b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl12c - goto skip12c -lbl12c: success++ -skip12c: - ; indirect jump - cx16.r3 = &lbl12d - if sources[1]<=values[1] - goto cx16.r3 - goto skip12d -lbl12d: success++ -skip12d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl13a - goto skip13a -lbl13a: success++ -skip13a: - ; indirect jump - cx16.r3 = &lbl13b - if x<=values[1] - goto cx16.r3 - goto skip13b -lbl13b: success++ -skip13b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl13c - goto skip13c -lbl13c: success++ -skip13c: - ; indirect jump - cx16.r3 = &lbl13d - if sources[1]<=values[1] - goto cx16.r3 - goto skip13d -lbl13d: success++ -skip13d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl14a - goto skip14a -lbl14a: success++ -skip14a: - ; indirect jump - cx16.r3 = &lbl14b - if x<=values[1] - goto cx16.r3 - goto skip14b -lbl14b: success++ -skip14b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl14c - goto skip14c -lbl14c: success++ -skip14c: - ; indirect jump - cx16.r3 = &lbl14d - if sources[1]<=values[1] - goto cx16.r3 - goto skip14d -lbl14d: success++ -skip14d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=0 - sources[1]=0 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl15a - goto skip15a -lbl15a: fail_word(9) -skip15a: - ; indirect jump - cx16.r3 = &lbl15b - if x<=values[1] - goto cx16.r3 - goto skip15b -lbl15b: fail_word(10) -skip15b: - ; no else - if x<=values[1] - fail_word(11) - - ; with else - if x<=values[1] - fail_word(12) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl15c - goto skip15c -lbl15c: fail_word(13) -skip15c: - ; indirect jump - cx16.r3 = &lbl15d - if sources[1]<=values[1] - goto cx16.r3 - goto skip15d -lbl15d: fail_word(14) -skip15d: - ; no else - if sources[1]<=values[1] - fail_word(15) - - ; with else - if sources[1]<=values[1] - fail_word(16) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl16a - goto skip16a -lbl16a: fail_word(17) -skip16a: - ; indirect jump - cx16.r3 = &lbl16b - if x<=values[1] - goto cx16.r3 - goto skip16b -lbl16b: fail_word(18) -skip16b: - ; no else - if x<=values[1] - fail_word(19) - - ; with else - if x<=values[1] - fail_word(20) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl16c - goto skip16c -lbl16c: fail_word(21) -skip16c: - ; indirect jump - cx16.r3 = &lbl16d - if sources[1]<=values[1] - goto cx16.r3 - goto skip16d -lbl16d: fail_word(22) -skip16d: - ; no else - if sources[1]<=values[1] - fail_word(23) - - ; with else - if sources[1]<=values[1] - fail_word(24) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl17a - goto skip17a -lbl17a: success++ -skip17a: - ; indirect jump - cx16.r3 = &lbl17b - if x<=values[1] - goto cx16.r3 - goto skip17b -lbl17b: success++ -skip17b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl17c - goto skip17c -lbl17c: success++ -skip17c: - ; indirect jump - cx16.r3 = &lbl17d - if sources[1]<=values[1] - goto cx16.r3 - goto skip17d -lbl17d: success++ -skip17d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl18a - goto skip18a -lbl18a: success++ -skip18a: - ; indirect jump - cx16.r3 = &lbl18b - if x<=values[1] - goto cx16.r3 - goto skip18b -lbl18b: success++ -skip18b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl18c - goto skip18c -lbl18c: success++ -skip18c: - ; indirect jump - cx16.r3 = &lbl18d - if sources[1]<=values[1] - goto cx16.r3 - goto skip18d -lbl18d: success++ -skip18d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl19a - goto skip19a -lbl19a: success++ -skip19a: - ; indirect jump - cx16.r3 = &lbl19b - if x<=values[1] - goto cx16.r3 - goto skip19b -lbl19b: success++ -skip19b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl19c - goto skip19c -lbl19c: success++ -skip19c: - ; indirect jump - cx16.r3 = &lbl19d - if sources[1]<=values[1] - goto cx16.r3 - goto skip19d -lbl19d: success++ -skip19d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl20a - goto skip20a -lbl20a: success++ -skip20a: - ; indirect jump - cx16.r3 = &lbl20b - if x<=values[1] - goto cx16.r3 - goto skip20b -lbl20b: success++ -skip20b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl20c - goto skip20c -lbl20c: success++ -skip20c: - ; indirect jump - cx16.r3 = &lbl20d - if sources[1]<=values[1] - goto cx16.r3 - goto skip20d -lbl20d: success++ -skip20d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl21a - goto skip21a -lbl21a: success++ -skip21a: - ; indirect jump - cx16.r3 = &lbl21b - if x<=values[1] - goto cx16.r3 - goto skip21b -lbl21b: success++ -skip21b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl21c - goto skip21c -lbl21c: success++ -skip21c: - ; indirect jump - cx16.r3 = &lbl21d - if sources[1]<=values[1] - goto cx16.r3 - goto skip21d -lbl21d: success++ -skip21d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=1 - sources[1]=1 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl22a - goto skip22a -lbl22a: fail_word(25) -skip22a: - ; indirect jump - cx16.r3 = &lbl22b - if x<=values[1] - goto cx16.r3 - goto skip22b -lbl22b: fail_word(26) -skip22b: - ; no else - if x<=values[1] - fail_word(27) - - ; with else - if x<=values[1] - fail_word(28) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl22c - goto skip22c -lbl22c: fail_word(29) -skip22c: - ; indirect jump - cx16.r3 = &lbl22d - if sources[1]<=values[1] - goto cx16.r3 - goto skip22d -lbl22d: fail_word(30) -skip22d: - ; no else - if sources[1]<=values[1] - fail_word(31) - - ; with else - if sources[1]<=values[1] - fail_word(32) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl23a - goto skip23a -lbl23a: fail_word(33) -skip23a: - ; indirect jump - cx16.r3 = &lbl23b - if x<=values[1] - goto cx16.r3 - goto skip23b -lbl23b: fail_word(34) -skip23b: - ; no else - if x<=values[1] - fail_word(35) - - ; with else - if x<=values[1] - fail_word(36) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl23c - goto skip23c -lbl23c: fail_word(37) -skip23c: - ; indirect jump - cx16.r3 = &lbl23d - if sources[1]<=values[1] - goto cx16.r3 - goto skip23d -lbl23d: fail_word(38) -skip23d: - ; no else - if sources[1]<=values[1] - fail_word(39) - - ; with else - if sources[1]<=values[1] - fail_word(40) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl24a - goto skip24a -lbl24a: fail_word(41) -skip24a: - ; indirect jump - cx16.r3 = &lbl24b - if x<=values[1] - goto cx16.r3 - goto skip24b -lbl24b: fail_word(42) -skip24b: - ; no else - if x<=values[1] - fail_word(43) - - ; with else - if x<=values[1] - fail_word(44) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl24c - goto skip24c -lbl24c: fail_word(45) -skip24c: - ; indirect jump - cx16.r3 = &lbl24d - if sources[1]<=values[1] - goto cx16.r3 - goto skip24d -lbl24d: fail_word(46) -skip24d: - ; no else - if sources[1]<=values[1] - fail_word(47) - - ; with else - if sources[1]<=values[1] - fail_word(48) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl25a - goto skip25a -lbl25a: success++ -skip25a: - ; indirect jump - cx16.r3 = &lbl25b - if x<=values[1] - goto cx16.r3 - goto skip25b -lbl25b: success++ -skip25b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl25c - goto skip25c -lbl25c: success++ -skip25c: - ; indirect jump - cx16.r3 = &lbl25d - if sources[1]<=values[1] - goto cx16.r3 - goto skip25d -lbl25d: success++ -skip25d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl26a - goto skip26a -lbl26a: success++ -skip26a: - ; indirect jump - cx16.r3 = &lbl26b - if x<=values[1] - goto cx16.r3 - goto skip26b -lbl26b: success++ -skip26b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl26c - goto skip26c -lbl26c: success++ -skip26c: - ; indirect jump - cx16.r3 = &lbl26d - if sources[1]<=values[1] - goto cx16.r3 - goto skip26d -lbl26d: success++ -skip26d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl27a - goto skip27a -lbl27a: success++ -skip27a: - ; indirect jump - cx16.r3 = &lbl27b - if x<=values[1] - goto cx16.r3 - goto skip27b -lbl27b: success++ -skip27b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl27c - goto skip27c -lbl27c: success++ -skip27c: - ; indirect jump - cx16.r3 = &lbl27d - if sources[1]<=values[1] - goto cx16.r3 - goto skip27d -lbl27d: success++ -skip27d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl28a - goto skip28a -lbl28a: success++ -skip28a: - ; indirect jump - cx16.r3 = &lbl28b - if x<=values[1] - goto cx16.r3 - goto skip28b -lbl28b: success++ -skip28b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl28c - goto skip28c -lbl28c: success++ -skip28c: - ; indirect jump - cx16.r3 = &lbl28d - if sources[1]<=values[1] - goto cx16.r3 - goto skip28d -lbl28d: success++ -skip28d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=170 - sources[1]=170 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl29a - goto skip29a -lbl29a: fail_word(49) -skip29a: - ; indirect jump - cx16.r3 = &lbl29b - if x<=values[1] - goto cx16.r3 - goto skip29b -lbl29b: fail_word(50) -skip29b: - ; no else - if x<=values[1] - fail_word(51) - - ; with else - if x<=values[1] - fail_word(52) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl29c - goto skip29c -lbl29c: fail_word(53) -skip29c: - ; indirect jump - cx16.r3 = &lbl29d - if sources[1]<=values[1] - goto cx16.r3 - goto skip29d -lbl29d: fail_word(54) -skip29d: - ; no else - if sources[1]<=values[1] - fail_word(55) - - ; with else - if sources[1]<=values[1] - fail_word(56) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl30a - goto skip30a -lbl30a: fail_word(57) -skip30a: - ; indirect jump - cx16.r3 = &lbl30b - if x<=values[1] - goto cx16.r3 - goto skip30b -lbl30b: fail_word(58) -skip30b: - ; no else - if x<=values[1] - fail_word(59) - - ; with else - if x<=values[1] - fail_word(60) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl30c - goto skip30c -lbl30c: fail_word(61) -skip30c: - ; indirect jump - cx16.r3 = &lbl30d - if sources[1]<=values[1] - goto cx16.r3 - goto skip30d -lbl30d: fail_word(62) -skip30d: - ; no else - if sources[1]<=values[1] - fail_word(63) - - ; with else - if sources[1]<=values[1] - fail_word(64) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl31a - goto skip31a -lbl31a: fail_word(65) -skip31a: - ; indirect jump - cx16.r3 = &lbl31b - if x<=values[1] - goto cx16.r3 - goto skip31b -lbl31b: fail_word(66) -skip31b: - ; no else - if x<=values[1] - fail_word(67) - - ; with else - if x<=values[1] - fail_word(68) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl31c - goto skip31c -lbl31c: fail_word(69) -skip31c: - ; indirect jump - cx16.r3 = &lbl31d - if sources[1]<=values[1] - goto cx16.r3 - goto skip31d -lbl31d: fail_word(70) -skip31d: - ; no else - if sources[1]<=values[1] - fail_word(71) - - ; with else - if sources[1]<=values[1] - fail_word(72) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl32a - goto skip32a -lbl32a: fail_word(73) -skip32a: - ; indirect jump - cx16.r3 = &lbl32b - if x<=values[1] - goto cx16.r3 - goto skip32b -lbl32b: fail_word(74) -skip32b: - ; no else - if x<=values[1] - fail_word(75) - - ; with else - if x<=values[1] - fail_word(76) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl32c - goto skip32c -lbl32c: fail_word(77) -skip32c: - ; indirect jump - cx16.r3 = &lbl32d - if sources[1]<=values[1] - goto cx16.r3 - goto skip32d -lbl32d: fail_word(78) -skip32d: - ; no else - if sources[1]<=values[1] - fail_word(79) - - ; with else - if sources[1]<=values[1] - fail_word(80) - else - success++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl33a - goto skip33a -lbl33a: success++ -skip33a: - ; indirect jump - cx16.r3 = &lbl33b - if x<=values[1] - goto cx16.r3 - goto skip33b -lbl33b: success++ -skip33b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl33c - goto skip33c -lbl33c: success++ -skip33c: - ; indirect jump - cx16.r3 = &lbl33d - if sources[1]<=values[1] - goto cx16.r3 - goto skip33d -lbl33d: success++ -skip33d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl34a - goto skip34a -lbl34a: success++ -skip34a: - ; indirect jump - cx16.r3 = &lbl34b - if x<=values[1] - goto cx16.r3 - goto skip34b -lbl34b: success++ -skip34b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl34c - goto skip34c -lbl34c: success++ -skip34c: - ; indirect jump - cx16.r3 = &lbl34d - if sources[1]<=values[1] - goto cx16.r3 - goto skip34d -lbl34d: success++ -skip34d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl35a - goto skip35a -lbl35a: success++ -skip35a: - ; indirect jump - cx16.r3 = &lbl35b - if x<=values[1] - goto cx16.r3 - goto skip35b -lbl35b: success++ -skip35b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl35c - goto skip35c -lbl35c: success++ -skip35c: - ; indirect jump - cx16.r3 = &lbl35d - if sources[1]<=values[1] - goto cx16.r3 - goto skip35d -lbl35d: success++ -skip35d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=30464 - sources[1]=30464 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl36a - goto skip36a -lbl36a: fail_word(81) -skip36a: - ; indirect jump - cx16.r3 = &lbl36b - if x<=values[1] - goto cx16.r3 - goto skip36b -lbl36b: fail_word(82) -skip36b: - ; no else - if x<=values[1] - fail_word(83) - - ; with else - if x<=values[1] - fail_word(84) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl36c - goto skip36c -lbl36c: fail_word(85) -skip36c: - ; indirect jump - cx16.r3 = &lbl36d - if sources[1]<=values[1] - goto cx16.r3 - goto skip36d -lbl36d: fail_word(86) -skip36d: - ; no else - if sources[1]<=values[1] - fail_word(87) - - ; with else - if sources[1]<=values[1] - fail_word(88) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl37a - goto skip37a -lbl37a: fail_word(89) -skip37a: - ; indirect jump - cx16.r3 = &lbl37b - if x<=values[1] - goto cx16.r3 - goto skip37b -lbl37b: fail_word(90) -skip37b: - ; no else - if x<=values[1] - fail_word(91) - - ; with else - if x<=values[1] - fail_word(92) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl37c - goto skip37c -lbl37c: fail_word(93) -skip37c: - ; indirect jump - cx16.r3 = &lbl37d - if sources[1]<=values[1] - goto cx16.r3 - goto skip37d -lbl37d: fail_word(94) -skip37d: - ; no else - if sources[1]<=values[1] - fail_word(95) - - ; with else - if sources[1]<=values[1] - fail_word(96) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl38a - goto skip38a -lbl38a: fail_word(97) -skip38a: - ; indirect jump - cx16.r3 = &lbl38b - if x<=values[1] - goto cx16.r3 - goto skip38b -lbl38b: fail_word(98) -skip38b: - ; no else - if x<=values[1] - fail_word(99) - - ; with else - if x<=values[1] - fail_word(100) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl38c - goto skip38c -lbl38c: fail_word(101) -skip38c: - ; indirect jump - cx16.r3 = &lbl38d - if sources[1]<=values[1] - goto cx16.r3 - goto skip38d -lbl38d: fail_word(102) -skip38d: - ; no else - if sources[1]<=values[1] - fail_word(103) - - ; with else - if sources[1]<=values[1] - fail_word(104) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl39a - goto skip39a -lbl39a: fail_word(105) -skip39a: - ; indirect jump - cx16.r3 = &lbl39b - if x<=values[1] - goto cx16.r3 - goto skip39b -lbl39b: fail_word(106) -skip39b: - ; no else - if x<=values[1] - fail_word(107) - - ; with else - if x<=values[1] - fail_word(108) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl39c - goto skip39c -lbl39c: fail_word(109) -skip39c: - ; indirect jump - cx16.r3 = &lbl39d - if sources[1]<=values[1] - goto cx16.r3 - goto skip39d -lbl39d: fail_word(110) -skip39d: - ; no else - if sources[1]<=values[1] - fail_word(111) - - ; with else - if sources[1]<=values[1] - fail_word(112) - else - success++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl40a - goto skip40a -lbl40a: fail_word(113) -skip40a: - ; indirect jump - cx16.r3 = &lbl40b - if x<=values[1] - goto cx16.r3 - goto skip40b -lbl40b: fail_word(114) -skip40b: - ; no else - if x<=values[1] - fail_word(115) - - ; with else - if x<=values[1] - fail_word(116) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl40c - goto skip40c -lbl40c: fail_word(117) -skip40c: - ; indirect jump - cx16.r3 = &lbl40d - if sources[1]<=values[1] - goto cx16.r3 - goto skip40d -lbl40d: fail_word(118) -skip40d: - ; no else - if sources[1]<=values[1] - fail_word(119) - - ; with else - if sources[1]<=values[1] - fail_word(120) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl41a - goto skip41a -lbl41a: success++ -skip41a: - ; indirect jump - cx16.r3 = &lbl41b - if x<=values[1] - goto cx16.r3 - goto skip41b -lbl41b: success++ -skip41b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl41c - goto skip41c -lbl41c: success++ -skip41c: - ; indirect jump - cx16.r3 = &lbl41d - if sources[1]<=values[1] - goto cx16.r3 - goto skip41d -lbl41d: success++ -skip41d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl42a - goto skip42a -lbl42a: success++ -skip42a: - ; indirect jump - cx16.r3 = &lbl42b - if x<=values[1] - goto cx16.r3 - goto skip42b -lbl42b: success++ -skip42b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl42c - goto skip42c -lbl42c: success++ -skip42c: - ; indirect jump - cx16.r3 = &lbl42d - if sources[1]<=values[1] - goto cx16.r3 - goto skip42d -lbl42d: success++ -skip42d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - x=32767 - sources[1]=32767 - values[1]=-21829 - ; direct jump - if x<=values[1] - goto lbl43a - goto skip43a -lbl43a: fail_word(121) -skip43a: - ; indirect jump - cx16.r3 = &lbl43b - if x<=values[1] - goto cx16.r3 - goto skip43b -lbl43b: fail_word(122) -skip43b: - ; no else - if x<=values[1] - fail_word(123) - - ; with else - if x<=values[1] - fail_word(124) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl43c - goto skip43c -lbl43c: fail_word(125) -skip43c: - ; indirect jump - cx16.r3 = &lbl43d - if sources[1]<=values[1] - goto cx16.r3 - goto skip43d -lbl43d: fail_word(126) -skip43d: - ; no else - if sources[1]<=values[1] - fail_word(127) - - ; with else - if sources[1]<=values[1] - fail_word(128) - else - success++ - - values[1]=-1 - ; direct jump - if x<=values[1] - goto lbl44a - goto skip44a -lbl44a: fail_word(129) -skip44a: - ; indirect jump - cx16.r3 = &lbl44b - if x<=values[1] - goto cx16.r3 - goto skip44b -lbl44b: fail_word(130) -skip44b: - ; no else - if x<=values[1] - fail_word(131) - - ; with else - if x<=values[1] - fail_word(132) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl44c - goto skip44c -lbl44c: fail_word(133) -skip44c: - ; indirect jump - cx16.r3 = &lbl44d - if sources[1]<=values[1] - goto cx16.r3 - goto skip44d -lbl44d: fail_word(134) -skip44d: - ; no else - if sources[1]<=values[1] - fail_word(135) - - ; with else - if sources[1]<=values[1] - fail_word(136) - else - success++ - - values[1]=0 - ; direct jump - if x<=values[1] - goto lbl45a - goto skip45a -lbl45a: fail_word(137) -skip45a: - ; indirect jump - cx16.r3 = &lbl45b - if x<=values[1] - goto cx16.r3 - goto skip45b -lbl45b: fail_word(138) -skip45b: - ; no else - if x<=values[1] - fail_word(139) - - ; with else - if x<=values[1] - fail_word(140) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl45c - goto skip45c -lbl45c: fail_word(141) -skip45c: - ; indirect jump - cx16.r3 = &lbl45d - if sources[1]<=values[1] - goto cx16.r3 - goto skip45d -lbl45d: fail_word(142) -skip45d: - ; no else - if sources[1]<=values[1] - fail_word(143) - - ; with else - if sources[1]<=values[1] - fail_word(144) - else - success++ - - values[1]=1 - ; direct jump - if x<=values[1] - goto lbl46a - goto skip46a -lbl46a: fail_word(145) -skip46a: - ; indirect jump - cx16.r3 = &lbl46b - if x<=values[1] - goto cx16.r3 - goto skip46b -lbl46b: fail_word(146) -skip46b: - ; no else - if x<=values[1] - fail_word(147) - - ; with else - if x<=values[1] - fail_word(148) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl46c - goto skip46c -lbl46c: fail_word(149) -skip46c: - ; indirect jump - cx16.r3 = &lbl46d - if sources[1]<=values[1] - goto cx16.r3 - goto skip46d -lbl46d: fail_word(150) -skip46d: - ; no else - if sources[1]<=values[1] - fail_word(151) - - ; with else - if sources[1]<=values[1] - fail_word(152) - else - success++ - - values[1]=170 - ; direct jump - if x<=values[1] - goto lbl47a - goto skip47a -lbl47a: fail_word(153) -skip47a: - ; indirect jump - cx16.r3 = &lbl47b - if x<=values[1] - goto cx16.r3 - goto skip47b -lbl47b: fail_word(154) -skip47b: - ; no else - if x<=values[1] - fail_word(155) - - ; with else - if x<=values[1] - fail_word(156) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl47c - goto skip47c -lbl47c: fail_word(157) -skip47c: - ; indirect jump - cx16.r3 = &lbl47d - if sources[1]<=values[1] - goto cx16.r3 - goto skip47d -lbl47d: fail_word(158) -skip47d: - ; no else - if sources[1]<=values[1] - fail_word(159) - - ; with else - if sources[1]<=values[1] - fail_word(160) - else - success++ - - values[1]=30464 - ; direct jump - if x<=values[1] - goto lbl48a - goto skip48a -lbl48a: fail_word(161) -skip48a: - ; indirect jump - cx16.r3 = &lbl48b - if x<=values[1] - goto cx16.r3 - goto skip48b -lbl48b: fail_word(162) -skip48b: - ; no else - if x<=values[1] - fail_word(163) - - ; with else - if x<=values[1] - fail_word(164) - else - success++ - - ; direct jump - if sources[1]<=values[1] - goto lbl48c - goto skip48c -lbl48c: fail_word(165) -skip48c: - ; indirect jump - cx16.r3 = &lbl48d - if sources[1]<=values[1] - goto cx16.r3 - goto skip48d -lbl48d: fail_word(166) -skip48d: - ; no else - if sources[1]<=values[1] - fail_word(167) - - ; with else - if sources[1]<=values[1] - fail_word(168) - else - success++ - - values[1]=32767 - ; direct jump - if x<=values[1] - goto lbl49a - goto skip49a -lbl49a: success++ -skip49a: - ; indirect jump - cx16.r3 = &lbl49b - if x<=values[1] - goto cx16.r3 - goto skip49b -lbl49b: success++ -skip49b: - ; no else - if x<=values[1] - success++ - - ; with else - if x<=values[1] - success++ - else - cx16.r0L++ - - ; direct jump - if sources[1]<=values[1] - goto lbl49c - goto skip49c -lbl49c: success++ -skip49c: - ; indirect jump - cx16.r3 = &lbl49d - if sources[1]<=values[1] - goto cx16.r3 - goto skip49d -lbl49d: success++ -skip49d: - ; no else - if sources[1]<=values[1] - success++ - - ; with else - if sources[1]<=values[1] - success++ - else - cx16.r0L++ - - verify_success(266) -} - -} - diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 1eb1f5077..044ac826b 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -501,32 +501,40 @@ but perhaps the provided ones can be of service too. Do not use zeros for the seed! ``sin8u (x)`` - Fast 8-bit ubyte sine of angle 0..255, result is in range 0..255 + Fast 8-bit ubyte sine. + x = angle 0...2π scaled as 0...255. Result is unigned, scaled as 0...255 ``sin8 (x)`` - Fast 8-bit byte sine of angle 0..255, result is in range -127..127 + Fast 8-bit byte sine. + x = angle 0...2π scaled as 0...255. Result is signed, scaled as -127...127 ``sinr8u (x)`` - Fast 8-bit ubyte sine of angle 0..179 (each is a 2 degree step), result is in range 0..255 - Angles 180..255 will yield a garbage result! + Fast 8-bit ubyte sine. + x = angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is unsigned, scaled as 0...255. + Input values 180...255 lie outside of the valid input interval and will yield a garbage result! ``sinr8 (x)`` - Fast 8-bit byte sine of angle 0..179 (each is a 2 degree step), result is in range -127..127 - Angles 180..255 will yield a garbage result! + Fast 8-bit byte sine. + x = angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is signed, scaled as -127...127. + Input values 180...255 lie outside of the valid input interval and will yield a garbage result! ``cos8u (x)`` - Fast 8-bit ubyte cosine of angle 0..255, result is in range 0..255 + Fast 8-bit ubyte cosine. + x = angle 0...2π scaled as 0...255. Result is unsigned, scaled as 0...255 ``cos8 (x)`` - Fast 8-bit byte cosine of angle 0..255, result is in range -127..127 + Fast 8-bit byte cosine. + x = angle 0...2π scaled as 0...255. Result is signed, scaled as -127...127 ``cosr8u (x)`` - Fast 8-bit ubyte cosine of angle 0..179 (each is a 2 degree step), result is in range 0..255 - Angles 180..255 will yield a garbage result! + Fast 8-bit ubyte cosine. + x = angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is unsigned, scaled as 0...255. + Input values 180...255 lie outside of the valid input interval and will yield a garbage result! ``cosr8 (x)`` - Fast 8-bit byte cosine of angle 0..179 (each is a 2 degree step), result is in range -127..127 - Angles 180..255 will yield a garbage result! + Fast 8-bit byte cosine. + x = of angle 0...2π scaled as 0...179 (so each value increment is a 2° step). Result is signed, scaled as -127...127. + Input values 180...255 lie outside of the valid input interval and will yield a garbage result! ``atan2 (ubyte x1, ubyte y1, ubyte x2, ubyte y2)`` Fast arctan routine that uses more memory because of large lookup tables.